Re: [osg-users] Need help about Night Vision Effect
I did a IR scene by making my own cull visitor. In order to make this efficient I had to put a virtual in front off osgUtil::CullVisitor::pushStateSet(). My cull visitor look like this class SpectrumCullVisitor : public osgUtil::CullVisitor { public: SpectrumCullVisitor() {}; SpectrumCullVisitor(MapCullSpectrumCallBack* spectrumCallBack) { _Callback = spectrumCallBack; }; virtual ~SpectrumCullVisitor() {}; //! Get Cull Map Callback MapCullSpectrumCallBack* Callback() const { return _Callback.get(); } //! Set Cull Map Callback void Callback(MapCullSpectrumCallBack* val) { _Callback = val; } protected: //! Try to find alternative stat set if this fails push the stat set delivered from the graph void pushStateSet(const osg::StateSet* ss) { const osg::StateSet* pushSS = NULL; if (_Callback.get()) { //Look if there is a alternative stat set pushSS = _Callback-GetMapedStateSet(ss); if (pushSS) { //Alternative found using it in base function CullVisitor::pushStateSet(pushSS); } else { //No alternative found cal bas function without switching CullVisitor::pushStateSet(ss); } } else { //No Callback cal base without switching CullVisitor::pushStateSet(ss); } }; private: osg::ref_ptrMapCullSpectrumCallBack _Callback; }; And the callback like this: class MapCullSpectrumCallBack : public osg::Referenced { public: MapCullSpectrumCallBack(const std::string spectrum): _spectrum(spectrum) {}; virtual ~MapCullSpectrumCallBack(){}; const osg::StateSet* GetMapedStateSet( const osg::StateSet* ss ) const; bool InsertModifiedStatsetIfChanged(const osg::StateSet* ss); int CleanUp(); protected: osg::ref_ptrosg::StateSet CreateStatsetAlternative(const osg::StateSet* ss); std::string _spectrum; bool SwitchToSpectrumTextures( osg::StateSet* ss ); bool SwitchToSpectrumShader( osg::StateSet* ss ); std::string getFileSpectrumName( std::string name ); typedef std::maposg::ref_ptrconst osg::StateSet,osg::ref_ptrosg::StateSet StateMap; StateMap _StateMap; }; You then have to populate the map in the callback with statset with alternative textures(IR). Regars Ragnar -Ursprungligt meddelande- Från: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] För Steven Powers Skickat: den 2 december 2010 21:12 Till: osg-users@lists.openscenegraph.org Ämne: Re: [osg-users] Need help about Night Vision Effect The easy/cheating way is to calculate the luminance of each pixel, amplify it, (color it green to fit the stereotype) then add electric noise. This is easiest to do on a fragment shader. Cheers, Steven -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34458#34458 ___ 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] Need help about Night Vision Effect
The easy/cheating way is to calculate the luminance of each pixel, amplify it, (color it green to fit the stereotype) then add electric noise. This is easiest to do on a fragment shader. Cheers, Steven -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34458#34458 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Need help about Night Vision Effect
Hi, I'm working in Delta3D and need to implement night vision effect for my T59 tank simulator.I've a little bit of knowledge over it and I think it can be possible by implementing some post filters or shader effects on camera.But I cant find any particular way to implement the effect. If anybody give me some solution or suggestion to implement night vision effect using OSG it will be a great help for me.. ... Thanks in advance.. Cheers, Abdur Rahman -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34164#34164 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Need help about Night Vision Effect
Look at http://www.geeks3d.com/20091009/shader-library-night-vision-post-processing- filter-glsl/ for inspiration it shoes a possible solution that could be adapted We did our NVG with post processing and Shaders in our 3d OSG based Pro module http://www.overwatch.com/pdfs/remoteview/RV%203DPro1.pdf Note this is faux ... as there is no radiometric/emissive etc properties of the pixels/surface materials taken into account ( as there are none for us as this time, at some point we will upgrade when we get this type of data ) __ Gordon Tomlinson gor...@gordontomlinson.com www.photographybyGordon.com www.vis-sim.com www.gordontomlinson.com IM: gordon3db...@3dscenegraph.com __ -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Abdur Rahman Sent: Saturday, November 27, 2010 1:10 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Need help about Night Vision Effect Hi, I'm working in Delta3D and need to implement night vision effect for my T59 tank simulator.I've a little bit of knowledge over it and I think it can be possible by implementing some post filters or shader effects on camera.But I cant find any particular way to implement the effect. If anybody give me some solution or suggestion to implement night vision effect using OSG it will be a great help for me.. ... Thanks in advance.. Cheers, Abdur Rahman -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34164#34164 ___ 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] Need help about Night Vision Effect
On 11/26/2010 11:10 PM, Abdur Rahman wrote: Hi, I'm working in Delta3D and need to implement night vision effect for my T59 tank simulator.I've a little bit of knowledge over it and I think it can be possible by implementing some post filters or shader effects on camera.But I cant find any particular way to implement the effect. If anybody give me some solution or suggestion to implement night vision effect using OSG it will be a great help for me.. First question would be -- what exactly do you define Night Vision Effect as? Infrared? Image intensifier? IR requires emissive properties on your models and a shader to utilize them. Image intensifier just requires weak direct and ambient light sources, and a shader to monochromize them and add a lot of noise. http://upload.wikimedia.org/wikipedia/commons/c/c3/Gen1C-2-Comparison.jpg -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. There is no Truth. There is only Perception. To Perceive is to Exist. - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org