PSSM and LOD

Posted By: painkiller

PSSM and LOD - 03/18/13 11:55

I'm trying to get shadows casted from the 3rd lod of my model, by setting shadow_lod=3;
The model is called character_0.mdl, and the 3rd lod model is called character_3.mdl. However, PSSM shadows still use the first lod for shadows, so I get an horrible performance.
@sivan also checked this and noticed it really does not work, shadows changes together with model lod change.
Posted By: jcl

Re: PSSM and LOD - 03/19/13 07:27

PSSM is a shader. It has no "shadow_lod". But you can certainly implement LOD steps in the PSSM script, or we can do that in a future version.
Posted By: painkiller

Re: PSSM and LOD - 03/19/13 12:33

Originally Posted By: jcl
PSSM is a shader. It has no "shadow_lod". But you can certainly implement LOD steps in the PSSM script, or we can do that in a future version.


on shadows.c code I found this:

Code:
viewSplit[i]->lod = shadow_lod;



That should do the trick, shouldn't it? If not, could you please explain how we can modify the PSSM script to get that working?
Posted By: jcl

Re: PSSM and LOD - 03/20/13 10:52

No, it does not do the trick. The distance that determines the LOD stage is not the distance to the camera for split views. Implementing LOD steps in the script would require a render event that determines the entity's camera distance and switches its model accordingly.

Implementing it directly in the engine is probably a more elegant way, and I've put that on my list.
Posted By: painkiller

Re: PSSM and LOD - 03/20/13 15:27

Originally Posted By: jcl
No, it does not do the trick. The distance that determines the LOD stage is not the distance to the camera for split views. Implementing LOD steps in the script would require a render event that determines the entity's camera distance and switches its model accordingly.

Implementing it directly in the engine is probably a more elegant way, and I've put that on my list.


okay, thanks laugh
Posted By: painkiller

Re: PSSM and LOD - 04/01/13 11:36

I've been able to get this working by removing NOLOD from line 95 in shadows.c and and setting viewShadow lod to shadow_lod, so it should look like this:

Code:
viewShadow->flags |= SHOW|UNTOUCHABLE|NOSHADOW|NOPARTICLE|NOSKY;
viewShadow->lod = shadow_lod;



With this code I can get lod offsets for shadows working nicely
Posted By: jcl

Re: PSSM and LOD - 04/02/13 07:13

Thanks! Be aware though that the distance for switching the LOD steps is not the distance to the camera, but the distance to the PSSM views in that case. So for a correct LOD the LOD steps have to be calculated with a different distance.
© 2024 lite-C Forums