- Home /
Best practices for developing optimized interiors for Unity?
This is quite a broad question, and I will try to break it down later on for clarity.
I'm basically looking for some tips and advice from those who have had experience in either Arch Viz or simply modelling and texturing of level or architectural interiors for Unity. I've been studying the only two example projects with proper detailed interiors (Airstream Camper and Shadow demo), I can't find any others. I've found two techniques these have in common:
Using smaller, tillable textures (as oppose to UV textures) and sharing them with as many objects in the scene as possible
Combining all the objects by material
The above techniques aren't specific to just interiors obviously, but that is what I've found so far. The problem with these demos is that they're only one 'room' or interior and at runtime hit between 200-300 draw calls already. With the above demos in mind, here a few more specific questions:
What techniques are needed for a building with multiple rooms that need to look different (considering the already high drawcalls above)?
Should each room be a separate object or part of the entire building?
Are shared textures better practice or one separate UV texture for each object?
How to handle culling when outside the building/room (since the interior objects may still be in the camera frustum but hidden by the building wall anyway)?
Apologies for all the sub-questions, I figured that since these are all related it would save web space to just create one question for all of them. Hopefully a person or two can lend some advice :)
Looking forward to hearing it. Thanks for now.
Answer by RRMessiah · Dec 15, 2011 at 02:05 PM
Some notes:
300 draw calls for a room is what I would label "unoptimized." Don't use those projects as examples of how to budget a scene.
Typically rooms are separate from the building for culling and optimization. This includes the interior walls, floors, and props.
Regarding sharing textures or separate textures, this is an issue if you have physics objects. If the props in your room are all static, then attaching them as one mesh for each room and using one material is typically best for performance, but not for memory as each room will have a unique mesh. It's the textbook memory vs. performance tradeoff. The only caveat is if your rooms are huge and you're doing culling based on the bounding box of the meshes. If you attach meshes together and their bounding box is huge, it's likely that it will always render. If you're just portalizing, it's probably not an issue. In the end, I would probably attach models together, but only to a limit. Instead of reducing to 1 or 2 draw calls per room, perhaps 3-5 are ok so they can be culled using a smaller bounding volume.
Not sure how to answer this one as I'm an artist not an engineer.
Hope this helped!
Thanks a lot for your helpful advice! Just have a question about (3): did you mean that a room should have 3-5 drawcalls? Because this seems quite impossible to achieve for me. If not, would you have a suggestion as to how many drawcalls I should be trying to achieve per room, just so I have a general target. Thank you :)
The amount you should achieve per room is dependent on the physical room size and the way you cull the objects.
If a room is the size of your bedroom, you could probably get away with a larger amount of drawcalls. If it's the size of a cathedral, you'll want to be $$anonymous$$dful of the amount because there is simply more content.
The final answer will be dictated by your target platform. If it's pc, go nuts. If it's mobile devices, you have to do some research, testing, and profiling with your game.
You can setup a dummy project. Point your camera in one direction and there are 50 spheres, each with 1 material, rendered on screen. Check the framerate and GPU timer. Turn around and look at 10 spheres with 1 material. Do the same.
Answer by Hamesh81 · Feb 05, 2012 at 08:10 PM
Another good solution for those trouble shooting this problem:
M2H Culling System, available free from the asset store and for Unity Indie!
Your answer
Follow this Question
Related Questions
Memory issues when taking Screenshots ? 1 Answer
Changing color of texture with transparency efficiently 0 Answers
Question about uv map. 0 Answers
Cullingmask issue. 0 Answers
Can the Cull option in shader improve perfomances ? 2 Answers