for you highlightpass check/try following:
- is your glTexEnv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE) ?
- use GL_SRC_COLOR instead of GL_SRC_ALPHA.
but when you get it running you will notice, that it still does not rendering what you really want…that’s because you can’t use fogging with additive blending correctly without any special tweaking.
example:
1.pass diffuse lighted/textured part. -> no blending
2.pass specular highlights -> gl_one,gl_one
when you draw the first pass, the fog is applied to the geometry and rendered into framebuffer.
in the second pass, the fog is applied again, and when blending, you blend two fogged colors together.
so when your object is nearly fully inside the fog, the parts with specular highlights are much brighter than the diffuse only parts…
let’s take a look at the color of a single pixel:
without fog:
1.pass: source 0,0,30
framebuffer 0,0,30
2.pass: source 100,0, 0 (highlight, added to FB)
framebuffer final 100,0,30
now let’s say fog is applied with a blendfactor of 0.5 and its color is 100,100,100
now let’s take a look at our pixel:
1.pass: source 0, 0,30
aplly fog 50,50,65
framebuffer 50,50,65
2.pass: source 10,0,0 (highlight, added to FB)
apply fog 60,50,50
framebuffer final 110,100,65
as you can see this isn’t what you want at all !!! what you want is to apply the fogging to the final color. and this can be only acomplished with a 3rd rendering pass…if you want to make it correctly.
however, when you are only applying specular highlights in the 2nd pass, you can do following:
render the 1st pass with fogging enabled and the second one without fogging, but with attenuated highlight intensity over the distance from the viewpoint.(computed based on the same values like in the standard-fogging)
hope, this helps you a bit.
adrian
[This message has been edited by AdrianD (edited 07-16-2002).]