Jump to content

Weird shadows


Adrian
 Share

Recommended Posts

Try: 
 

var LightDirectional = [];LightDirectional[0] = new BABYLON.DirectionalLight("Sun", new BABYLON.Vector3(-1, -5, -1), scene, true); LightDirectional[0].diffuse = new BABYLON.Color3(0.80, 0.80, 0.80); LightDirectional[0].specular = new BABYLON.Color3(0, 0, 0);     LightDirectional[0].intensity = 0.8;LightDirectional[1] = new BABYLON.DirectionalLight("Sun", new BABYLON.Vector3(0.2, 0.1, 0.2), scene, true); LightDirectional[1].diffuse = new BABYLON.Color3(0.80, 0.80, 0.80); LightDirectional[1].specular = new BABYLON.Color3(0, 0, 0);  LightDirectional[1].intensity = 0.8;

PointLight plans no shadows

Link to comment
Share on other sites

I have changed the code like this :

/* Build camera */var camera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(0, 2, 0), scene);scene.activeCamera = camera;camera.applyGravity     = true;camera.checkCollisions  = true;camera.speed            = 1;camera.attachControl(canvas, false);camera.keysUp.push(90);camera.keysLeft.push(81);camera.keysRight.push(68);camera.keysDown.push(83);/* Build sun light */var LightDirectional = [];LightDirectional[0] = new BABYLON.DirectionalLight("Sun", new BABYLON.Vector3(0, 2, 20), scene, true); LightDirectional[0].diffuse = new BABYLON.Color3(0.80, 0.80, 0.80); LightDirectional[0].specular = new BABYLON.Color3(0, 0, 0);     LightDirectional[0].intensity = 5;

So my camera is set to :

 

X : 0, Y : 2, Z : 0

 

I load my tree at :

 

X : 0, Y : 0, Z : 20

 

My light "look" at X : 0, Y : 2, Z : 20

 

So, now the tree get light but the ground don't !

post-10611-0-18882200-1411151491.png

Link to comment
Share on other sites

I understand. So The position could be considered like the start position then the direction is the point which is looked by the le light. By default, the position is 0, 0, 0 ?

 

EDIT : I misunderstood, in the doc it is said that the light comes from the infinite, in the direction define by the vector. but the infinite come from where ?? in a 3D world the infinite can come from anywhere ?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...