BGE: Set max texture limit to 18.

Authored by Thomas Szepe (hg1) on Jul 4 2015, 11:18 PM.



Actually only 8 textures will be bound but Blender support up 18 texture slots.
The patch change the texture limit to 18 to allow to use more textures if supported.

Diff Detail

Thomas Szepe (hg1) retitled this revision from to BGE: Set max texture limit to 18..Jul 4 2015, 11:18 PM
Thomas Szepe (hg1) updated this object.

Actually I am unsure about this patch because there is a comment that increasing will slow don the rendering.
I have done this patch because I had some user requests about increasing the texture amount,

Porteries Tristan (panzergame) requested changes to this revision.Jul 4 2015, 11:33 PM
Porteries Tristan (panzergame) added inline comments.

ehh big memory usage :S we really need 18 texture instead of 8 ? normally the user should merge texture (if he can) to optimize rendering.

This revision now requires changes to proceed.Jul 4 2015, 11:33 PM

What should I write to your comment? Actually I also don't know if it is useful or not. But sometimes you are need more then 8 textures. when you use GLSL shader (Cubemap 6, normal map (actually video texture can't render a cube map), light map, texture map, cone step map or relief map, specular map, roughness map, ID map, shadow map, noise texture, ........) or stencil maps.
I don't fear about the memory usage because that only 4MB ram for all 18 textures, I think the most PC nowadays have more.

If you and the other think is not useful, we don't need to apply it.

Also you requested changes, what I should change here?

Why 18, not 16 ?

Because Blender has 18 texture slots in the texture menu.

It is possible that you need to increase RAS_MAX_TEXCO to 18 too (if the comment at BL_material is right)

Mitchell Stokes (moguri) requested changes to this revision.Jul 6 2015, 4:21 AM

This makes our verts a lot larger and is wasted space if we're not using the extra textures, which is common. This patch increases our vertex size by 75%, which is 75% more bandwidth needed to upload vertex data, and 75% more VRAM when using VBOs. It's also not 32-byte aligned, which AMD cards aren't too fond of (or at least they used to be, I don't know about GCN).

I have a question regarding the limitation of texture slots.

My company is using blender to render fabric and we are currently using the texture slots to add images (logos) to the garments. These logos need to be independent (not a combined texture map) so that they can be individually modified by the user (position, scale, and rotation). Because of this need to be able to modify them individually, each one currently uses one texture slot. This limits us to a small number of logos that can be applied to garments. We would like to be able to add a great deal more logos to our garments as some contain several sequins or buttons etc...

Does anyone have any thoughts about the best approach for this? After reading the above comments and concerns about memory usage, I'm hesitant to update the Blender Source code to add more texture slots.

I appreciate any input that you all may have.


@Matt (Matt). The actual texture limit is 8. For now you can use use material nodes to work around the texture limit.

This has become obsolete with the changes in the UPBGE branch. Closing