Archived

This topic is now archived and is closed to further replies.

Kalthorn

dot3 Bumpmapping with vert shader and multitex not working

Recommended Posts

I've written a simple vertex shader (my first) to calculate the Lmap. I want to then combine this color info with my normal map using dot3, then finally blend that with the base texture. All tests I've done show that my vertex shader does everything correctly and the polys are smoothly shaded with that neon look. My problem comes when I try to blend with textures. Hell, even if I don't blend at all (just simply trying to replace the current color with the texture color) it screws up ONLY if the vert shader is enabled. glActiveTexture(GL_TEXTURE0_ARB); glBindTexture (GL_TEXTURE_2D, textures[0][1]); glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT ); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE ); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR ); that code should map my normal map ([0][1]; base is [0][0]) onto my triangles. It does this perfectly when I turn my shader off. When its on, I get some messed up color values that move/change when I move my light around....like it is combining the output vertex color with the texture color instead of replacing it like I *thought* I told it to. If anyone can help me or you need to see some screens or more code, my AIM is Goldeneyes001. [edited by - Kalthorn on October 16, 2002 11:58:44 AM] [edited by - Kalthorn on October 16, 2002 12:15:21 PM]

Share this post


Link to post
Share on other sites
turn off the vertex program before u draw those polygons or set the states of the vertex program (that u have changed) back to their original states

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Hmmm, maybe you misunderstood. I NEED that vertex program running specifically for those (and other) polys. It is what calculates my lightmap for the bumpmapping to even work with the light. Otherwise its bumped, but doesn''t react to light movement.

Share this post


Link to post
Share on other sites
i cant really see how u calculate lightmaps with a vertex program (ie they operate per vertex not pixels) but thats moot.
when u enable vertex programs certain other things in the opengl pipeline are ignored check the arb_vertex_program spec for details, pehaps this is the problem

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Ok, maybe lightmap is the wrong word. The vertex program calculates the light vector, normalizes it and translates it into tangent space and stores the result as the vertex color. These colors are smoothly blended across the triangles and are dot3''d with the normal map texture to create the bump effect. It is needed.

Thanks for the tip, I''ll look into it.

Share this post


Link to post
Share on other sites
Ahh much thanks. I wasn't outputting the tex coords in the vertex program (forgot I had to do that because I wasn't transforming them at all).

Hooray! And thanks again.

[edited by - Kalthorn on October 18, 2002 10:32:23 AM]

[edited by - Kalthorn on October 18, 2002 10:39:58 AM]

Share this post


Link to post
Share on other sites