Inverse refraction??

SanguinarioJoe

27-11-2009 12:31:26

Hello!

I'm recently discover this great plugin (NICE JOB XAVI !!!).

I have two problems, but i will question only one for now.

First for all, i'm using Linux, OGRE 1.6.1, and Hydra v0.4 (linux version, that i encountered in this forum).

All is right when i'm out of water (camera is out of water), but, when i am underwater, all objects "upwater" is reversed (sky down, floor up).

Has someones similar problems??

I Searched forum for this problem, but seems i am alone :-D

Could anyones help me?

Thanks a lot!

(Sorry for my english).

SanguinarioJoe

16-12-2009 07:26:28

I will answer myself...

This problem is documented (a little bit hardly to find, but is documented).

The solutiuon proposed is edit the scalemat, but i'm edited the cg program in texturemanager.

Also i'm added PSSM (Parallel split shadows), that solves the problem using shadows:

1.- Only runs textures shadows.
2.- With OGRE implementation of texture shadows, the objects could not make self-shadowing.

And i'm solve some additionals problems that could have Linux users.

I will publicate all in a post (soon).

johnohollaren

04-01-2010 02:45:29

Could you elaborate on how you fixed this? I'm having the exact same problem.

SanguinarioJoe

08-05-2010 12:07:21

Hi!

in materialmanager.cpp you could find something like this:

"fresnel-=uGlobalTransparency;\n" +
"fresnel=saturate(fresnel);\n" +
// Get the reflection/refraction pixels. Make sure to disturb the texcoords by pixelnormal
"float3 reflection=tex2D(uReflectionMap,ProjectionCoord.xy+pixelNormalModified);\n" +
"float3 refraction=tex2D(uRefractionMap,ProjectionCoord.xy-pixelNormalModified);\n";


Change for this:

"fresnel-=uGlobalTransparency;\n" +
"fresnel=saturate(fresnel);\n" +
#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32
// Reversing projection if underwater
"if(uEyePosition.y < 0.0)\n" +
"{\n" +
"ProjectionCoord.y = 1.0 - ProjectionCoord.y;\n" +
"}\n" +
#endif
// Get the reflection/refraction pixels. Make sure to disturb the texcoords by pixelnormal
"float3 reflection=tex2D(uReflectionMap,ProjectionCoord.xy+pixelNormalModified);\n" +
"float3 refraction=tex2D(uRefractionMap,ProjectionCoord.xy-pixelNormalModified);\n";


Take care, you have this lines two time (WaterMaterial and underwatermaterial)