shadow disappears when arc<0

Posted By: yorisimo

shadow disappears when arc<0 - 08/15/12 21:30

I am using shadow_stencil = 1 in A8.4 Pro. Shadows appear fine when arc>0. However, if I set arc<0 the shadows disappear. I am using the default "camera" view. I have tried resetting the NOSHADOW flag but it doesn't seem to make a difference.

Is there any way to get the shadows to appear with negative (mirrored) arc values?
Posted By: HeelX

Re: shadow disappears when arc<0 - 08/16/12 11:14

Why do you need a negative arc?
Posted By: yorisimo

Re: shadow disappears when arc<0 - 08/16/12 14:07

We have a simulator in which the player's right arm is used to perform certain actions. For a left-handed player, we just use a negative arc to flip the scene. This way we don't need separate model or world setup for the left-handed players. It works great, except that the shadows don't appear.
Posted By: Sajeth

Re: shadow disappears when arc<0 - 08/16/12 14:25

Or you could just use a simple shader to mirror the view?
Posted By: HeelX

Re: shadow disappears when arc<0 - 08/16/12 14:38

Using the arc for such tricks might work in some cases, but is a very dirty trick. Follow sajeth's suggestion and simply mirror the view with a small and fast PP shader.
Posted By: yorisimo

Re: shadow disappears when arc<0 - 08/16/12 17:07

I don't understand why using arc<0 is a dirty trick. It is supported in the manual for the purposes of making a mirrored scene. I understand that in some cases, shadows should be turned off in a mirror to allow higher framerates, but this should be an option not a requirement (furthermore I don't see this limitation actually noted anywhere).

In any case, I tried the shader method and it works. However, I'm new to shaders so I'm not sure my method is the most ideal. Can you check out my .fx file below?

pp_fliphorizontal.fx
Code:
Texture TargetMap;
sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear;	};

float4 vecSkill1;//

float4 postprocessing_fliphoriz(float2 Tex : TEXCOORD0) : COLOR0 
{  
	return tex2D(g_samSrcColor, float2(1-Tex.x, Tex.y));
}

technique PostProcess 
{
	pass p1 
	{
		AlphaBlendEnable = false;	
		VertexShader = null;
		PixelShader = compile ps_2_0 postprocessing_fliphoriz();
	}
}



defined in my main.c file:
Code:
MATERIAL* mtl_fliphorizontal =
{
	effect = "pp_fliphorizontal.fx";
}



in my main function before loading my level:
Code:
pp_set(camera, mtl_fliphorizontal);


Posted By: Sajeth

Re: shadow disappears when arc<0 - 08/16/12 17:53

Yes, as far as I can see, this is the "shortest" and cleanest way to achieve this effect.
Posted By: yorisimo

Re: shadow disappears when arc<0 - 08/16/12 20:59

Thanks. Unfortunately, the shader method doesn't work well for me because I use the NVIDIA 3D Vision system to get stereoscopic viewing (The NVIDIA software automatically creates a left eye image and right eye image from the 3D information the Acknex engine sends to the graphics card . If I could force flip the left and right eye images it would work fine, but as far as I know, the NVIDIA drivers don't have any ability to do that. My only workaround is to wear the glasses upside down which isn't very acceptable.
Posted By: Sajeth

Re: shadow disappears when arc<0 - 08/16/12 21:56

And if you set camera.aspect to -1 at the same time? I have a hard time imagining how this looks in the 3d glasses.
Posted By: yorisimo

Re: shadow disappears when arc<0 - 08/16/12 22:49

Putting the glasses on upside down just switches which eye sees which image at which time. These are shutter glasses so you're still looking at the computer monitor, so the image would be upside down with a negative aspect. And, as far as I tried, setting the aspect to negative values (vertical flip) also causes the shadows to disappear.
© 2024 lite-C Forums