Re: [osg-users] osg::View NO_LIGHT bug?
HI Nickolai, If you don't want the default global light then simple do: viewer.setLightingMode(osg::Viewer::NO_LIGHT); Rather than switching it to SKY_LIGHT! Robert. On 5 June 2016 at 22:44, Nickolai Medvedevwrote: > Well, we can deceive viewer if we make so: > > > Code: > viewer.getLight()->setAmbient(osg::Vec4(0.0,0.0,0.0,1.0)); > viewer.getLight()->setPosition(osg::Vec4(0.0,0.0,0.0,1.0)); > viewer.getLight()->setDiffuse(osg::Vec4(0.0,0.0,0.0,1.0)); > viewer.getLight()->setConstantAttenuation(0.003); > viewer.getLight()->setLinearAttenuation(0.1); > viewer.getLight()->setQuadraticAttenuation(0.1); > viewer.getLight()->setName("global_light"); > viewer.getLight()->setLightNum(0); > > viewer.setLightingMode(osg::View::SKY_LIGHT); > > > > The light source still be exist, but will be invisible. > > Cheers, > Nickolai > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=67426#67426 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
If you don't want any light in your scene You just have to setMode(GL_LIGHTING,OFF,OVERRIDE) on you root's stateset Hope it helps Ben Axelrod wrote: > I cannot seem to turn off the light in osg::View. I can change it between > headlight and sky light, but when I try NO_LIGHT, I still get the headlight. > > > _viewer->getCamera()->getView()->setLightingMode(osg::View::SKY_LIGHT); > > //works > > > > _viewer->getCamera()->getView()->setLightingMode(osg::View::HEADLIGHT); > > //works > > > > _viewer->getCamera()->getView()->setLightingMode(osg::View::NO_LIGHT); > > //still get headlight > > > How can I turn off this default light? How is it related to the osg::Lights > in the scene? I noticed when I add an osg::Light, then the headlight is > overridden. How can I change the light parameters of the SKY_LIGHT or > HEADLIGHT? > > I am using osg version 2.6. > > Thanks, > -Ben > > -- > Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=67427#67427 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
Well, we can deceive viewer if we make so: Code: viewer.getLight()->setAmbient(osg::Vec4(0.0,0.0,0.0,1.0)); viewer.getLight()->setPosition(osg::Vec4(0.0,0.0,0.0,1.0)); viewer.getLight()->setDiffuse(osg::Vec4(0.0,0.0,0.0,1.0)); viewer.getLight()->setConstantAttenuation(0.003); viewer.getLight()->setLinearAttenuation(0.1); viewer.getLight()->setQuadraticAttenuation(0.1); viewer.getLight()->setName("global_light"); viewer.getLight()->setLightNum(0); viewer.setLightingMode(osg::View::SKY_LIGHT); The light source still be exist, but will be invisible. Cheers, Nickolai -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=67426#67426 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
Hi Ben, If there are modes in your scene graph that enable lighting then you'll get the default OpenGL lighting values. You don't say what effect you actually want to achieve so can't comment on what you should do in your scene graph, you'll need to provide more info. FYI, Viewer is a View, so you only need to do _viewer-setLightingMode(..); Robert. On Tue, Feb 17, 2009 at 4:35 PM, Ben Axelrod baxel...@coroware.com wrote: I cannot seem to turn off the light in osg::View. I can change it between headlight and sky light, but when I try NO_LIGHT, I still get the headlight. _viewer-getCamera()-getView()-setLightingMode(osg::View::SKY_LIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::HEADLIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::NO_LIGHT); //still get headlight How can I turn off this default light? How is it related to the osg::Lights in the scene? I noticed when I add an osg::Light, then the headlight is overridden. How can I change the light parameters of the SKY_LIGHT or HEADLIGHT? I am using osg version 2.6. Thanks, -Ben ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::View NO_LIGHT bug?
I cannot seem to turn off the light in osg::View. I can change it between headlight and sky light, but when I try NO_LIGHT, I still get the headlight. _viewer-getCamera()-getView()-setLightingMode(osg::View::SKY_LIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::HEADLIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::NO_LIGHT); //still get headlight How can I turn off this default light? How is it related to the osg::Lights in the scene? I noticed when I add an osg::Light, then the headlight is overridden. How can I change the light parameters of the SKY_LIGHT or HEADLIGHT? I am using osg version 2.6. Thanks, -Ben ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
I still don't know why osg::View::NO_LIGHT doesn't work, but to answer my own questions, to turn off the default light completely: _viewer-getCamera()-getView()-setLightingMode(osg::View::HEADLIGHT); osg::Light* light = _viewer-getCamera()-getView()-getLight(); if (light != NULL) { light-setAmbient(osg::Vec4(0,0,0,1)); light-setDiffuse(osg::Vec4(0,0,0,1)); light-setSpecular(osg::Vec4(0,0,0,1)); } -Ben From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ben Axelrod Sent: Tuesday, February 17, 2009 11:36 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] osg::View NO_LIGHT bug? I cannot seem to turn off the light in osg::View. I can change it between headlight and sky light, but when I try NO_LIGHT, I still get the headlight. _viewer-getCamera()-getView()-setLightingMode(osg::View::SKY_LIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::HEADLIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::NO_LIGHT); //still get headlight How can I turn off this default light? How is it related to the osg::Lights in the scene? I noticed when I add an osg::Light, then the headlight is overridden. How can I change the light parameters of the SKY_LIGHT or HEADLIGHT? I am using osg version 2.6. Thanks, -Ben ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
just an FYI, that does not turn the light off, its still on and you paying the cost of it being applied to all the geom in the scene attached to that view Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ben Axelrod Sent: Tuesday, February 17, 2009 3:09 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osg::View NO_LIGHT bug? I still don't know why osg::View::NO_LIGHT doesn't work, but to answer my own questions, to turn off the default light completely: _viewer-getCamera()-getView()-setLightingMode(osg::View::HEADLIGHT); osg::Light* light = _viewer-getCamera()-getView()-getLight(); if (light != NULL) { light-setAmbient(osg::Vec4(0,0,0,1)); light-setDiffuse(osg::Vec4(0,0,0,1)); light-setSpecular(osg::Vec4(0,0,0,1)); } -Ben From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ben Axelrod Sent: Tuesday, February 17, 2009 11:36 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] osg::View NO_LIGHT bug? I cannot seem to turn off the light in osg::View. I can change it between headlight and sky light, but when I try NO_LIGHT, I still get the headlight. _viewer-getCamera()-getView()-setLightingMode(osg::View::SKY_LIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::HEADLIGHT); //works _viewer-getCamera()-getView()-setLightingMode(osg::View::NO_LIGHT); //still get headlight How can I turn off this default light? How is it related to the osg::Lights in the scene? I noticed when I add an osg::Light, then the headlight is overridden. How can I change the light parameters of the SKY_LIGHT or HEADLIGHT? I am using osg version 2.6. Thanks, -Ben ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
Ben, osg::View's setLightingMode with NO_LIGHT as a parameter doesn't actually turn any lights off (just look at the source in osg/View.cpp). If the lightingMode is *not* NO_LIGHT, then it sets light 0 with the default 0.8 diffuse value etc. I presume this is by design, although I'm not sure why! Actually, this is all a bit confusing. For example, SceneView sets a global ambient light model that you have to suppress after the fact. Similarly, I notice that osg/View has LightingMode as enum {NO_LIGHT, HEADLIGHT, SKY_LIGHT}, whereas SceneView has enum Options { NO_SCENEVIEW_LIGHT = 0x0, HEADLIGHT = 0x1, SKY_LIGHT = 0x2}, which looks a little bit... random... to me if any default conversion between the enums is done. However a quick trawl through SceneView looks okay (LightingMode in SceneView is typedef'd to Options). David ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
- From: Ben Axelrod at 2009-02-18 07:09- I still dont know why osg::View::NO_LIGHT doesnt work, but to answer my own questions, to turn off the default light completely: { light-setAmbient(osg::Vec4(0,0,0,1)); light-setDiffuse(osg::Vec4(0,0,0,1)); light-setSpecular(osg::Vec4(0,0,0,1)); } Hi Ben, This is the best solution that I found. I tried the example code from OSGQSG but it didn't work properly. I appreciate comments here that it's not ideal because light#0 is wasted but it seems safer than trying to hijack this light which viewer expects to use. Any suggestions or clues about taking control of light#0 will be greatly appreciated. -- Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org