nirbe Posted August 25, 2015 Share Posted August 25, 2015 Hello,I have a shadows in my game and i want that the shadows will be blurred and more transparent.Here is screenshop from my game: How i can do that? Thanks! Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 25, 2015 Share Posted August 25, 2015 Hi! Maybe you can try to use this: https://github.com/BabylonJS/Samples/blob/master/Scenes/Customs/softShadows.js#L29 Quote Link to comment Share on other sites More sharing options...
nirbe Posted August 25, 2015 Author Share Posted August 25, 2015 Hi! Maybe you can try to use this: https://github.com/BabylonJS/Samples/blob/master/Scenes/Customs/softShadows.js#L29 dont work... now all the game is black (like there is no light at all) Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 25, 2015 Share Posted August 25, 2015 Hi and welcome to the forum! Maybe you should create a playground that shows the problem at www.babylonjs-playground.com I assume the "all black" (http://www.babylonjs-playground.com/#20GGCS) is because you let your meshes cast and receive shadow at the same time. I think that this is not possible with useBlurVarianceShadowMap active. As an alternative you could use usePoissonSampling. Not as soft but still better then no filter at all. http://www.babylonjs-playground.com/#20GGCS#1 (hint: make sure you find a good bias value for the shadow generator, just try different values and see what works for you) About making shadow more transparent: you could use an additional light to soften the shadow effect: http://www.babylonjs-playground.com/#20GGCS#2 I hope this helps. Let us know how it's working out. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted August 26, 2015 Share Posted August 26, 2015 I've been asking about this as well. It'd be cool to have an "intensity" setting for shadows. Adding additional light creates extra load on the processor (noticeable drop on frame rate on mobile) and alters the whole scene so I can't use that option. Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 26, 2015 Share Posted August 26, 2015 Hmm, there is a property for darkness (http://doc.babylonjs.com/classes/2.2-alpha/ShadowGenerator#setdarkness-darkness-rarr-void) but I have no clue what that actually does, doesn't seem to have any influence Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 26, 2015 Share Posted August 26, 2015 So how shadows work? Let Professor Deltakosh explains you the theory Realtime shadows used in Babylon.js use a texture to determine distance between every pixel (that the light can see) and the light. During mesh rendering, shaders compute the current distance of every pixel to the light.IF this distance is greater than the one saved inside the texture this means that the light CANNOT see the pixel so shaders know they can skip lighting phase for this specific pixel Long story shortShadows work like in the real word: by not computing the light. Which means that you cannot control the "darkness" because the shadow is not painted or rendered. You can see a shadow because light is not applied where the shadow is. Am I screwed?No, Babylon.js is your best friend, remember? You can still control your rendering (of course) by adding more ambient color on your receiving object for instance: http://www.babylonjs-playground.com/#20GGCS#4 (See at line 37) Darkness parameter is a little bit different: it can be used when no filter is applied to reduce the strength of the shadows (Creating some kind of cheap penumbra) iiceman and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
ozRocker Posted August 27, 2015 Share Posted August 27, 2015 Thanks for the explanation Deltakosh. I'm still wondering how other frameworks such as Unity are able to have a "Strength" setting for their shadows which allow you to control the strength of the shadow. If they have that option then it must be possible to implement with Babylon.js. Adding extra lights to the scene isn't a practical solution for me because it changes the rest of the scene and reduces the frame rate significantly on mobile devices. Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 27, 2015 Share Posted August 27, 2015 And using the emissive color? Might that work for you? Quote Link to comment Share on other sites More sharing options...
ozRocker Posted August 27, 2015 Share Posted August 27, 2015 well I don't want to change the emissive properties of the material. That effects the lighting of the whole object, not just where the shadows fall Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 27, 2015 Share Posted August 27, 2015 Hmm. [...] the light CANNOT see the pixel so shaders know they can skip lighting phase for this specific pixel @Deltakosh:1) Could the shader be modified to not skip the lighting phase but to do lighting with a different intensity (if a darkness value < 1 is provided in the shadow generator)?2) Alternativley: could a darkness value be implemented for "no light"? I mean a value that can set how dark things are if there is no light at all, that should then effect the shadow areas was well, right? Quote Link to comment Share on other sites More sharing options...
adam Posted August 27, 2015 Share Posted August 27, 2015 I've been asking about this as well. It'd be cool to have an "intensity" setting for shadows. Adding additional light creates extra load on the processor (noticeable drop on frame rate on mobile) and alters the whole scene so I can't use that option. Does one hemispheric light put that much additional load on the processor? If it doesn't, it seems like a good solution. http://www.babylonjs-playground.com/#20GGCS#3 You might want to line up the lights like this:http://www.babylonjs-playground.com/#20GGCS#6 intensity increased a little for hemi light:http://www.babylonjs-playground.com/#20GGCS#7 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 27, 2015 Share Posted August 27, 2015 Hemi light are not extensive at all For shadows strength, I'll think about a way to use darkness parameter even with soft shadows..I'll keep you posted Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 27, 2015 Share Posted August 27, 2015 Your word is my command http://www.babylonjs-playground.com/#2B2TKOhttps://github.com/BabylonJS/Babylon.js/commit/bfbb454cfccc0d576fd408dd45898f63dc92b6b5 Dad72, iiceman and ozRocker 3 Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 28, 2015 Share Posted August 28, 2015 Cool! But... it's just not in the playground yet, right? Somehow I don't see any difference http://www.babylonjs-playground.com/#20GGCS#8 Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted August 28, 2015 Share Posted August 28, 2015 For me it works pretty well in the PG. Nicely done DK ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 28, 2015 Share Posted August 28, 2015 As Yoda said: "You cache don't forget to clear" Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted August 28, 2015 Share Posted August 28, 2015 Since we are talking about darkness parameter, it would be super great to be able to strengthen the SSAO effect.For now we can barely see the shadows added by that process (look at the PG example http://www.babylonjs-playground.com/?24 , just press "3" and you'll notice that the effect is in fact very gentle). In real cases, eg. scenes well lit containing objects with more or less complex materials, SSAO does not make any difference because the produced shadows are not enough dark. Don't know if the post process is multiplied or added - or whatever else - to the rendered image, but to be usable in production we really need a param to make it more visible. Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted August 31, 2015 Share Posted August 31, 2015 Hey Vousk-prod The SSAO rendering pipeline can be customized by modifying the .totalStrength parameter (for dark shadows)Here a full example with all the modifiable values : http://www.babylonjs-playground.com/#1SYMDOThe parameters are explained here : http://doc.babylonjs.com/classes/2.2-alpha/SSAORenderingPipeline davrous 1 Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted September 1, 2015 Share Posted September 1, 2015 Ah excellent, I will play with all those parameters in customers scenes. Thanks Luaacro. julien-moreau 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.