nittrus Posted October 12, 2016 Share Posted October 12, 2016 So I would like to have my terrain cast shadows on it's self, like the mountains shadow the rest of the terrain, etc. But when I try to do this by adding the groundPlane to the shadowGenerator, the entire mesh turns black. Is there a way to do this, or is this not something that can be done yet? I really hope to be able to pull this off! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 13, 2016 Share Posted October 13, 2016 Hi again N. http://playground.babylonjs.com/#TCPB GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
nittrus Posted October 13, 2016 Author Share Posted October 13, 2016 On 10/13/2016 at 4:57 AM, Wingnut said: Hi again N. http://playground.babylonjs.com/#TCPB Hai wingy! I see that working, that is nice and is what I want, but isn't what I get but also, I'm using BABYLON.Mesh.CreateGround not heightfield. However, I took that PG and modified it pretty close to what I have and found out that useVarianceShadowMap set to true was the culprit, however, now the shadow is showing for the hills but it looks destorted, I been playing with bias but not quite getting a better result, but it is better than the entire mesh being black, so yay progress! Here is the modified PG: http://playground.babylonjs.com/#TCPB#2 Thanks for the help Wingy! Quote Link to comment Share on other sites More sharing options...
nittrus Posted October 13, 2016 Author Share Posted October 13, 2016 OK I got it working decently enough, will try to clean it up later. If you have any pointers or tricks I'm all ears, but it's now within acceptable tolerances Wingnut 1 Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 16, 2016 Share Posted October 16, 2016 .usePoissonSampling works, without .forceBackFacesOnly (near perfect from a distance)http://babylonjs-playground.com/#TCPB#4 I think it is a bug in variance shadow mapping, in the Chebycev inequality function. (Only the variance/blur variance shadows use this) I looked at it, and modified it yesterday evening but I could not figure it out... Weird, because it seems ok, but still not working. Maybe with fresh brain. I would like to use the much nicer variance shadows, poisson is ugly from up close. (How nice would be a distance-field shadow which smoothes out at a distance from the shadow caster.) Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 16, 2016 Share Posted October 16, 2016 In BABYLON shader source:https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/shadowsFragmentFunctions.fx#L141 Something very similar in playcanvas source:https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/shadowVSM_common.frag So I think I understand now what it does, but I cannot figure out why it is not working. If I switch on both receiveShadows and shadow casting on everything , everything is shadowed. Poisson works. (but it is not smooth) I hope someone will help me !? Quote Link to comment Share on other sites More sharing options...
nittrus Posted October 16, 2016 Author Share Posted October 16, 2016 13 hours ago, BitOfGold said: .usePoissonSampling works, without .forceBackFacesOnly (near perfect from a distance)http://babylonjs-playground.com/#TCPB#4 I think it is a bug in variance shadow mapping, in the Chebycev inequality function. (Only the variance/blur variance shadows use this) I looked at it, and modified it yesterday evening but I could not figure it out... Weird, because it seems ok, but still not working. Maybe with fresh brain. I would like to use the much nicer variance shadows, poisson is ugly from up close. (How nice would be a distance-field shadow which smoothes out at a distance from the shadow caster.) I had actually discovered that, I even got it looking decent using poison sampling up close now and was able to lower the shadowmap size to regain a bit of performance. I ended up having two lights for the sun position so to have a shadow generator for the terrain and one for the models, I had to lower the light level of one and the other and adjust shadow darkness until they synced up, it worked very well! Blurvariance destroys performance so much that I won't even consider using it at this time, maybe if it gets better in the future but it does look nice, but I go from 40FPS with poison and all the other stuff in my scene down to 22FPS with blurvariance.. and that is just with that mode on. Quote Link to comment Share on other sites More sharing options...
nittrus Posted October 16, 2016 Author Share Posted October 16, 2016 Here is a screen shot of it, I'm quite satisfied BitOfGold, Wingnut and GameMonetize 3 Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted October 17, 2016 Share Posted October 17, 2016 Two lights! And i thought of every possible method but not this simple! You made my day Quote Link to comment Share on other sites More sharing options...
nittrus Posted October 17, 2016 Author Share Posted October 17, 2016 6 hours ago, BitOfGold said: Two lights! And i thought of every possible method but not this simple! You made my day Glad to have helped! Just remember there is a limit of lights you can have in a scene (I think 6 if I recall), but this was a light well used I think! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 17, 2016 Share Posted October 17, 2016 Love this thread Regarding VSM, this is a complex beast to harness (further more with int texture where we lose a lot of information ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.