PDA

View Full Version : Minimizing texbinds / Optimizing arrays



fritzlang
03-13-2002, 12:35 AM
Hello everyone,
I'm having serious trouble with the logistic
of optmizing performance/ minimizing texture
bindings.
I am aware that bindings should be avoided and that you should structure your data so that you draw something like:
for (i=0;i<num_textures;i++){
bindtexture(tex[i]);
draw(everything_using_this_texture)
}
problem is that when I get into
structures such as
tex0 = bumpmap
tex1 = base/diffuse map
tex2 = lightmap

this almost require one bind per primitive, since at least one texunit uses a novel texture per primitive.
I wish there was a way to put texture bindings into an array, and I thought I had
a solution which was to use 3d textures,
and use the 3rd, depth coordinate in a
tex coord array which would switch between textures. Problem is that this does not work with filtering and mipmapping since the depth layers "fade" into each other. I did put up a post a week ago asking about how to treat the depth (r) coordinate but I did not get much wiser.
Whats the point of using a vertex array
if you can only draw a few primitives per call to DrawArrays/DrawElements?
Still it seems like this is what everyone
is doing or am I missing something here?
Will displaylists help me, do they cache
multiple bindings on the gfx hw?

I would be most greatful for any response.

Cheers.

richardve
03-13-2002, 02:29 AM
What you want is a shader tree.

Read the following article for more info:
http://www.delphi3d.net/articles/viewarticle.php?article=stateman.htm