Hi, I have activated the soft shadows for my directional light but they don’t look good as they could be. I want to improve them with a rotation of the sampling pattern, but I’m not sure how to access Unity’s built-in shadow mapping shaders.
In the .zip file of the built-in shaders provided on the Unity website, I have found a shader called “Internal-PrePassCollectShadows.shader” which seems to be the original shader that I need to modify. However, I have no ideia how to replace the built in shader by the modified version and whether if it will work for both deferred and forward rendering.
to replace the built in just drop this one into the project
as it will be handled later than the integrated one it will overwrite the integrated one (shaders are refered to by their name and you overwrite has the same as the internal one)
thats how the terrain shaders were replaced since U2
dreamora is not actually correct. While this trick of “drop in your own shader to replace built-in ones” works in some cases (like Terrain), it does not in other cases. At the moment you can’t override the shader used for shadowmap blurring. I’ll see if I can make that happen for next release.
Aras has said we’ll be able to define a custom shadow blur shader in 3.2 (Yay!) but I don’t think we’ll be able to completely replace the shadowing system with shaders.
That’s nice, I noticed that the shadow blur filter is in the Built-in Shaders package. So I assumed that it was possible to replace it.
But I’m trying to find a workaround for the bug that shadows, SSAO and most other shaders are broken when you use non-standard projection matrices.
So this isn’t helpful in my situation.
Could you also expose the distances of the different cascade levels too Aras? To get crisp shadows currently, we have to set the shadow distance to be about 20-30mts when we really need them at 200mts. If we could set the first cascade level to be 5mts then it would solve most of the problems even with 4 cascade levels
assumed that it worked for all those shaders where the sources are provided by the built-in shaders as it makes not that much sense to have the source if you can’t alter it at least to me, sorry for missinformation there from my end then.
No… not yet. There’s not much to look at anyways as it’s still quite early in development. I just made point light shadows work today. What’s strange is that with comparable quality, they render three times as fast as Unity’s!
EDIT: Yep… seems like Unity is overrating the resolution a bit
I would like to see your progress too, this means you can add area lights too right? And you could apply ambient occlusion with the ambient light like how its supposed to be? So many possibilities I would love to see what can be done, maybe even turn it into an open source kinda thing where everyone chimes in and see what we can do to improve the quality and rendering in Unity!
Vast majority of things can be implemented, yes. There are several places you can apply ambient occlusion… ambient light, near lightmaps and other forms of GI is the correct place, you have to use the good old darkening if you don’t have any of these. But yeah, that would definitely be an option
There’s still a long way full of surprises to the release, but I imagine I’d release one free (or very cheap) open-source version with only the basic stuff in it that you can modify to your hearts desire and then possibly sell it on the store and one paid version with all the fancy features.
I’ll make a thread for this once I can get the shadows to filter properly (probably going for ESSM)… turns out it’s not a trivial thing to do with cubemaps.