Can I turn off Backface Culling for one Pass for the terrain

wolfmanfx

27-04-2006 17:09:49

here a pic


I use Fresnel for the water from the example but when i make the texture backface culling is active i must turn it off for the RTT pass i have tried in the material it dont work and my question how can i manage this to get correct reflections.

tuan kuranes

28-04-2006 07:43:27

backface culling is active by default in Demo_fresnel and PLSM2.
Why would you need a change ?
It doesn't work by default ?
(a clearer screenshot exposing the problem could help there)

wolfmanfx

28-04-2006 09:17:46

Hi
The Problem is that the terrain reflection is not coorect on the fresnel plane i make screenshot in the afternoon for better unterstanding my problem thx

wolfmanfx

03-05-2006 12:28:08

i use splatting material 5 :((

tuan kuranes

03-05-2006 13:09:36

seems that the camera isn't usigng a reflection point of view to me.

Make sure the ReflectionTextureListener::preRenderTargetUpdate do call Camera::enableReflection(Plane *p).

wolfmanfx

03-05-2006 13:29:23

void ReflectionTextureListener::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt)
{
// Hide plane and objects below the water
m_pFresnelMan->getWaterPlane()->setVisible(false);
TEntityVector::iterator i, iend;
iend = m_pFresnelMan->getBelowWater()->end();
for (i = m_pFresnelMan->getBelowWater()->begin(); i != iend; ++i)
{
(*i)->setVisible(false);
}

m_pFresnelMan->getCamera()->enableReflection(m_pFresnelMan->getReflectionPlane());

}
//---------------------------------------------------------------------
void ReflectionTextureListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt)
{
// Show plane and objects below the water
m_pFresnelMan->getWaterPlane()->setVisible(true);
TEntityVector::iterator i, iend;
iend = m_pFresnelMan->getBelowWater()->end();
for (i = m_pFresnelMan->getBelowWater()->begin(); i != iend; ++i)
{
(*i)->setVisible(true);
}
m_pFresnelMan->getCamera()->disableReflection();
}


No i make it the same way like in the demo with listener.

tuan kuranes

03-05-2006 13:47:27

does it actually call that method (put a breakpoint, a printf, etc...)

wolfmanfx

03-05-2006 13:54:11

Yep i have set a breakpoint and the function is called i dont understand the problem i have tryed to deactive culling in the material script but this gives a bad result :(

tuan kuranes

03-05-2006 14:07:08

BackFace culling isn't the problem.

Problem is the camera point of view when rendering reflection is False.

When rendering reflection on water camera is just positionned on water looking at right angle from pow, and from there, there is no culling problem.

Perhaps the plane parameter you give in "enablereflection" is false. (particularly its "d" parameter)

wolfmanfx

03-05-2006 17:03:57

m_pReflectionPlane.normal = Ogre::Vector3::UNIT_Y;
m_pReflectionPlane.d = 0;


Ogre::MeshManager::getSingleton().createPlane("Plane",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
m_pReflectionPlane,_iSize,_iSize,10,10,true,1,5,5,Ogre::Vector3::UNIT_Z);


So i tryed to set d to 1 but this doesnt matter

tuan kuranes

03-05-2006 17:31:26

shouldn't the last parameter be Vector3::UNIT_Y

wolfmanfx

03-05-2006 18:03:36

If i set the up vector to Ythen i have to change the normal vector from the plane because normal vector and upvector are not allwoed to be paralell.

tuan kuranes

04-05-2006 15:04:26

cannot reproduce the bug...

If you can wait for it, I'll very soon release a plsm2_water demo in CVS and with plsm2 SDK.

wolfmanfx

04-05-2006 18:06:18

Yep i can wait :) i hope its my fault :)

daedar

11-10-2006 16:43:54

Couldn't it be the mCamera->setNearClipDistance too high? tha camera from the water point of view don't render some polygon too close from the camera?