Re: Fog with projected textures.
John Rohlf (jrohlf++at++tubes)
Fri, 8 Sep 95 17:46:38 PDT
>
> Hi guys,
>
> It's me again, and I'm still trying to get my projected textures working
> properly. Just one problem left! (I think).
>
> I am doing two passes of pfDraw() in the one draw traversal callback. The
> first pfDraw draws everything in a grey colour that represents the colour of
> the ambient light, and resolves the zbuffer in preparation for the second
> pass.
>
> The second pass uses zfunction(ZF_EQUAL) to ensure that each pixel is
> touched only once, and also uses this:
> blendfunction(BF_DC, BF_ZERO);
> instead of the usual:
> blendfunction(BF_ONE, BF_ZERO);
>
> This means instead of each pixel getting set to the SOURCE colour, it is set
> to SOURCE*DEST, ie it is multiplied by the colour which is already there
> (and represents the ambient lighting).
>
> HOWEVER! It seems the SOURCE colour includes the colour adjustment caused
> by the fog, even though I really want fog to be added later. This means
> that the fog colour is also being multiplied by the DEST colour, hence
> making my fog seem darker for the geometry which goes through this projected
> texture process (lightpoints etc do not, and hence have the normal fog,
> making them appear light grey while everything else is a darker grey, for
> very thick fog).
>
> HELP! Someone must have tackled this before. Someone must have used fog
> with projected textures successfully. How is it done?
>
2.0 has formal support for projected textures and is implemented
as follows:
1. Clear screen. Place ambient in alpha bitplanes.
2. With wmpack(0x00ffffff), draw normal, textured, fogged scene.
3. With wmpack(0xffffffff), ZEQUAL, and blendfunction(BF_DC, BF_DA),
draw projected texture scene.
I'm not sure if you are using fog normally are as a means of
range-attenuating the light source. Note that you don't need to
clear to ambient color - instead you can place ambient in your
projected texture.
This archive was generated by hypermail 2.0b2
on Mon Aug 10 1998 - 17:51:52 PDT