I am trying to add to my game a point light shadow map.
I render depth map of a cube texture, but without the top and bottom since it's not necessary from the perspective of my game.
I was able to cast shadows like that with 4 cameras, each for every side of the cube(without the top and bottom).
Each 90 degrees fov.
I was able to do this, but I want to improve it.
I want soft shadows.
Also, something that is weird, it seems that if the near and far is (0.1, 300) it is somehow more accurate than (0.1, 20), which is kind of weird.
I use 16 UNORM textures for storing the (0..1) normalized depth.
I calculate the depth this way:
In the vertex shader:
o.depth = UnityObjectToClipPos(v.vertex);
In the fragment shader:
i.depth /= i.depth.w;
float d = i.depth.z;
return float4(d, d, d, 1);
I wish to have soft shadows like in Unity's directional soft shadows.
I also did a bit more sampling to try and make the shadows more soft.
This is my result:
![](https://uploads.gamedev.net/forums/monthly_2021_08/46b0b3f84a504d48b002a0064e91c88b.screen_2560x1440_2021-08-28_07-49-20.png)
This is a comparison of point + direcitonal shadows and point alone, to show you the difference between soft shadows.
![](https://uploads.gamedev.net/forums/monthly_2021_08/181a62b12f51456e8b1170389a98a657.screen_2560x1440_2021-08-28_07-52-31.png)
![](https://uploads.gamedev.net/forums/monthly_2021_08/54bb4368a9ad4cccac5fea2954bbb49f.screen_2560x1440_2021-08-28_07-52-35.png)