- Home /
Frustum culling doubt
What happens when only half of a mesh falls withing the camera frustum. Does it cause half of its full rendering cost? Or is the entire object rendering cost suffered?
EDIT.
I had this doubt because I didn't quite understand what I read here(3rd para) - http://docs.unity3d.com/Manual/DrawCallBatching.html -Quoting- "Built-in batching support in Unity has significant benefit over simply combining geometry in the modeling tool (or using the CombineChildren script from the Standard Assets package). Batching in Unity happens after the visibility determination step. The engine does culling on each object individually, and the amount of rendered geometry is going to be the same as without batching. Combining geometry in the modeling tool, on the other hand, prevents efficient culling and results in a much greater amount of geometry being rendered." So if someone could explain it, it'd really help! Thanks
Answer by christoph_r · Aug 16, 2014 at 01:10 PM
For each separate object and material, a draw call is necessary for rendering. Draw calls take resources and can be a performance bottle neck. What batching does is grouping objects together so they only take a single draw call. You could achieve the same effect of using only one draw call if you would combine all the models with the same material in your 3D app. However, as it is explained in the part you quoted, this would make it impossible to take advantage of culling those models that are out of view, you either render all of the models you grouped together in your 3D app or none. With batching, that is not the case. The underlying reason for that is that even if you only see a part of a model, as tiny as it may be, the entire model will be rendered. So, basically, what it says it: Don't try to batch in huge amounts of objects in your modeling tool to save draw calls, that's what batching is for. Most of the time it's better to simply group objects with the same material if there is a logical connection, i.e. multiple parts of a fence that are supposed to form ONE fence game object, eventually.
So basically, when a model is completely out of view it's not rendered at all? No visibility = no rendering?
Answer by MrSteve1 · Aug 16, 2014 at 12:45 PM
It will still use its full render cost as you put it. If you are looking to switch things off when you can't see them, you should look into this.
http://docs.unity3d.com/ScriptReference/Renderer.OnBecameVisible.html
But bare in mind that switching things on and off every time you look at them costs processig power too, so use it wisely.
Do you mean it will use its full render cost even if it is completely out of the camera frustum and that saving render cost can only be achieved by manually turning it off?
I see what you're saying, well as yo may have experienced when playing games games can sometimes lag when a lot is happening on screen, but if you look away the frame rate restores back to normal, so that much is true the render count will perform better as there will be less draw calls to make, but it's physical presence in your scene will still consume physical memory.
That is when switching stuff off when your no longer looking at it or going to use will be a good idea.
Your answer
Follow this Question
Related Questions
Image effects do not work when rendering with multiple cameras 0 Answers
Why is my sprite not rendering when it is clearly on screen? 1 Answer
How to render objects outside the camera's view? 1 Answer
occlusion culling conflict with shader,Occlusion culling conflict with shader 0 Answers
Dynamically render/hide object individually for each camera in scene 0 Answers