That looks like a typical case of shadow map acne - where the resolution of your shadow map isn't sufficiently high for your scene. If you change the resolution of the map, does it get better with higher res?
What is the format and bit depth of the shadow texture?
The gradient in the dark area near the light is easily visible in the image, and that is causing your artifacts. A large gap between shades of grey.
L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
What is the format and bit depth of the shadow texture?
The gradient in the dark area near the light is easily visible in the image, and that is causing your artifacts. A large gap between shades of grey.
L. Spiro
Thanks,
changing the format from D3DFMT_R5G6B5 to D3DFMT_X8R8G8B8 completely fix my problem.
I just have one more question, I require the light source to be very far away (to look like it come from the sky), but the problem is that objects that are far away get very pixelate(and not very accurate) shadows. the first thing that came to my mind is to blur the shadow(to look like soft shadows?) not sure what approach need to follow in order to get good quality shadows with the light source being far away.
Neither of those formats have enough precision for a shadow map. At the very least you want to use something like D3DFMT_R16F, although D3DFMT_R32F would be even better. Ideally you don't want to use a render target texture at all and just sample the depth buffer, but doing that requires "driver hacks" so you can worry about that later.
For filtering shadows you can look into Percentage Closer Filtering, often abbreviated as PCF. There are also more advanced techniques like Variance Shadow Maps which open up new possibilities for filtering.
Either way, at a certain point no amount of filtering is going to make up for really low resolution shadows and all you will do is blur the shadow detail out of existence. You appear to be using a spot light with a perspective projection, which means at a certain distance you will have inadequate resolution to capture the details of your scene. Usually this isn't a problem, since typically your spotlights have a range attenuation which means they only have a limited area of effect to begin with. Directional lights are different since they are global light sources, and techniques like cascaded shadow maps are typically used to get adequate resolution across the entire viewable range.
Neither of those formats have enough precision for a shadow map. At the very least you want to use something like D3DFMT_R16F, although D3DFMT_R32F would be even better. Ideally you don't want to use a render target texture at all and just sample the depth buffer, but doing that requires "driver hacks" so you can worry about that later.
For filtering shadows you can look into Percentage Closer Filtering, often abbreviated as PCF. There are also more advanced techniques like Variance Shadow Maps which open up new possibilities for filtering.
Either way, at a certain point no amount of filtering is going to make up for really low resolution shadows and all you will do is blur the shadow detail out of existence. You appear to be using a spot light with a perspective projection, which means at a certain distance you will have inadequate resolution to capture the details of your scene. Usually this isn't a problem, since typically your spotlights have a range attenuation which means they only have a limited area of effect to begin with. Directional lights are different since they are global light sources, and techniques like cascaded shadow maps are typically used to get adequate resolution across the entire viewable range.
As far Percentage Closer Filtering I try the Brute-Force Implementation as seen in (11.3http://http.develope...ugems_ch11.html) but i didn't manege to get it right.