Hi,

i am using the following code to produce shadows with a directional light:

  const OSG::UInt32 SM_RESOLUTION = 1024;

  _n_shadowEngine = OSG::SimpleShadowMapEngine::create();
  _n_shadowEngine->setWidth (SM_RESOLUTION);
  _n_shadowEngine->setHeight(SM_RESOLUTION);
  _n_shadowEngine->setShadowColor(OSG::Color4f(0.1f, 0.1f, 0.1f, 0.0f));

  DirectionalLightRefPtr lightSource   = OSG::DirectionalLight::create();
  lightSource->setAmbient(0.3f,0.3f,0.3f,1);
  lightSource->setDiffuse(0.8f,0.8f,0.8f,1);
  lightSource->setSpecular(0.0f,0.0f,0.0f,1);
  lightSource->setDirection(Vec3f(1,0,-1));
  lightSource->setLightEngine(_n_shadowEngine);

  _n_lightSource = OSG::Node::create();
  _n_lightSource->setCore(lightSource);

and the result is seen here:

http://www.picpaste.com/screenshot-X67WxXO0.png

don't be mislead by the setDirection, i use a different coordinate system 
internally.

regards,
keyan
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to