Whats happening with this PSSM Shadow? (video included)

Posted By: jumpman

Whats happening with this PSSM Shadow? (video included) - 05/09/17 03:16

Hi everyone, Im having a small problem with PSSM shadows.

[video:youtube]https://youtu.be/u5pWD222IrQ[/video]


If you watch the video, at a certain angle, the shadows disappear on the objects, but returns when the camera is rotated back.

Any idea what could be going on? Im using the default PSSM shader. Here are my settings:



Code:
#ifdef PSSM
	shadow_stencil = 8; // activate external shadows
// all objects get the SHADOW flag
	for(you = ent_next(NULL); you; you = ent_next(you)) 
	set(you,SHADOW);
	
	pssm_transparency=.5;
	
	
//	 camera.clip_far = 10000;
 camera.clip_near = 1;
 
 pssm_fbias = 0.0001;
	
	vec_set(sun_angle,vector(-90,60,1000));
	
	pssm_splitweight=.5;
	
	pssm_res=1024;
	
	pssm_run(3);
#else  
	camera.material = mtlShadow; // render all objects with the mtlShadow material
	viewDepth.stage = camera;    // use the Depth view as a preprocessor for the camera view
#endif

Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/09/17 03:17

If the sun position is to the right of the camera, and I rotate it low, many shadows disappear. But if the sun is to the left of the camera and I rotate it low, shadows do not disappear. Im confused.
Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/09/17 05:17

Update, there seems to be a trigger based on whether there is a terrain in the level! When i remove the terrain and rebuild the level, the shadows never disappear like in the video. But when I place the terrain back in the level, whether it has a shader or not, the shadows begin disappearing that certain angles. This is very strange.
Posted By: sivan

Re: Whats happening with this PSSM? (video included) - 05/09/17 07:10

it can happen because of translucent stuff or mirror shaders too, I don't remember exactly... does the terrain have a single RGB texture or RGBA?
Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/09/17 13:58

Hey Sivan,

The terrain at the time had an RGBA texture i think, whatever the default multitexture shader needed. However, even if I put a blank texture or a simple bmp, these shadows still disappeared.

However, when i deleted the terrain and rebuilt the level, shadows returned and didnt disappear. I made a test level and imported the terrain again, and there the problem happened again.

But one thing I noticed was that my terrain was very small by default, and I normally scaled it up very big to fit the level. When I scaled it up, the shadow error happened, but when I left it at its default size the shadows stayed. When I made a new test terrain where by default it was very big, the shadows seemed to work correctly.

Does the scaled size of the terrain effect the PSSM shader? Bounding volume or something? Im not sure.
Posted By: Ezzett

Re: Whats happening with this PSSM? (video included) - 05/09/17 16:26

Yesterday there was a problem with disappearing models because the level_ent.min_x/max_x were to small. Is this maybe the same issue you experienced?

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=465655
Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/09/17 17:11

hey Ezzett!

I saw that post and changed my level_ent sizes to no avail. The actual models themselves werent disappearing, it was just their shadows disappearing.
Posted By: Reconnoiter

Re: Whats happening with this PSSM? (video included) - 05/09/17 19:45

Hey,

I had something similar once with stencil shadows though it was when objects were more at the edge of the screen (so not exactly the same). Try tweaking the shader top (/tweak) variables and try tweaking shadow variables (shadow_lod, shadow_range etc, floor_range maybe too).
Maybe its a bug with chunked terrain or such. Have you tried scaling the terrain model in MED and lowering the entity scale?
Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/10/17 00:18

Hey Reconnoiter!

Ive been playing with the tweak variables, it didnt do anything.

So far it works when I scaled the terrain in MED like you said.

Is there an XYZ limit to the shadow? I zoomed far away from the level and noticed that an object wont produce shadows anymore past a certain position. Is this a floating point problem? Though nothing is shaking or losing accuracy....
Posted By: sivan

Re: Whats happening with this PSSM? (video included) - 05/10/17 07:49

as I remember scaling a terrain has an effect of level_ent. in past it was bad, but I think I reported the issue and was fixed, but you can print level_ent size on screen. it has effect on pssm shadow cascade settings.
Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/10/17 14:15

thank you Sivan, thats what Im noticing! laugh
Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/10/17 19:58

is there a way to disable Decal shadows while PSSM shadows are active?
Posted By: 3run

Re: Whats happening with this PSSM? (video included) - 05/10/17 21:35

Hey!

stensil_shadow = 8; - if I remember correctly

Best regards!
Posted By: jumpman

Re: Whats happening with this PSSM? (video included) - 05/10/17 23:14

Thank you 3run, you are correct, although its possible to have both decal and PSSM shadows at the same time!

The problem was that I was doing wait (18) before activating PSSM shadows, meanwhile any entities in the level that already had their shadow flag on, defaulted to the decal shadow. Once the PSSM began to run, the new dynamic shadow as well as the decal shadow were both active!
Posted By: sivan

Re: Whats happening with this PSSM? (video included) - 05/11/17 07:22

black magic!
© 2024 lite-C Forums