CHIMAIRA Posted October 1, 2017 Share Posted October 1, 2017 Hi everyone I have some weird issue using shadows in Babylon. Please take a look at the sample below : http://www.babylonjs-playground.com/#ITTNDX#1 It seems that the shadow is not cutted off properly ! it still appears even if the object goes under the ground. Is there anything to do to fix that ? Thanks for your time A Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 2, 2017 Share Posted October 2, 2017 You could play with the bias but this depends on your scene configuration and will have to be changed depending on your scene: https://www.babylonjs-playground.com/#ITTNDX#3 CHIMAIRA 1 Quote Link to comment Share on other sites More sharing options...
CHIMAIRA Posted October 2, 2017 Author Share Posted October 2, 2017 Hi Sebaven Thank you , that fix it. I've noticed that you removed this line : shadowGenerator.useBlurExponentialShadowMap = true; Which was important too. But , is this a workaround ? or a real solution ? Thanks Again. A. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 2, 2017 Share Posted October 2, 2017 That's a real solution CHIMAIRA 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 2, 2017 Share Posted October 2, 2017 22 hours ago, CHIMAIRA said: Hi everyone Hi Chimaira... welcome to the forum, good to have you aboard. (Just wanted to reciprocate your nice greeting.) I'm not in agreement with these guys... claiming that bias is the solution, here. (I've been known to be wrong quite often, though) If we push the ground into the shadowMap with that .004 bias, things REALLY go to hell. Something doesn't feel right with the framework, here, imho. Granted, I don't use shadows very often, but NEEDING TO deal-with this micro-bias adjusting during scene assembly... would quickly turn-me-off to using shadows. Our shadows system should be MUCH easier to deal-with.... than this. If I make enemies of my heroes by saying this, that's tough. I am going to hold my ground until proven wrong. Never should a shadow be cast toward the light, and as far as I can tell, that is what is happening, a bit. *shrug* Throw stuff at me, at will, guys. adam, CHIMAIRA and RaananW 2 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 2, 2017 Share Posted October 2, 2017 https://www.babylonjs-playground.com/#ITTNDX#8 Our shadow system... has "range modes" I think. For example, 0-10 light->caster range, 10-100 range, 100-500 range, etc. Flying lights have a real issue, here, me thinks. User would need to know WHEN a range-change happens, and then re-adjust .bias for each new automatic range-change? (Wingy feels-for a tumor that could be forming on his forehead.) Yeah, I can understand why auto-ranging a shadowGen might give best edge clarity/contrast, but, flying lights could be hell. hmm. Seems that there was a "needsUpdateEveryFrame" (or similar-named) property involved-in shadows or their lights... but I can't remember where that was, or if it is pertinent. Perhaps shadowGenerator._light.needProjectionMatrixCompute(true)... but I see no changes in the above PG, when used. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 2, 2017 Share Posted October 2, 2017 Just to bring more precision from the actual behavior, I would say shadow is like karma: http://www.keepcalmandposters.com/poster/5597154_keep_calm_because_karma_is_a_btch Precision is an important part of it and there is no single method that works, but a bunch of different more or less adapted to your scene. To have an adaptative solution we are planing to integrate cascaded shadows at some point to help with bigger scenes. In your particular case, you could make the point light act as a spot light in a self shadow like mode which should solve your issues a bit like this: https://www.babylonjs-playground.com/#ITTNDX#10 RaananW, adam, Dad72 and 1 other 3 1 Quote Link to comment Share on other sites More sharing options...
CHIMAIRA Posted October 2, 2017 Author Share Posted October 2, 2017 5 hours ago, Wingnut said: If we push the ground into the shadowMap with that .004 bias, things REALLY go to hell. Hi Wingnut , Sebavan , thank you both for your replies , really appreciate ! @Wingnut , I was really optimistic untill I read your message . Then I ran testing the bias property on my real scene (diffrent sizes , moving light... ) ! and guess what ? the result was catastrophestic . "things REALLY go to hell." Worse then that , even by manipulating the light properties , I can't get a satisfying result and the shadow edges are disturbed with light animation with some aliasing . really ugly . I'm a little disappointed, that shadows have those critical issues ! It should be simple to implement . Plus , I don't know why I can't find a shadows demo on the net which brings me some tricks to solve my problem . @Sebavan I'll try your suggestion too . 2 hours ago, Sebavan said: karma: http://www.keepcalmandposters.com/poster/5597154_keep_calm_because_karma_is_a_btch Thanks, Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 3, 2017 Share Posted October 3, 2017 Hi again. So, what's happening here? Are we all supposed to stay calm and hope this blows over and the issue is blown-off? Is that what all this karma talk is all about? Perhaps I don't understand what point is trying to be made. Meantime, we have no pointLight sun or moon that can cross a scene from horizon-to-horizon, and do tolerable shadows along the way? This seems like an important thing for many scenes. @Sebavan - have you got some info on this issue... something that could be explained to less-than-genius folk like myself? Is there some work I could do... to fix or minimize this issue? Can you (or anyone else) steer the team in some direction that would be useful? (thx) JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 3, 2017 Share Posted October 3, 2017 Hello, About the Karma, this was a failing humour tentative so I guess Karma is really... :-) Else, about Shadows we have an amazing doc here for troubleshooting: http://doc.babylonjs.com/tutorials/shadows#troubleshooting Also for finer grain details, you can have a look at this document detailing mostly all the artifacts and issues we might have: https://msdn.microsoft.com/en-us/library/windows/desktop/ee416324(v=vs.85).aspx?f=255&MSPPError=-2147217396 For larger scene we are planing to introduce cascaded shadow maps after 3.1 to help addressing precision issues where mostly needed. Wingnut and JackFalcon 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 4, 2017 Share Posted October 4, 2017 Thx! From the MSDN article... "Like shadow acne, Peter Panning is aggravated when there is insufficient precision in the depth buffer. Calculating tight near planes and far planes also helps avoid Peter Panning." I think "Peter Panning" is what we are seeing in some of these playgrounds. Sometimes, shadow is not connected to caster. There is a gap between caster and shadow. At other times, I think we see something that could be called "inverse Peter Panning"... where the shadow is SO "deeply attached" to the caster... that it is TOO near, and actually appears to cast a backwards shadow... toward the light. Interesting. Thanks for the links, and thanks for ALL your contribs, Sebavan! (something like 156 git-commits to BJS -- outstanding!) Quote Link to comment Share on other sites More sharing options...
CHIMAIRA Posted October 4, 2017 Author Share Posted October 4, 2017 Hi , This thread helps me a lot : I got a decent result by using a Directional light instead of Point Light Still not sur if this light type is for something but I ll use it for now, A. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
CHIMAIRA Posted October 22, 2017 Author Share Posted October 22, 2017 Hi friends , it's me again , I 'm really struggling with shadows, I have a scene that loads a couple of meshes from an obj file (generated with 3dsmax) . I wish to apply a "realistic" shadows on theme , I tried all things I "know" about babylons shadows, Activating blur, Poisson Sampling, mixing params bias, deeling with kernel blur, shadow map size etc, with no success . The following zip file contains the scene files, ready to run . (I can't use the the playground because of the obj file.) ZippedScene.zip Please can someone give me an advise ? Thanks! Please have a look to screenshot : Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 23, 2017 Share Posted October 23, 2017 Hi guys. Just bumping this up. I think it would be useful if a few of our shadow experts... grabbed Chimaira's ZIP and gave it a test-drive... see if they can get scene shadows acting sanely. And, I'm sort-of curious about possible improvements in shadows.. in WebGL 2. Chimaira... sorry for all the hassles. If no shadow experts try your file, I soon will (though I am not very bright) Ok, mission accomplished, so far (topic bump). Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 23, 2017 Share Posted October 23, 2017 What could hep would be to create a repro in the playground with your scene (you can host it on github for instance) os we can help you tweak the scene Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 24, 2017 Share Posted October 24, 2017 Yep! Well said, DK, or almost well said. Chim has ALL objects coming from inside the myobj.obj file (which is inside his/her zippedScene.zip file). Teapot, ground, cylinders, all if it. No problems, but I wanted to point-out that they are all externally-modeled mesh. I took it, I ran it. It's got some serious jaggies... but... Hey Shadow Experts... can badly-aimed lighting normals on a heightMap ground... screw-up shadows cast UPON that ground? I think the answer is no, but I'm not sure. I think it is important to do what Deltakosh states. Do your best to make a playground that uses your createScene function from testa.html, and imports myobj.obj from a free github account (or some other CORs-clear hosting site). Testers, remember that myobj.obj contains at least 5 mesh, including ground/heightMap. Okay, that's plenty of project for Chimaira for now. How about a similar playground that... well... it's a mess. hehe. I found a CORS-clear Utah Teapot model in some stranger's GitHub folder... and I found some dynamic-generated Perlin-noise-driven heightMap code (probably from @jerome)... and I put it all in a garbage can and stirred-it-up with an outboard motor. Look what I got... https://www.babylonjs-playground.com/indexstable#1MR44S#11 Chimaira... WARNING. It is a bad idea to use MY mess... as a shadow-testing playground, because mine doesn't use YOUR teapot, YOUR ground, or YOUR cylinders (which were likely made in a 3D modeler). To REALLY test your issue properly, we need a playground with YOUR mesh... from myobj.obj. I just made this substitute playground... because I was bored or something. Shadows in this substitute playground look fairly good. A little greasy, maybe. There's a seam on the back of the teapot that doesn't react well as shading passes over it. There's also some problems around the teapot lid and pour-stem, too. There could be a minor modeling/normals issues at the top and bottom of the handle, too. Not sure what the story is... on those. Someone needs to erect some cylinders and set their shadows active. It is something to play-with until Chim gets his/her playground working. Chimaira... here's a few hints about what to do with your free Github account, should you decide to use THAT as a place to publish myobj.obj. Look at MY free Github account... here. Notice that I created a "repo" (repository) called misc. Let's look inside it. Notice that there is a file called "bjs_text.babylon". Now let's go view the playground which loads that file... here. Notice the unusual domain/path in line 10. https://cdn.rawgit.com/Wingnutt/misc/master/. Perhaps these hints will "git" you rolling a bit faster. Hope I've been helpful. Talk soon. Quote Link to comment Share on other sites More sharing options...
CHIMAIRA Posted October 25, 2017 Author Share Posted October 25, 2017 Hi, @Wingnut, @Deltakosh Holly Sh*. I already have a github account (guess the name ), and I did not noticed the possible "hot linking" files ! Thanks for the hint So here we go with the playground : (I mean My playground with MY meshes and MY Metrics) http://www.babylonjs-playground.com/#8857EQ#3 In my humble opinion, I think that shadows are hard to configure with big meshes ! Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 25, 2017 Share Posted October 25, 2017 Alright! We're rockin'. You made it look easy, Chimaira... thanks for making the PG! Now let's see what the shadow Gods can do with it. I'm going to go read that link that Sebavan gave us... so I can be occluded included in the advanced technical discussions that are sure to come soon. (oh goodie, eh?) I cranked-up the shadow resolution (4096) and blindly set some various values in lines 36-43. Looks a little nicer... but I turned-off some fancy blur stuff. Experimenting. Arte 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 25, 2017 Share Posted October 25, 2017 What about something along these lines: https://www.babylonjs-playground.com/#8857EQ#7 I tried to remove the self shadowing issues Wingnut 1 Quote Link to comment Share on other sites More sharing options...
CHIMAIRA Posted October 28, 2017 Author Share Posted October 28, 2017 Hi @Wingnut, @Deltakosh And as always, thanks for replies ! For my scene, I m trying to get a daylight lighting system. So the self-shadow is quite important. there is no self shadow, ( as Deltakosh mentioned) and the shadows style seems to comme from a candle and not a sun. I did not understand why the mesh wireframe appears here : For Wingnut instance , even with higher shadow resolution, we still see the shadow aliasing , which is not okey for big scene. ( I tryed (8192 too, and got error for more bigger values). And then, if you look from the top you will notice that the teapot shadow is disappearing at some moment : Believe me, I don't want to bother you , You guys are doing a great job. I never knew a forum like this one. People are really taking time to help each other and solving theire issues . so BRAVO See ya next time, Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 30, 2017 Share Posted October 30, 2017 Shadows are not a simple beast as they really depend on your scene So here are some suggestions: - Read this and make sure to understand it: http://doc.babylonjs.com/babylon101/shadows#troubleshooting - Try to reduce the size of your scene, to get good shadows the overall size of the scene should be kept under 100 so shadows can get enough precision - Start with a simple scene (a plane and a teapot). Make sure that it works before adding more items. - Report here Wingnut 1 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.