Multipass rendering

Hi,

I’m trying to use multipass rendering to mix emboss bumpmapping & environment gloss mapping. I know how to do them both separately, but i can’t find a way to mix them. Here is what i’m doing:

For emboss bumpmapping:

  1. I put the bumpmap into the color buffer, using standard texture coords.
  2. I shift the texture coords, enable additive blending ( GL_ONE,GL_ONE ), and add the inverse bumpmap to the color buffer,
  3. I enable x2 blending, back to standard tex. coords, and multiply the color buffer by the base texture.

For gloss mapping:

  1. I use spherical tex. gen. and put the environment map into the color buffer,
  2. I come back to standard tex. coords., enable multiplicative alpha blending ( GL_ZERO, GL_SRC_ALPHA ), and multiply the alpha gloss map with the color buffer.
  3. I enable additive blending ( GL_ONE, GL_ONE ) and add the base texture to the color buffer.

Ok, now, how can i do bumpmapping AND gloss mapping ? Both technics, in pass 1, destroy the previous content of the color buffer. I’d like my program to run on older cards ( Vaudoo family ), so i can’t use any specific Nvidia feature, or the destination alpha…

Is it possible to do? Any idea? And in general, what are the restrictions of multi-pass rendering ?

Y.

As I understend, you want something like this:

RGB_dest = 2*(A_bump + A_bump’) * RGB_base + RGB_env * A_gloss;

It can be done with destination alpha.
But without it and without multitexturing…
You’re out of luck.

> what are the restrictions of multi-pass rendering ?

Without dest. alpha & stentil buffer - you can do only this kind of operations:

RGB_dest = (RGB0 blend (RGB1 blend (RGB2 blend (…)))));

Seems to me a Radeon (with three texture
units) could conceivably do that in one
pass, assuming they have as fine-grained
control over color operation as the nVidia
register combiners. Which they probably
don’t :frowning:

Thanks Serge, it was exactly what i was looking for. You are right about the formula, this is what i’d want to do.
I can use multitexturing with 2 TMUs, but definately no destination alpha. Unfortunately, i don’t think that with multitexturing only there is a solution to the problem :frowning:

Bgl: i think that, on Nvidia’s hardware, it could be done in 2 pass with multitexturing and smart use of the register combiners. Unfortunately, it wouldn’t work on older hardware :frowning:

Y.

I don’t understand how you can do it with
only two units. You have to read
A_bump, A_gloss and RGB_base, which are all
stored in different textures/maps, right?
Or do you store A_gloss as the alpha
component of the RGB_base texture?

He, no, i said " two pass with multitexturing "… that’s different :slight_smile: That’s 2 possible textuers for pass1, and 2 possible textures for pass2… so you can manipulate up to 4 texture inputs.

Y.