Playing Elden Ring recently, I noticed that the player has seemingly separate shadow map of higher resolution than other objects of the world. I’m interested in replicating that effect in Godot (4.5.1).
It should allow to have sharper shadows for my character without need to increase overall resolution or decreasing max distance.
My (poor) attempts
I had some success by making 2 directional lights:
One with PSSM 4 Splits, large max distance (>200), and caster mask excluding player character.
One with Orthogonal mode, small max distance (6-10m, distance of spring arm of third person camera), and caster mask only including layer with the character.
It does create nice shadows separately for character, but issue now is that I have 2 lights and also shadows can overlap.
Maybe there is some engine feature I’m missing? I looked through documentation page and searched forums, but haven’t found mentions of problems like this. I been thinking about some ways of combining shadows maps, or somehow making it so it only casts shadows, but I have not found ways to implement that.
There must be two shadow maps in Elden ring. The problem of the additional light could be fixed with shader code, you could try to just make them both half intensity.
you don’t have evidence of that.
most likely it’s angular distance, which you can enable in godot by setting it on the sun light.
set it to 0.5 and the near shadows are going to be sharper than the distant ones.
but you would need to increase the quality of shadows in project settings to get the level of detail seen in the picture.
and these are not “shadow maps”, godot uses buffer shadows, just like other engines. a shadow map refers to shadows baked into a texture, and are static, like lightmapGI.
Sorry about terminology, my understanding of shadow rendering is largely based on LearnOpenGL which called them like that. What I say further is also based on what I learned there…
I loaded capture of my project and the Elden Ring in RenderDoc, and found similar depth textures which I assume are used for shadows. I see 8192x4096 texture atlas with 2048x2048 sub-texture that only contains the player character, while others contain everything except for player character. That is what I meant.
In my project, and on previous screenshots, I’ve set rendering/lights_and_shadows/direcitonal_shadow/size to 8192, and as expected, I got 8192x8192 texture with 4096x8192 from second directional light that I used for player in RenderDoc (very interesting to me, how similar they look!), so…
I think increasing it further would be too much, and it doesn’t seem that necessary.
Is there some known way to do something like plug that separate character depth texture into shadow calculation, to have both low resolution world and sharper character shadows?
I’m not familiar with details on how shadows are done in Godot, but maybe I’ll look further into that.
If they’re indeed using a separate shadow map for the player then you can’t replicate this in Godot without source code interventions. It’d require rendering and sampling two shadow maps for a single light source. Afaik Godot currently offers no flexibility to alter built-in shadow mapping pipeline in this way.
This is true, the shadow buffers are not flexible or anything, the shadow depth buffer afaik is not available to the user but its no great loss, the implementation of the PSSM is good and reliable.
Rendering seperate character shadows is an old optimization trick used in legacy retro engines when there is a lightmap and a shadow map.
That reminds me of all the static shadow settings and Godots own lightmap. So you could try to get static shadows working (pre rendered shadow maps for static geometry, that wont work for the cascaded shadows, but maybe for big orthogonal shadow maps) or use lightmapping for the same type of effect.
I guess it doesn’t matter that much, I was just pointing it out because baked shadows and dynamic shadows are different.
Oh, ok. Godot does render separate shadows, using the splits. But these are based on distance.
I played around with the psmm settings, changed max distance to 40.0 and that made the shadow more detailed without changing project settings, but keep in mind, this can cause artifacts with larger objects, so it should be used with lights that don’t move a lot, so day-night cycle would be difficult.
I also increased shadow quality in project settings.