Dirk Reiners a écrit :
Hi Carsten, hi Fabrice,
Carsten Neumann wrote:
On Mon, 2007-09-10 at 13:26 +0200, Decle Fabrice wrote:
Hi all!
In my program, I dont't use the Simple Scene Manager, and sometimes (for
example when I go close to an object), lights suddenly switch off... If
I move, it sometimes switches on again...
this might be because the lights are subject to frustum culling. If your
lights are close to the root of the scenegraph you could give them an
infinite bounding volume:
NodePtr lightNode;
beginEditCP(lightNode, Node::VolumeFieldMask);
lightNode->getVolume().setInfinite(true);
endEditCP(lightNode, Node::VolumeFieldMask);
If your lights are deeper down in the scene, especially if they are
below geometry this can prevent frustum culling of that geometry though.
No, lights extend the bbox of the Group they're in, so as long as any part is
visible, they are rendered/active.
With OpenSG 1.6, there were no problems...
Hm, I think lights were always subject to frustum culling, so this seems
to suggest it is something different, although I can not really think of
anything else that would make a light disappear.
Fixed bugs. ;)
Logically lights were always supposed to only light what's underneath them in
the tree. Until recently they were global though, so even parts outside the
light's Group would be lit. And that's where the frustum culling comes in.
Can you make sure that your light are at the root of the graph, and not parallel
to your scene? That would be my first guess.
Hope it helps
Dirk
I've tried setting the light bounding volume, but no changes.. :(
My light is at the root of the graph, and it is a pointLight.
it happens on every scene, even a simple torus..
Here is the code of my scene:
NodePtr createScene()
{
scene = makeTorus (0.5, 2, 16, 16);
// set the beacons
cam = PerspectiveCamera::create();
camBeacon = Node::create();
beginEditCP(camBeacon);
{
camXform = Transform::create();
camBeacon->setCore(camXform);
}
endEditCP(camBeacon);
// CAMERA
beginEditCP(cam);
{
cam->setBeacon(camBeacon);
cam->setFov(deg2rad(45));
cam->setNear(0.01);
cam->setFar(5000);
}
endEditCP(cam);
// LIGHT
PointLightPtr pLight = PointLight::create();
beginEditCP(pLight);
{
pLight->setBeacon(camBeacon);
pLight->setPosition(Vec3f( 0, 0,0));
pLight->setDiffuse(Color4f(1,1,1,1));
pLight->setAmbient(Color4f(0.2,0.2,0.2,1));
pLight->setSpecular(Color4f(1,1,1,1));
}
endEditCP (pLight);
NodePtr lightNode = Node::create();
beginEditCP(lightNode);
{
lightNode->setCore(pLight);
lightNode->getVolume(true).setInfinite(true);
}
endEditCP(lightNode);
// Root node
NodePtr locscene = Node::create();
objects = Node::create();
_xObject = Transform::create();
beginEditCP(objects, Node::CoreFieldMask | Node::ChildrenFieldMask);
{
objects->setCore(_xObject);
objects->addChild (scene);
}
endEditCP(objects, Node::CoreFieldMask | Node::ChildrenFieldMask);
beginEditCP(locscene, Node::CoreFieldMask | Node::ChildrenFieldMask);
{
locscene->setCore(Group::create());
locscene->addChild(lightNode);
locscene->addChild(scene);
locscene->addChild(camBeacon);
}
endEditCP (locscene, Node::CoreFieldMask | Node::ChildrenFieldMask);
return locscene;
}
Thank you for your help...
--
Fabrice Dècle
PhD. Student
www.labri.fr/perso/decle
LaBRI, Domaine Universitaire | Room : 253
351, Cours de la Libération | Phone : +33 (0)5 40 00 38 82
F-33405 Talence CEDEX | e-mail: [EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users