shadows and alpha

New Message Reply Date view Thread view Subject view Author view

From: Christian Skluzacek (csklu_fs++at++yahoo.com)
Date: 04/16/2002 04:00:51


Hi,

I'm having problems when using pfLightSource shadows
(with Performer 2.2 and Irix) that geometry/textures
with alpha either disappear or the alpha values are
discarded.

For example, the following code drawn in a channel
callback draws a semitransparent quad with shadows
disabled but draws it completely opaque with shadows
enabled:

  glPushAttrib( GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT );
  glEnable( GL_BLEND );
  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

  pfVec3 pt1, pt2, pt3, pt4;

  glColor4f( color[0], color[1], color[2], 0.5f );
  glBegin( GL_QUADS );
    glVertex3fv( pt1.vec );
    glVertex3fv( pt2.vec );
    glVertex3fv( pt3.vec );
    glVertex3fv( pt4.vec );
  glEnd();

  glPopAttrib();

The code to set up the shadows looks something like
this:

  m_pLightSource = new pfLightSource;
  m_pFrustum = new(pfGetSharedArena()) pfFrustum;

  m_pDCS->addChild( m_pLightSource );
  m_pLightSource->setMode( PFLS_SHADOW_ENABLE,
                           bDoShadow?1:0 );
  m_pLightSource->setAttr( PFLS_PROJ_FRUST,
                           m_pFrustum );
  m_pLightSource->setPos( 0.0f, 0.0f, 0.0f, 1.0f ); //
Make local
  m_pLightSource->setVal( PFLS_INTENSITY,
                          bDoShadow ? 0.0f : 1.0f );
  m_pLightSource->setVal( PFLS_SHADOW_DISPLACE_SCALE,
                          0.0019f ); // value taken
from Performer documentation somewhere
  m_pLightSource->setVal( PFLS_SHADOW_DISPLACE_OFFSET,
                          1.0f );
  m_pLightSource->setVal( PFLS_SHADOW_SIZE, 64 );

Thanks for your help,
Chris

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Apr 16 2002 - 04:01:19 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.