-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlanarReflections rendering bug with two-sided lighting #369
Comments
@darksylinc I have what I think is a fix for this, but I'm not sure I understand enough to make a PR. My idea is that instead of using an orientation-reversing camera for the reflection, do a horizontal flip at the shader level. More specifically: In // Deal with reflections
if( reflectMatrix )
{
viewMatrix = viewMatrix * ( *reflectMatrix );
viewMatrix[0][0] *= -1.0f;
viewMatrix[0][1] *= -1.0f;
viewMatrix[0][2] *= -1.0f;
viewMatrix[0][3] *= -1.0f;
} (There's probably a slicker way to express that.) And in Hlms/Unlit/Any/800.PixelShader_piece_ps.any, when handling the property
by
and replace
by
An incomplete part is that in Hlms/Unlit/GLSLES/BlendModes_piece_ps.glsl, there is another reference to |
I spoke too soon. The changes I outlined produce a better result for two-sided lighting, but a worse result for reflections of one-sided things. |
@darksylinc My current best attempt at getting the mirror image to look right for both 2-sided and 1-sided meshes is, besides the changes outlined above, to change |
The changes I've outlined above give good results for unlit mirrors, but break reflections in lit mirrors, and I don't know why. But for my personal purposes, unlit mirrors probably suffice. |
System Information
Detailed description
When the PlanarRelections library mirrors objects with a Pbs data blocks set to use two-sided lighting, the reflections look wrong. This is especially obvious when using unlit mirrors.
Steps to reproduce:
HlmsPbs::createDatablockImpl
in OgreHlmsPbs.cpp to say:Sample_PlanarReflections
.Ogre.log
-->
The text was updated successfully, but these errors were encountered: