Robert Webb (robertw++at++wormald.COM.AU)
Wed, 14 Jun 1995 15:02:48 +1000 (EST)
I am not quite doing projected textures, but a similar kind of thing that
requires multiple calls to pfDraw. Has anyone out there ever used projected
textures or similar with Performer? Due to the unique nature of this sort
of thing, I have the following problems:
- Luminous polygons and lightpoints don't glow.
- Transparency is lost.
- The sky can no longer be drawn.
- Can't use diffuse lighting.
What I want is to light up a small area of the database with a moving light.
I don't want to just use a spotlight because the beam must have a certain
shape (specified by a texture), and the big polygons in the database would
have to be retesselated in real-time somehow. I am making the assumption
for the moment that the ground being lit up is flat.
I am trying to do this sort of thing:
- Clear the screen to a constant colour representing the ambient light.
- Clear the zbuffer.
- Draw a textured polygon that represents the light landing on the
ground (without affecting the zbuffer).
- wmpack(0x0), so that pfDraw will only update the zbuffer, not the
color buffer.
- Turn off transparency and override it, so that Performer won't call
blendfunction without our knowledge.
- Call pfDraw, which will only affect the zbuffer.
- wmpack(0xffffffff), pfDraw will really draw next time.
- zfunction(ZF_EQUAL), so each pixel gets done only once.
- blendfunction(BF_DC, BF_ZERO), so that the old pixel value will be
used as the lighting for the new pixel value.
- Call pfDraw again.
Now I have the scene lit by an ambient light and with a small patch that is
lit up brightly on the ground, but with the problems I mentioned before. To
expand on these problems:
- Luminous polygons/lightpoints: These would need to be drawn after
everything else, with the blendfunction put back to normal, but
since pfDraw just draws everything I don't know how to do this.
- Transparency: I will probably have to live without this.
- Sky can no longer be drawn: I need to clear the screen to the color of
the ambient light at the start, so I can't use the sky. I assume
pfClearChan uses zfunction(ZF_ALWAYS). If I could prevent this then
I could render the sky polygons after drawing everything else, but I
don't see how to.
- Can't use diffuse lighting: again I will probably have to live with
this.
Anyone got any suggestions? Is there any example code of using Performer
with projected textures or the like? Any help would be appreciated.
Thanks, and sorry for the long message,
Rob.
------------------------------------------------------------------------------
Robert Webb. robertw++at++wormald.com.au
------------------------------------------------------------------------------
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:35 PDT