OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Regulate the Ocean Reflection intensity.


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean]
View previous topic :: View next topic  
Author Message
Paradox
Appreciator


Joined: 19 Apr 2010
Posts: 128

PostPosted: Fri Sep 27, 2013 4:37 pm    Post subject:
Regulate the Ocean Reflection intensity.
Reply with quote

Hi,

I'm looking to modify the amount of reflections intensity inside ocean. I'm using last trunk rev 258.

I'm stuck into this piece of code inside OceanScene:

Code:
        _reflectionMatrix = osg::Matrixf(  1,  0,  0,  0,
                                           0,  1,  0,  0,
                                           0,  0, -1,  0,   
                                           0,  0,  2 * _oceanScene->getOceanSurfaceHeight(),  1 );

        osg::ref_ptr<osg::Texture2D> reflectionTexture = _oceanScene->createTexture2D( _oceanScene->_reflectionTexSize, GL_RGBA );
       
        // clip everything below water line
        _reflectionCamera = _oceanScene->renderToTexturePass( reflectionTexture.get() );
        _reflectionCamera->setClearColor( osg::Vec4( 0.0, 0.0, 0.0, 0.0 ) );
        _reflectionCamera->setComputeNearFarMode( osg::Camera::DO_NOT_COMPUTE_NEAR_FAR );
        _reflectionCamera->setCullMask( _oceanScene->_reflectionSceneMask );
        _reflectionCamera->setCullCallback( new CameraCullCallback(_oceanScene.get()) );
        _reflectionCamera->getOrCreateStateSet()->setMode( GL_CLIP_PLANE0+0, osg::StateAttribute::ON );
        _reflectionCamera->getOrCreateStateSet()->setMode( GL_CULL_FACE, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE );

        _surfaceStateSet->setTextureAttributeAndModes( _oceanScene->_reflectionUnit, reflectionTexture.get(), osg::StateAttribute::ON );


I think that I should operate on texture properties, maybe the shader but right now I'm not able to see a significative change on intensity reflection effect...Someone can suggest to me a way?

Thank you!

Cheers,
Dario[/code]
Back to top
View user's profile Send private message
kcbale
User


Joined: 04 Mar 2011
Posts: 68

PostPosted: Fri Sep 27, 2013 5:05 pm    Post subject:
Regulate the Ocean Reflection intensity.
Reply with quote

Hi Dario,

I would take a look inside the surface fragment shader and then tone down the mix function that blends the reflection texture with the surface. It should be pretty simple.


Regards,


Kim.



On 27 September 2013 17:37, Dario Minieri < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I'm looking to modify the amount of reflections intensity inside ocean. I'm using last trunk rev 258.

I'm stuck into this piece of code inside OceanScene:


Code:
        _reflectionMatrix = osg::Matrixf(  1,  0,  0,  0,
                                           0,  1,  0,  0,
                                           0,  0, -1,  0,
                                           0,  0,  2 * _oceanScene->getOceanSurfaceHeight(),  1 );

        osg::ref_ptr<osg::Texture2D> reflectionTexture = _oceanScene->createTexture2D( _oceanScene->_reflectionTexSize, GL_RGBA );

        // clip everything below water line
        _reflectionCamera = _oceanScene->renderToTexturePass( reflectionTexture.get() );
        _reflectionCamera->setClearColor( osg::Vec4( 0.0, 0.0, 0.0, 0.0 ) );
        _reflectionCamera->setComputeNearFarMode( osg::Camera::DO_NOT_COMPUTE_NEAR_FAR );
        _reflectionCamera->setCullMask( _oceanScene->_reflectionSceneMask );
        _reflectionCamera->setCullCallback( new CameraCullCallback(_oceanScene.get()) );
        _reflectionCamera->getOrCreateStateSet()->setMode( GL_CLIP_PLANE0+0, osg::StateAttribute:ShockedN );
        _reflectionCamera->getOrCreateStateSet()->setMode( GL_CULL_FACE, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE );

        _surfaceStateSet->setTextureAttributeAndModes( _oceanScene->_reflectionUnit, reflectionTexture.get(), osg::StateAttribute:ShockedN );



I think that I should operate on texture properties, maybe the shader but right now I'm not able to see a significative change on intensity reflection effect...Someone can suggest to me a way?

Thank you!

Cheers,
Dario[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56514#56514





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Paradox
Appreciator


Joined: 19 Apr 2010
Posts: 128

PostPosted: Wed Oct 02, 2013 8:02 am    Post subject:
Reply with quote

Hi,

In effect, I see the env_color computation in the fragment shader. I'm able to multiply this one by a tiny constant < 1 (like 0.2) to obtain the result desired, but the problem is that the total final tone change drastically.

I don't know if I've made right operation, but I'm trying to re-calibrate the total tone using top and bottom wave top color and come another problem: changing those values at runtime I receive a double corruption from FFTOceanSurface like this:

Code:
*** glibc detected *** bin/Demo: double free or corruption (!prev): 0x0000000006fab330 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f0ac5ab8b96]
/usr/local/lib/libosgOcean.so(_ZNSt12_Destroy_auxILb0EE9__destroyIPSt6vectorIN8osgOcean9OceanTileESaIS4_EEEEvT_S8_+0x52)[0x7f0ac126d602]
/usr/local/lib/libosgOcean.so(_ZN8osgOcean15FFTOceanSurface10computeSeaEj+0x142)[0x7f0ac126b782]
/usr/local/lib/libosgOcean.so(_ZN8osgOcean15FFTOceanSurface5buildEv+0x40)[0x7f0ac126c970]
/usr/local/lib/libosgOcean.so(_ZN8osgOcean15FFTOceanSurface18getSurfaceHeightAtEffPN3osg5Vec3fE+0x145)[0x7f0ac12676d5]



Parameters for wave top and bottom color are thought to runtime change? I need to perform some operation to achieve the runtime modification?

Best

Thank you!

Cheers,
Dario
Back to top
View user's profile Send private message
whatnick
Newbie


Joined: 29 Nov 2012
Posts: 6

PostPosted: Fri Nov 15, 2013 12:33 am    Post subject:
Adding reflection
Reply with quote

Hi,

I have successfully implemented a changing reflection intensity by adding
1) Multiplier to env_map
2) Creating a uniform corresponding to the multiplier in the shader
3) Setting this uniform via stateset and creating a corresponding variable in FFTOceanSurface.

SVN diff to release tag attached.

Cheers,

whatnick.
Back to top
View user's profile Send private message
kcbale
User


Joined: 04 Mar 2011
Posts: 68

PostPosted: Fri Nov 15, 2013 10:11 am    Post subject:
Regulate the Ocean Reflection intensity.
Reply with quote

Thanks I'll check out the effect and merge it.

Kim.



On 15 November 2013 00:33, Tisham Dhar < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I have successfully implemented a changing reflection intensity by adding
1) Multiplier to env_map
2) Creating a uniform corresponding to the multiplier in the shader
3) Setting this uniform via stateset and creating a corresponding variable in FFTOceanSurface.

SVN diff to release tag attached.

Cheers,

whatnick.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=57225#57225




Attachments:
http://forum.openscenegraph.org//files/refelection_var_diff_551.txt


_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Paradox
Appreciator


Joined: 19 Apr 2010
Posts: 128

PostPosted: Mon Dec 02, 2013 11:04 am    Post subject:
Reply with quote

Hi,

Nice, I've seen now the mod, I'll try them as soon....


Thank you!

Cheers,
Dario
Back to top
View user's profile Send private message
Paradox
Appreciator


Joined: 19 Apr 2010
Posts: 128

PostPosted: Mon Dec 02, 2013 12:09 pm    Post subject:
Reply with quote

Hi,

Looking the patch, I've seen that this is the same mod that I've tried but doesn't looks good to me...I'm using the trunk version, so the patch is different because some stuffs are moved in Technique file, but the mod is the same and I'm not really able to tone down (mean: add a lower reflection intensity) the reflection. Playing with fresnel mul and reflection mul don't move to me along a right final effect.

Have you tried some other parameters combination? Have you a snapshot to see your result?

Thank you!

Cheers,
Dario
Back to top
View user's profile Send private message
Paradox
Appreciator


Joined: 19 Apr 2010
Posts: 128

PostPosted: Mon Dec 02, 2013 12:30 pm    Post subject:
Reply with quote

Hi,

For example, look at snapshot attached:

Ocean_reflmul3_fresmul07: obviously not correct. Reflection mul = 3m, fresnel mul = 0.7.

Ocean_reflmul1_fresmul07: overall nice, but the reflection is too much (reflection mul neutral = 1).

Ocean_reflmul07_fresmul07 & Ocean_reflmul03_fresmul08: better in term of reflection amount (reflection mul 0.7 and 0.3). There is THE problem: lowering env_color vector means alter the overall tone of the sea. I'm looking for a method which preserve the overall tone but with a very lower intensity of "reflection texture".

Where I'm wrong?

Thank you!

Cheers,
Dario
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Material Properties to Change the Nor... romulogcerqueira General 11 Fri Dec 23, 2016 2:48 pm View latest post
No new posts Triton Ocean Rambabu General 10 Tue Dec 13, 2016 11:17 am View latest post
No new posts 3ds plugin fix for map transparency+r... Giampaolo Viganò Submission 3 Wed Apr 01, 2015 12:18 pm View latest post
No new posts 3ds plugin (ReaderWriter3DS.cpp) fix ... Giampaolo Viganò Submission 0 Fri Mar 27, 2015 4:45 pm View latest post
No new posts Enabling reflection and others effect... Paradox osgOcean [osgOcean] 0 Sat Nov 22, 2014 12:03 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP