Re: [Flightgear-devel] OSG spotlights
Thanks for the info Yurik! Regarding performance, using 1 additional spotlight, I could not obtain any major differences (maybe an increase of about 2% cpu usage, but since recent cvs/osg2.2 uses about 85-90% on my cpu (amd xp2000) constantly it is hard to tell). The second problem of not lightened surfaced exists, but can be optimized a bit by adjusting spot cutoff and light distance attenuation. However it seems that we are going for shaders/multitexturing here, unfortunatly I am not familiar with shaders. g, markus Yurik V. Nikiforoff wrote: В сообщении от 18 ноября 2007 Markus Zojer написал(a): Hi there! Maybe I missed something, but under OSG/opengl it should be able to create up to 8 light sources. Please, read this first: http://sourceforge.net/mailarchive/message.php?msg_id=200610270754.15858.Mathias.Froehlich%40gmx.net - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] OSG spotlights
Hi Markus! В сообщении от 20 ноября 2007 Markus Zojer написал(a): The second problem of not lightened surfaced exists, but can be optimized a bit by adjusting spot cutoff and light distance attenuation. Unfortunatelly, spot parameters can't resolve problem of spot lighting for big surfaces. Big - it mean size of triangles too big rather then size of spot light, for example, if we want create landing lights. Limits of spread of lights for big surfases don't allow create realistic landing lights. For small surfases, then distance from light source greate then appprox size between surface vertex, we have good result. So, if we want landing lights, we should find another lights system. -- Wbr, Yurik - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
[Flightgear-devel] OSG spotlights
Hi there! Maybe I missed something, but under OSG/opengl it should be able to create up to 8 light sources. I used some simple osg code to generate a spotlight but it works only if I define it as light_num 0, which corresponds the GL_LIGHT0 of opengl I suppose, and this setting causes generic lightning to dissappear. Now some questions to someone with more insight into OSG: Is it possible to add lights when modifying the code below or is there a current limitation in flightgear that prevent lights from being added? I had a quick look into renderer.cxx and it seems that our global lighting is linked with osg there, but I am no programmer and I don't know how our lighting system actually works. Here the code I used (when GL_LIGHT1 and light_num 1 were used,nothing appeared): LightSource { UniqueID LightSource_2 DataVariance STATIC nodeMask 0xff cullingActive FALSE StateSet { DataVariance STATIC rendering_hint DEFAULT_BIN renderBinMode INHERIT GL_LIGHTING ON GL_LIGHT0 ON GL_DEPTH_TEST ON } referenceFrame RELATIVE Light { UniqueID LightSource_3 DataVariance STATIC light_num 0 //0 works but global light turned off ambient 0.2 0.2 0.2 1 diffuse 1 1 1 1 specular 0 0 0 0 position 0 0 0 1 direction -1 0 0 constant_attenuation 1 linear_attenuation 0 quadratic_attenuation 0 spot_exponent 2 spot_cutoff 15 } num_children 0 } fly on, markus - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] OSG spotlights
Ok, I somehow got it to work: added the following lines to /src/main/renderer.cxx (somewhere in the class SGPuDrawable block) stateSet-setMode(GL_LIGHTING, osg::StateAttribute::ON); stateSet-setMode(GL_LIGHT0, osg::StateAttribute::ON); stateSet-setMode(GL_LIGHT1, osg::StateAttribute::ON); stateSet-setMode(GL_LIGHT2, osg::StateAttribute::ON); stateSet-setMode(GL_LIGHT3, osg::StateAttribute::ON); stateSet-setMode(GL_LIGHT4, osg::StateAttribute::ON); recompiled flightgear and changed the parameters in the lighting file to GL_LIGHT4 and light_num 4, and it works: I have ambient light and some sort of spotlight (wich I had to adjust a bit) now. Not sure if it breaks anything, was just a quick shot ;-) fly on, markus Markus Zojer wrote: Hi there! Maybe I missed something, but under OSG/opengl it should be able to create up to 8 light sources. I used some simple osg code to generate a spotlight but it works only if I define it as light_num 0, which corresponds the GL_LIGHT0 of opengl I suppose, and this setting causes generic lightning to dissappear. Now some questions to someone with more insight into OSG: Is it possible to add lights when modifying the code below or is there a current limitation in flightgear that prevent lights from being added? I had a quick look into renderer.cxx and it seems that our global lighting is linked with osg there, but I am no programmer and I don't know how our lighting system actually works. Here the code I used (when GL_LIGHT1 and light_num 1 were used,nothing appeared): LightSource { UniqueID LightSource_2 DataVariance STATIC nodeMask 0xff cullingActive FALSE StateSet { DataVariance STATIC rendering_hint DEFAULT_BIN renderBinMode INHERIT GL_LIGHTING ON GL_LIGHT0 ON GL_DEPTH_TEST ON } referenceFrame RELATIVE Light { UniqueID LightSource_3 DataVariance STATIC light_num 0 //0 works but global light turned off ambient 0.2 0.2 0.2 1 diffuse 1 1 1 1 specular 0 0 0 0 position 0 0 0 1 direction -1 0 0 constant_attenuation 1 linear_attenuation 0 quadratic_attenuation 0 spot_exponent 2 spot_cutoff 15 } num_children 0 } fly on, markus - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] OSG spotlights
В сообщении от 18 ноября 2007 Markus Zojer написал(a): Hi there! Maybe I missed something, but under OSG/opengl it should be able to create up to 8 light sources. Please, read this first: http://sourceforge.net/mailarchive/message.php?msg_id=200610270754.15858.Mathias.Froehlich%40gmx.net -- Wbr, Yurik - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel