KevinBLT Posted July 9, 2015 Share Posted July 9, 2015 Hello there, sorry I didn't find any topic (or searched with the wrong words) related to this. So look at the screenshot attached.I have this simple scene with just one mesh.This mesh has submeshes.I also have two hemispheric lights and one directional light.The ground receives shadow. Ok.But the mesh itself always gets black when "receiveShadow" is set to true. I tried bias value, every filter. Other light conditions. Nothing helped.So I always can't figure out what the shadowgenerator wants. How can I achieve that the desk throws shadows on itself? Thanks everyone for help! Kevin Quote Link to comment Share on other sites More sharing options...
iiceman Posted July 9, 2015 Share Posted July 9, 2015 Using useBlurVarianceShadowMap, eh? I ran into that, too and had to accept that it's just not possible at the moment to use useBlurVarianceShadowMap, receiveShadows and cast Shadows at the same time. At least that's how I remember how it went. That was a big bummer. Maybe anybody got a fix this time! Here a little playground to show the problem (I hope I got it right and that's really waht you are talking about )http://www.babylonjs-playground.com/#VCXGW PS: Remove shadowGenerator.useBlurVarianceShadowMap = true; OR sphere.receiveShadows = true; to make it work. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 9, 2015 Share Posted July 9, 2015 haha, Ice, you're the fastest gun this side of the Pecos! http://playground.babylonjs.com/#PRPAS Mine is fancier... and I used a real subMeshed mesh. neener. But yep, activate line 110 in my demo, and the box darkens. I wonder what is casting a shadow over the box. Surely, it is some evil, dark, sinister entity. (Friggin' quickdraws, pft.) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 9, 2015 Share Posted July 9, 2015 You rights guys, self-shadowing cannot work with blurredVSM because we lose too much precision in the blurring process Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 9, 2015 Share Posted July 9, 2015 But you can still use VSM or poissonSampling Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 9, 2015 Share Posted July 9, 2015 Thanks DK! http://playground.babylonjs.com/#PRPAS#1 Another version, turned on POISSON, turned off VarianceSM, interesting! What the heck is self-shadowing? Is that where one part of a mesh casts a shadow on the same mesh? (like an antenna tower/etc) *scratch scratch* Ignore me, just babbling. Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted July 10, 2015 Author Share Posted July 10, 2015 My code:var MeshBoundBox = cMesh.getBoundingInfo().boundingBox;var Width = MeshBoundBox.maximumWorld.x - MeshBoundBox.minimumWorld.x;var Depth = MeshBoundBox.maximumWorld.z - MeshBoundBox.minimumWorld.z;var CenterX = MeshBoundBox.maximumWorld.x + Width/2;var CenterZ = MeshBoundBox.maximumWorld.z + Depth/2;var GroundSize = Math.max(Width,Depth) * 6; light3 = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, 0, 0), scene);light3.position = new BABYLON.Vector3(CenterX + 5, MeshBoundBox.maximumWorld.y + 10, CenterZ + 5);light3.intensity = parseFloat(document.getElementById("BrightnessSlider").value);light3.setDirectionToTarget(new BABYLON.Vector3(0,0,0)); ground = BABYLON.Mesh.CreateGround("ground", GroundSize, GroundSize, 2, scene);ground.position.y = MeshBoundBox.minimumWorld.y;ground.receiveShadows = true;ground.material = new BABYLON.StandardMaterial("texture1", scene);ground.material.specularColor.r = ground.material.specularColor.g = ground.material.specularColor.b = 0; shadowGenerator = new BABYLON.ShadowGenerator(1024, light3);shadowGenerator.getShadowMap().renderList.push(cMesh);//shadowGenerator.usePoissonSampling = true;shadowGenerator.useVarianceShadowMap = true;//shadowGenerator.useBlurVarianceShadowMap = true; cMesh.receiveShadows = true;light1.intensity = light2.intensity = 0.8; results in this (1) and (2) is what I want to receive. Hmmmmm :-/ Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 10, 2015 Share Posted July 10, 2015 And what do you get? Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted July 13, 2015 Author Share Posted July 13, 2015 The first is without receive shadows for the desk. The second is with receive shadows on. It just gets completly dark. I have no idea. Quote Link to comment Share on other sites More sharing options...
iiceman Posted July 13, 2015 Share Posted July 13, 2015 And it's the same with poissonSampling? I think with poissonSampling it should be different. Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted July 13, 2015 Author Share Posted July 13, 2015 Poisonsampling seems to not producing any shadow at all :-( Or is there something completly wrong? This function activates the shadow (Checkbox), where "cMesh" is the current loaded mesh (the desk in this case)function onShowDropShadowCheckBoxChanged() { if (!cMesh) this.checked = false; if (this.checked) { var MeshBoundBox = cMesh.getBoundingInfo().boundingBox; var Width = MeshBoundBox.maximumWorld.x - MeshBoundBox.minimumWorld.x; var Depth = MeshBoundBox.maximumWorld.z - MeshBoundBox.minimumWorld.z; var CenterX = MeshBoundBox.maximumWorld.x + Width/2; var CenterZ = MeshBoundBox.maximumWorld.z + Depth/2; var GroundSize = Math.max(Width,Depth) * 6; light3 = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, 0, 0), scene); light3.position = new BABYLON.Vector3(CenterX + 5, MeshBoundBox.maximumWorld.y + 10, CenterZ + 5); light3.intensity = parseFloat(document.getElementById("BrightnessSlider").value); light3.setDirectionToTarget(new BABYLON.Vector3(0,0,0)); ground = BABYLON.Mesh.CreateGround("ground", GroundSize, GroundSize, 2, scene); ground.position.y = MeshBoundBox.minimumWorld.y; ground.receiveShadows = true; ground.material = new BABYLON.StandardMaterial("texture1", scene); ground.material.specularColor.r = ground.material.specularColor.g = ground.material.specularColor.b = 0; shadowGenerator = new BABYLON.ShadowGenerator(1024, light3); shadowGenerator.getShadowMap().renderList.push(cMesh); shadowGenerator.usePoissonSampling = true; //shadowGenerator.useVarianceShadowMap = true; //shadowGenerator.useBlurVarianceShadowMap = true; cMesh.receiveShadows = true; light1.intensity = light2.intensity = 0.6; } else { if (light3 && ground && shadowGenerator) { light3.dispose(); ground.dispose(); shadowGenerator.dispose(); light3 = false; ground = false; shadowGenerator = false; light1.intensity = light2.intensity = parseFloat(document.getElementById("BrightnessSlider").value); } }} Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 14, 2015 Share Posted July 14, 2015 try to change the value of shadowGenerator.bias from 0 to 0.01 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 14, 2015 Share Posted July 14, 2015 the default value is not already 0.01, unless this has been changing. it should not try to put a value of 0.I feel that one has to regularly 0 to bias, why not put this default value 0 to bias? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 14, 2015 Share Posted July 14, 2015 Because it depends a lot on the scene. There is no good default value Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted July 15, 2015 Author Share Posted July 15, 2015 It's working with the desk now.I've set the value to 0.00000065. I achieve the same result now on the shelf. I just need to adjust the bias relative to object size. But i seems to work now. Thanks everyone! :-) iiceman 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 15, 2015 Share Posted July 15, 2015 Nice! 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.