JCPalmer Posted June 13, 2014 Share Posted June 13, 2014 In shadowGenerator.getTransformMatrix(), the light specified in the constructor has the method _computeTransformedPosition() called. The only light class that has this method is BABYLON.DirectionalLight (Sun in Blender terminology). All light classes inherit from BABYLON.Light. Might this getTransformMatrix() function only be called based on shadow map type(std or variance)? I specified the following BABYLON.SpotLight to have a shadow generator: function defineLights(scene){ var light = new BABYLON.SpotLight("Lamp", new BABYLON.Vector3(-9,7,-10), new BABYLON.Vector3(0.5934,-0.4616,0.6594), 0.0175, 2, scene); light.id = "Lamp"; light.intensity = 1; light.diffuse = new BABYLON.Color3(1,1,0.9); light.specular = new BABYLON.Color3(1,1,0.9);} The generator is specified after the mesh in the renderlist is also instanced here:function defineShadowGen(scene){ var light; var shadowGenerator; var renderList; light = scene.getLightByID("Lamp"); shadowGenerator = new BABYLON.ShadowGenerator(512, light); shadowGenerator.useVarianceShadowMap = false; renderList = shadowGenerator.getShadowMap().renderList; renderList.push(scene.getMeshByID("myMesh"));} I get:TypeError: this._light._computeTransformedPosition is not a function SpotLights have both position and direction. Am I missing something? Thanks Jeff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 13, 2014 Author Share Posted June 13, 2014 Ok I switched to Directional (sun) and no error. Still no shadow yet, but I need to double check the recievers. function defineLights(scene){ var light = new BABYLON.DirectionalLight("Lamp", new BABYLON.Vector3(0.5934,-0.4616,0.6594), scene); light.position = new BABYLON.Vector3(-9,7,-10); light.id = "Lamp"; light.intensity = 1; light.diffuse = new BABYLON.Color3(1,1,0.9); light.specular = new BABYLON.Color3(1,1,0.9);} Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 14, 2014 Share Posted June 14, 2014 Yep I confirm: only directional lights cast shadows Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 14, 2014 Share Posted June 14, 2014 https://github.com/BabylonJS/Babylon.js/wiki/17-Shadows 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.