Vertex colors with multitexturing

Started by
7 comments, last by BradDaBug 20 years, 8 months ago
I''ve got my landscape working with multitexturing, and now it looks really pretty with the detail texture! But the shadows for the landscape are stored in a shadow map which is loaded and then turned into a vertex color array. Now the shadows aren''t working. I guess I have several options for shadows besides the vertex color array, but I don''t like them. I could combine the shadow map onto the texture map for the whole island, but then my plans for several different shadow maps depending on the time of day wouldn''t really be feasable (my shadow map is 256x256 and the texture is 1024x1024!). I could just do multitexturing and put the texture, the detail, and the shadow maps all on top of each other onto the landscape, but I''ve only got a GeForce 2 and it can only multitexture two textures at once (that''s right, isn''t it?). I could do two rendering passes of the landscape, but that would involve rendering the landscape twice, right? Basically cutting my frame rate in half? I miss my vertex color arrays. I''d really like to get them back. Is there a way to use multitexturing with vertex coloring? I''ve tried doing an glEnableClientState(GL_COLOR_ARRAY) and sending the color array for the second texture just like the first, but that didn''t work.
I like the DARK layout!
Advertisement
If you are not using alpha component of primary color and your shadows are not colord you can store shadow in alpha component of primary color. In not, there is still secondary color you could use.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
You mean the primary color of the vertex? But wouldn''t changing the alpha of the vertex color change the transparency of the vertex? And what do you mean by secondary color?
I like the DARK layout!
The secondary colour is supported through an EXT extension or through OpenGL 1.4. The geforce2 supports the former I believe.

Here's how you'd do it with the GL Easy Extension Library (tm) .
if (GLEE_EXT_secondary_color){  glEnable(GL_CURRENT_SECONDARY_COLOR);  glSecondaryColor3fEXT(...);}//Or with vertex arrays you'd use glSecondaryColorPointerEXT(...).


[edited by - benjamin bunny on August 18, 2003 6:56:17 PM]

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

Thanks for the help! Now I''ve got another, kinda related, question.

When I multitexture (is there a better name for this?) the detail and terrain texture map together, it darkens everything (I''m using GL_MODULATE). Using GL_ADD makes everything REALLY bright. I''m hoping I can only apply the detail texture to areas that are kinda close to the camera, but if adding the detail texture makes the terrain lighter or darker, well, that won''t work!

Is there a way to put the detail texture onto the landscape without affecting the lightness or darkness of everything?
I like the DARK layout!
Well, GL_MODULATE multiplies the colours, so it''s bound to get darker when you use it, unless the detail texture is pure white. To minimise this, you can make the detail texture as bright as possible. Maybe you could also make the geometry which doesn''t have a detail texture slightly darker by modifying the colour. I would be tempted to just leave it unless you''re having real performance problems though.

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

No, it runs fast enough for me. I just thought that was kinda the way it was done. Is there any kind of performance hit for multitexturing? I haven''t been able to detect any, but I dunno.
I like the DARK layout!
Yep, but no more than you''d get with GL lighting. Just make sure you use mipmapping for the detail texture.

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

the problem with modulating is that it only works in one direction: darker. adding does the same in the other direction.
with register combiners (and most likely fragment programs) you can scale your color to -1,1 instead of 0,1.. allowing you to make it both, darker or brighter. sounds weird but works well.

if you happen to have a geforce with 4 texture units or more (gf3 or above) you can use the editor for the terrain here:
http://festini.device-zero.de/downloads/dzlse.zip

for now it only allows to "draw" on the terrain (left button) or change the weight for the detail textures (right button). rotate with middle button, the three blank sliders are brush size, opacity and fading.
f@dzhttp://festini.device-zero.de

This topic is closed to new replies.

Advertisement