Saving on State Changes

I know how important it is to send as much to the GPU as possible on every draw call, but depending on the project in development, that can be tough at times.

For instance, I was pondering over rather or not to use one large texture map (officially texture atlas, I just like the word mat) for levels or go with smaller individual textures.

Conclusion, both…

It really depends on the level; for example, a wood material table that doesn’t need its texture repeated can be placed together with similar textures into one Atlas, but what about something like a wall or floor? Walls typically need some texture repeat in order to avoid using a gigantic texture for increased resolution.

Man I tell “ya”, the pixel fill rates on some of these graphics cards are lazy.

Of course grouping geometry together will also cut down on draw calls, but group objects usually are objects that will not have a state change.

No matter how you look at it, having some non Atlas textures and some standalone geometry is unavoidable if you plan on making an interesting game. It would be kind of hard to knock that vase of the table if you combine it with the wall’s geometry. :laughing:

I’m sure I can go without texture repeat on smaller things like rugs, curtains, vases, pictures, plants, etc. and just combine them all into an Atlas.

Walls look like crap with one small non repeat texture.

A good question is… How many state changes and how many draw calls can P3D support/keep up with?

I don’t think Panda put’s any limits here, it’s just the hardware. Old graphic cards (really old like S3Virge or 3dfx) could draw a lot of objects but with just a few polygons each, modern gpu draw milions or more polygons but only a few objects. Things will start to get slower around 100-200 object/batches. If you have 500 or more - you gonna have a bad time.

As for the texture atlas - you can have tiling/repeating textures, you just need more vertex for that. Check my random dungeon tiles models - the texture on the walls and floor repeat 2x and I’m using an atlas. Keep in mind there can be edge bleeding with these textures so, making your own mipmaps is a good move…or some padding.

What was the average number of lights in one area supported by graphics cards? Slipped my mind…


7 to 8 per object

Do P3D lights affect the backside of a twosided object?

Just to be safe, I’m avoiding single face walls.

Since an Actor’s Vertices are handled by the CPU, what would be a good number to cap at? I wouldn’t expect P3D’s pipeline to handle an actor which has 14.5 K vertice that need to be transformed every step per frame.

6.5 Vertice an actor should be ok if several actors only are needed per scene. I have done 14.5 before, but that was on a quad machine with 3.0+ ghz of power and I would rather think single core, 3.0 ghz of power on my current project.

No hard numbers to give you here. It varies tremendously based on your hardware and whatever else you’ve got going on. Try it and see.


I guess multiple textures aren’t so bad after all. The key is, re-using textures. Example, you have several wood surface textures used in level one; the same wood surface textures can also be used in all levels that have something with a wood surface finish, which means optional textures are not loaded to GPU memory and that also eliminates some fetches.