RalphEl Posted October 11, 2015 Share Posted October 11, 2015 Hi,, I have problem with shadowmaps when there are objects moving around scene origin 0,0,0 shadows starts flickering very intensive how can i solve that ? "it is iimposible to take screenshot of that" thanks,, Also is there possible to merge two shadowmaps ? for example I have want to use two ShadowGenerators fist for static objects with refresh rate: 60second with dynamic objects refresh rate: 1 it works very well in term of performance but problem is that when first static shadowmap is overlapping dynamic ,,, shadows become darker at overlapping point. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 11, 2015 Share Posted October 11, 2015 Hello and welcome! You can try to tweak shagowGenerator.bias to control zFighting. For your second question, I will need a playground example to see what you're mentioning Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 12, 2015 Share Posted October 12, 2015 Hi RalphEI, shadows become darker when overlapping is the same problem you're mentionning in this post http://www.html5gamedevs.com/topic/13128-suggestions-on-shadow-optimizations/, isn't it ? Quote Link to comment Share on other sites More sharing options...
KarelAnker Posted October 19, 2015 Share Posted October 19, 2015 Same problem for me.. I have a lot of objects moving at the same time, and even when they all stop, the shadows all move for no reason EDIT:It seems this happens because the shadow map seems to "stretch" based on the objects. Try it yourself: start all the objects from 0,0,0 to a random point in a range of like 400, 400 and you will notice the shadows being more pixelated. Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 19, 2015 Share Posted October 19, 2015 Maybe a playground would help to show the problem. Is this what you are talking about: http://www.babylonjs-playground.com/#XACM2 ? Quote Link to comment Share on other sites More sharing options...
KarelAnker Posted October 19, 2015 Share Posted October 19, 2015 Maybe a playground would help to show the problem. Is this what you are talking about: http://www.babylonjs-playground.com/#XACM2 ?Yup, I guess the explanation is on my post above? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 19, 2015 Share Posted October 19, 2015 If you are using a directional light, the light tries to define a point of view where all objects can be capture in the shadowmap Hence the resolution can change to accommodate moving objects Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 19, 2015 Share Posted October 19, 2015 So the solution is using another type of light? But that changes the look of the scene a lot and might not always be possible http://www.babylonjs-playground.com/#XACM2#2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 19, 2015 Share Posted October 19, 2015 Or you can disable the "auto-scale" feature:https://github.com/BabylonJS/Babylon.js/blob/master/src/Lights/babylon.directionalLight.ts#L37 I can add a boolean to define that once the scale is defined you do not want the light to adapt it iiceman and adam 2 Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 19, 2015 Share Posted October 19, 2015 If you are using a directional light, the light tries to define a point of view where all objects can be capture in the shadowmap This point of view is just a virtual point for calculation or it actually moves the light position ? Quote Link to comment Share on other sites More sharing options...
RalphEl Posted October 19, 2015 Author Share Posted October 19, 2015 would be great to get Cascaded Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 20, 2015 Share Posted October 20, 2015 It is an orthographic projection:https://github.com/BabylonJS/Babylon.js/blob/master/src/Lights/babylon.directionalLight.ts#L70 Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 20, 2015 Share Posted October 20, 2015 I can add a boolean to define that once the scale is defined you do not want the light to adapt it I would like that! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 I've just commited an update with: Added `DirectionalLight.autoUpdateExtends` to prevent directional lights to adapt to scene extends Vousk-prod. and iiceman 2 Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 21, 2015 Share Posted October 21, 2015 Sweet! But I just tried and I don't see a change yet. Maybe it's just that the playground is not updated yet? http://www.babylonjs-playground.com/#XACM2#3 By the way: I thought you are located in France.. so you are doing that awesome stuff at 4 am? or is that forum time misleading? Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted October 21, 2015 Share Posted October 21, 2015 By the way: I thought you are located in France.. so you are doing that awesome stuff at 4 am? or is that forum time misleading? DK lives in the US Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 Yep I'm living in Seattle Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 And playground is now updated with latest version Quote Link to comment Share on other sites More sharing options...
adam Posted October 21, 2015 Share Posted October 21, 2015 Shouldn't the shadow on sphere1 look the same on both of these? http://www.babylonjs-playground.com/#XACM2#3http://www.babylonjs-playground.com/#XACM2#4 I just removed removed sphere2 from the renderlist in the second PG. Quote Link to comment Share on other sites More sharing options...
adam Posted October 21, 2015 Share Posted October 21, 2015 My bad. You still probably have to play with the bias. This just stops the flickering. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 21, 2015 Share Posted October 21, 2015 I don't think it's the bias. It's that the shadow map gets calculated for both sphere and then gets frozen. So the size of the shadow map had to be expanded before freezing it. With a fixed resolution it sooner or later (depending on the area it has to cover) ends up like you see it in playground #3. You could set a little timeout to let the shadow generator do it's job and then add the sphere after that: http://www.babylonjs-playground.com/#XACM2#5 Then the shadow map is only calculated for the first sphere, covers only the area of the first sphere and doesn't change when you add the other one a little bit delayed. .... assuming I understood that correctly. If not, somebody let me know Another alternative might be a second shadow generator..one for each sphere. adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted October 21, 2015 Share Posted October 21, 2015 I'm trying to figure out how I would use this new feature. Is it only intended for objects that aren't going to move? http://www.babylonjs-playground.com/#XACM2#8http://www.babylonjs-playground.com/#XACM2#9 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 Not necessary but you can also control the size of the shadow window with shadowOrthoScale:http://www.babylonjs-playground.com/#XACM2#10 adam 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.