Re: [osg-users] FOG: applying both kinds at the same time. How?
Thx everyone! I've got my stuff working now and I'm glad that I can only have 1 type of fog active. It makes my job easier. Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10356#10356 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] FOG: applying both kinds at the same time. How?
Take a look at the osgshaders example in the OSG code to see how to manage shaders at that level. For actual shader development, there are lots of good books out there plus resources and tutorials on line that can get you started. Along with this, I like the "orange" book "OpenGL Shading Language" by Randi Rost. Beware though...once you start writing your own shaders, you'll be hooked...:) Good luck... -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Allen Saucier Sent: Monday, April 13, 2009 2:03 PM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] FOG: applying both kinds at the same time. How? Write my own shader??? ha, ha,ha, ha ... that's a good one. What's a shader? [Embarassed] really, I've NO idea how to write one so the canned versions, I'll make do with. Thx... Tueller, Shayne R Civ... wrote: > Glad to help. > > The OpenGL drivers underneath OSG support different fog functions but only > one can be selected at a time. If you need a different fog effect other than > the "canned" fog functions in OpenGL, you can always write a shader...:) > > -Shayne > > -Original Message- > From: > [mailto:] On Behalf Of Allen > Saucier > Sent: Monday, April 13, 2009 9:17 AM > To: > Subject: Re: FOG: applying both kinds at the same time. How? > > Thxs guys! I never knew that the Linear & Exponential fog were mutually > exclusive. [Idea] But that explains why when I attempt to have both types of > fog w/in the same state only the last fog type enabled is used. > > I was thinking about applying the fog types to 2 different matrices and > putting those matrices, one after the other, into the scene but this info > saves me some time & effort. > > Thx Shayne! :) > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=10165#10165 > > > > > > ___ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ___ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- > Post generated by Mail2Forum Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10173#10173 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] FOG: applying both kinds at the same time. How?
Write my own shader??? ha, ha,ha, ha ... that's a good one. What's a shader? [Embarassed] really, I've NO idea how to write one so the canned versions, I'll make do with. Thx... Tueller, Shayne R Civ... wrote: > Glad to help. > > The OpenGL drivers underneath OSG support different fog functions but only > one can be selected at a time. If you need a different fog effect other than > the "canned" fog functions in OpenGL, you can always write a shader...:) > > -Shayne > > -Original Message- > From: > [mailto:] On Behalf Of Allen > Saucier > Sent: Monday, April 13, 2009 9:17 AM > To: > Subject: Re: FOG: applying both kinds at the same time. How? > > Thxs guys! I never knew that the Linear & Exponential fog were mutually > exclusive. [Idea] But that explains why when I attempt to have both types of > fog w/in the same state only the last fog type enabled is used. > > I was thinking about applying the fog types to 2 different matrices and > putting those matrices, one after the other, into the scene but this info > saves me some time & effort. > > Thx Shayne! :) > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=10165#10165 > > > > > > ___ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ___ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- > Post generated by Mail2Forum Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10173#10173 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] FOG: applying both kinds at the same time. How?
Glad to help. The OpenGL drivers underneath OSG support different fog functions but only one can be selected at a time. If you need a different fog effect other than the "canned" fog functions in OpenGL, you can always write a shader...:) -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Allen Saucier Sent: Monday, April 13, 2009 9:17 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] FOG: applying both kinds at the same time. How? Thxs guys! I never knew that the Linear & Exponential fog were mutually exclusive. [Idea] But that explains why when I attempt to have both types of fog w/in the same state only the last fog type enabled is used. I was thinking about applying the fog types to 2 different matrices and putting those matrices, one after the other, into the scene but this info saves me some time & effort. Thx Shayne! :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10165#10165 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] FOG: applying both kinds at the same time. How?
Thxs guys! I never knew that the Linear & Exponential fog were mutually exclusive. [Idea] But that explains why when I attempt to have both types of fog w/in the same state only the last fog type enabled is used. I was thinking about applying the fog types to 2 different matrices and putting those matrices, one after the other, into the scene but this info saves me some time & effort. Thx Shayne! :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10165#10165 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] FOG: applying both kinds at the same time. How?
Hi Allan & Shayne, Just for clarification osg::Fog doesn't quite minimic glFog, rather it just directly passes data to glFog at lets OpenGL fixed function pipeline for fog do the rest. Robert. On Fri, Apr 10, 2009 at 6:48 PM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC wrote: > I'm not sure what you mean by "enable". If OSG mimics OpenGL state in the > way fog is done, exponential and linear fog modes are mutually exclusive. > You can render with one or the other, but not both. I would think that OSG > uses the same paradigm... > > -Shayne > > -Original Message- > From: osg-users-boun...@lists.openscenegraph.org > [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Allen > Saucier > Sent: Friday, April 10, 2009 10:27 AM > To: osg-users@lists.openscenegraph.org > Subject: [osg-users] FOG: applying both kinds at the same time. How? > > Hi, everyone!!javascript:emoticon(':)') I'm new to OSG and I am struggling > with applying both linear and exponential types of fog. > > Would someone mind showing me what I'm doing wrong? Thx for the help! I > really appreciate it. > > // Fog: Linear > osg::ref_ptr m_ofgFogLinear = new osg::Fog(); > m_ofgFogLinear->setMode(osg::Fog::LINEAR); > //m_ofgFogLinear->setDensity(0.001); // makes NO diff for linear > m_ofgFogLinear->setColor( osg::Vec4d(.75,.75,.75,0.0)); > m_ofgFogLinear->setStart(0.0); > m_ofgFogLinear->setEnd(5000.0); > > osg::ref_ptr stateFogOn=new osg::StateSet(); > stateFogOn->setAttribute(m_ofgFogLinear.get(), osg::StateAttribute::ON); > stateFogOn->setMode(GL_FOG, osg::StateAttribute::ON); > stateFogOn->setMode(GL_BLEND, osg::StateAttribute::ON); > > //FOG state: exponential >osg::ref_ptr m_ofgFogExponential = new osg::Fog(); > m_ofgFogExponential->setMode(osg::Fog::EXP); > m_ofgFogExponential->setDensity(0.5); > m_ofgFogExponential->setColor( osg::Vec4d(.75,.75,.75,0.0)); > osg::ref_ptr stateFogExpOn=new osg::StateSet(); > stateFogExpOn->setAttribute(m_ofgFogExponential.get(), > osg::StateAttribute::ON); > stateFogExpOn->setMode(GL_FOG, osg::StateAttribute::ON); > > stateFogOn->setAttribute(m_ofgFogExponential.get(), > osg::StateAttribute::ON); > m_pognRoot->setStateSet(stateFogOn.get()); > > Isn't it possible to enable more than 1 attribute w/in a StateSet? I'm > trying to enable 2 types of fog w/in the same StateSet and it appears that > only one is actually in effect - the last one loaded. > ... > Allen > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=10084#10084 > > > > > > ___ > 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] FOG: applying both kinds at the same time. How?
I'm not sure what you mean by "enable". If OSG mimics OpenGL state in the way fog is done, exponential and linear fog modes are mutually exclusive. You can render with one or the other, but not both. I would think that OSG uses the same paradigm... -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Allen Saucier Sent: Friday, April 10, 2009 10:27 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] FOG: applying both kinds at the same time. How? Hi, everyone!!javascript:emoticon(':)') I'm new to OSG and I am struggling with applying both linear and exponential types of fog. Would someone mind showing me what I'm doing wrong? Thx for the help! I really appreciate it. // Fog: Linear osg::ref_ptr m_ofgFogLinear = new osg::Fog(); m_ofgFogLinear->setMode(osg::Fog::LINEAR); //m_ofgFogLinear->setDensity(0.001); // makes NO diff for linear m_ofgFogLinear->setColor( osg::Vec4d(.75,.75,.75,0.0)); m_ofgFogLinear->setStart(0.0); m_ofgFogLinear->setEnd(5000.0); osg::ref_ptr stateFogOn=new osg::StateSet(); stateFogOn->setAttribute(m_ofgFogLinear.get(), osg::StateAttribute::ON); stateFogOn->setMode(GL_FOG, osg::StateAttribute::ON); stateFogOn->setMode(GL_BLEND, osg::StateAttribute::ON); //FOG state: exponential osg::ref_ptr m_ofgFogExponential = new osg::Fog(); m_ofgFogExponential->setMode(osg::Fog::EXP); m_ofgFogExponential->setDensity(0.5); m_ofgFogExponential->setColor( osg::Vec4d(.75,.75,.75,0.0)); osg::ref_ptr stateFogExpOn=new osg::StateSet(); stateFogExpOn->setAttribute(m_ofgFogExponential.get(), osg::StateAttribute::ON); stateFogExpOn->setMode(GL_FOG, osg::StateAttribute::ON); stateFogOn->setAttribute(m_ofgFogExponential.get(), osg::StateAttribute::ON); m_pognRoot->setStateSet(stateFogOn.get()); Isn't it possible to enable more than 1 attribute w/in a StateSet? I'm trying to enable 2 types of fog w/in the same StateSet and it appears that only one is actually in effect - the last one loaded. ... Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10084#10084 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org