Model Lighting without Sky

classic Classic list List threaded Threaded
3 messages Options
boy2melo boy2melo
Reply | Threaded
Open this post in threaded view
|

Model Lighting without Sky

Dear osgEarth community :)

I am trying to light a 3D model without placing it underneath the Sky-Node. This is because I also want it to appear in the "night" region of my earth scene.

I have already tried using

osgEarth::Registry::shaderGenerator().run(mpModelNode.get());

and

mpModelNode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::ON);

However, the surface of my model is still fully white. When I am placing it underneath the sky node it is lit, but it obviously disappears when it is in the "night" region.

I am basically aiming for a lambert shading of the model. My next try would be to write my own osg::Program for the model node. Or does anybody have a better solution?

Thanks for your help...
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Model Lighting without Sky

boy2melo,

Please take a look at the osgearth_lights example.

osgEarth does not use the OpenGL fixed-function pipeline, so FFP modes like GL_LIGHTING will not work.
Glenn Waldron / Pelican Mapping
boy2melo boy2melo
Reply | Threaded
Open this post in threaded view
|

Re: Model Lighting without Sky

Thanks gwarldron, I will have a look.