Mentioned here:
http://www.youtube.com/watch?v=PXQTw...tu.be&t=31m56s
"Whenever you have 2 materials applied to an object, the GPU has to render that mesh twice..."
How true is this? I'm currently working on modular buildings, and plan to reuse 3-4 materials on many different buildings (as I've seen others do). Will this mean that a building using 4 textures will have 4x tris?
Thanks
Replies
So it'll have to render each submesh as if it were a separate object.
So if a building got walls and windows, each with separate materials, it will render out the walls and then the windows? Which is worse than just rendering them both at once?
It has to render the mesh once per material per dynamic light that touches it, which is why UE3 has its lightenvironment stuff for dynamic actors and why its dynamic lights can be so expensive. If you place an object with three materials and put two dynamic lights touching it, it's at LEAST 6 draw calls. I think it might actually be 12+, since the normals might be separated into their own pass (I can't remember if that was stockUE3 or something we did to the engine ourselves in the last project I worked on). And then if any of that is casting dynamic shadows, those are drawcalls too.
So yeah, it adds up quick.
And blankslatejoe is also correct. It'll likely be one pass (drawcall) for base + ambient then one pass for each dynamic light that affects the model. For each material in the object. Plus 3 drawcalls for every light it casts shadows from.
Although UE4 is deferred, I think, which will change things a little.
By the way; I'm not a programmer in any way, so please excuse my ignorance
If you have shadows, then you're adding a drawcall per mesh into the light's shadow buffer, but that's still the same cost as forward rendering.
But yeah, there's still the same amount of drawcalls being used to put those meshes into the GBuffers.
Where you have to pay attention is on stuff you place a hundred times--rocks, trees, buildings-if-you're-building-a-city, etc. Even then, the visual gains may be worth the drawcall costs for --some-- objects. I was working on a an MMO in the UE3 engine and we tried to limit most buildings to 2, but let 'hero' buildings creep up to 4 or 5. Our trees were usually 2. Almost everything else was 1. Our scene total drawcall limit was something like 1100-1400? (can't remember...but we weren't aiming for consoles)
Also, Farfarer, I think that,yeah, deferred will make the lights be a nonissue, since things are lit after being drawn to the buffer..but I think materials will still add draws. We'll have to wait and see, I suppose.
wait!! they're adding batch rendering of meshes?!?? Woah!
The buildings are actually for an entire city, so atlasing them would be recommended?
Another thing I've wondered which is kind of relevant is; when making buildings further away they will obviously need a lower polycount, but is it possible to just reuse the same texture for the LOD0 buildings, instead of using the same but smaller textures?
I'm guessing memory vs performance comes into play here.
As for atlasing--yeah, sounds like you should then. It helps to make tall and skinny atlases --like 512x2048 and then working in 'bands' of textures. That will let you take advantage of tiling across at least the horizontal easily, which is crucial for big buildings.
When you say bands of textures, you mean bands horizontally then? Not quite sure I follow.
It certainly isnt the only way to do things, but it helps with modular env construction