Page 1 of 1

Shadows on Mirror?

Posted: Fri Jul 03, 2015 4:00 am
by Vertex
Image

Which has left the shadow in the mirror and crown of light? :cry:

Re: Shadows on Mirror?

Posted: Fri Jul 03, 2015 6:17 am
by Allanon
Found this in the Genesis3d source code, doesn't look like RF supports shadows in mirrors:

Code: Select all

#pragma message ("BUG:  Shadow caused crash in mirrors (oops).  Need to write a RenderShadowThroughFrustum...")
	/*
	if (P->DoShadow)
		{
			gePuppet_DrawShadow(P,Engine,World,Camera);
		}
	*/

Re: Shadows on Mirror?

Posted: Fri Jul 03, 2015 12:46 pm
by aicd99
Allanon wrote:Found this in the Genesis3d source code, doesn't look like RF supports shadows in mirrors:

Code: Select all

#pragma message ("BUG:  Shadow caused crash in mirrors (oops).  Need to write a RenderShadowThroughFrustum...")
	/*
	if (P->DoShadow)
		{
			gePuppet_DrawShadow(P,Engine,World,Camera);
		}
	*/
If you fix it up that would be new update on the engine that could be used on the final version a new reality factroy

Re: Shadows on Mirror?

Posted: Fri Jul 03, 2015 2:12 pm
by QuestOfDreams
Allanon wrote:Found this in the Genesis3d source code, doesn't look like RF supports shadows in mirrors:

Code: Select all

#pragma message ("BUG:  Shadow caused crash in mirrors (oops).  Need to write a RenderShadowThroughFrustum...")
	/*
	if (P->DoShadow)
		{
			gePuppet_DrawShadow(P,Engine,World,Camera);
		}
	*/
Actually, that's not the code for shadow volumes. The code in question is in the function RenderShadowVolumes in world.c:

Code: Select all

	// no shadows in mirrors for now...
	if(MirrorRecursion > 0)
		return GE_TRUE;
I think I originally disabled it due to performance reasons but I don't remember if I've ever tested shadow volume rendering for mirrors.

Re: Shadows on Mirror?

Posted: Fri Jul 03, 2015 4:13 pm
by Vertex
There is a possibility that in the future this option will be provided so you can enable or disable .

Re: Shadows on Mirror?

Posted: Fri Jul 03, 2015 10:40 pm
by Veleran
You would have to do very careful level design,to know when the mirror comes in view and when it is not.
Now ,when the mirror comes in view,you may not see it but if there are walls in front of it,but it will still double the polycount and shadows calculations.

One way is keep performance up is to stop from rendering any polygons that are inside closed rooms using sealed areas and area flagged portal brushes at the door positions (with a smaller hint door in the middle to allow passing through).

You can also use far clip plane and fog but i know you will want to set this distance limit to high so you see far as possible,and it means that the mirror will be so small you will not even notice it from far but it will be rendered by the engine and ,might mess the framerate.

I just thought a trick for this that is much easier than the whole area portals settup:
If all shadows were enabled for the mirrors in the source code, you could try making a moving platform mirror that stays out of sight at a far corner of the level and when you go near the supposed mirror position,a trigger makes the moving model to move front of a fake mirror you have put and then all can be reflected.

When you move away from the mirror,it will fly back out of sight and keep the performance high.
I have not tested it yet but in theory it should work,unless moving platforms can not be mirrors.