Hi Kim,

Thank you for your help. I had played with getSurfaceHeight() before
and did not see any affect on the reflection. What did help though was
modifying _reflectionMatrix inside OceanScene. I removed the const and
just did a makeTranslate() inside the contructor where I transformed
the OceanSurface. That *appears* to have corrected the reflection.
Integrating all these changes into an easily modified variable
shouldn't be too bad, but I am not sure if I have all the proper
matrixes being modified yet. I only am concerned with the ocean
surface, and not so much underwater effects.

Regards,

Matt

On Wed, Aug 12, 2009 at 2:33 PM, Kim Bale<[email protected]> wrote:
> Hi Matthew,
>
> Yes that is, unfortunately, expected behaviour.
>
> The clipnode that is used for the reflections is set in OceanScene.cpp
>
> osg::ClipPlane* reflClipPlane = new osg::ClipPlane(0);
> reflClipPlane->setClipPlane( 0.0, 0.0, 1.0, _oceanSurface->getSurfaceHeight() 
> );
> _reflectionClipNode = new osg::ClipNode;
> _reflectionClipNode->addClipPlane( reflClipPlane );
>
> The problem as you can see is the _oceanSurface->getSurfaceHeight().
> In FFTOceanSurface this value is computed when the mipmap geometry is
> initially computed so that it takes the average height of all the
> tiles. Unfortunately I forgot to add a setter for this function to
> override the computed value. getSurfaceHeight() is also used for a
> variety of other effects like silt and switching on the underwater
> effects.
>
> I'm afraid I don't have time to fix this at the moment. But it should
> be quite easy to add a setSurfaceHeight( float height ) function to
> FFTOceanSurface which overrides the _averageHeight variable within it.
> However it will need to be set in the following order:
>
> FFTOceanSurface* ocean = new FFTOceanSruface( ... );
> ocean->build() <- height is set to average wave height.
> ocean->setSurfaceHeight(1.f) <- override computed value.
>
>>Though I believe the problem with the reflection is because the bottom
>>of my landscape scene is transparent.
>
> Yes I believe you're seeing the underside of your terrain in the water
> there, a result of the clip plane being set too low.
>
> Sorry I can't be of more help.
>
> Kim.
>
> 2009/8/12 Matthew Lehner <[email protected]>:
>> I was attempting to transform the ocean surface along the z-axis as
>> described Kim using a MatrixTransform in the constructor of OceanScene
>> where OceanSurface is added to the Scene as a child node. The surface
>> is indeed transformed properly, but the reflection it completely
>> wrong. First off it gives the illusion the surface is still at the
>> original z-axis position, but it also seems to be reflecting the top
>> of my landscape onto the water which doesn't seem correct to me.
>> Though I believe the problem with the reflection is because the bottom
>> of my landscape scene is transparent. I am more interested in fixing
>> the z-offset reflection problem. I have attached a screen shot of the
>> reflection I am seeing.
>>
>> This is the code I am using to transform the ocean surface along the z-axis.
>>
>>> osg::MatrixTransform* mt = new osg::MatrixTransform( 
>>> osg::Matrixd::transform(osg::Vec3d(0.0, 0.0, 1.0)) );
>>> mt->addChild(_oceanSurface.get());
>>> addChild(mt);
>>
>> Screenshots of the reflection can be seen here: 
>> http://www.xavia.org/osgocean/
>>
>> Regards,
>>
>> Matt Lehner
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to