Members

42

• Rank
1. ## Convert to flat shaded mesh

Hi guys, I come back with a new problem... I have a scene with imported mesh, i try to test different kind of light and shading. When i use this function : mesh.convertToFlatShadedMesh();If i move the camera, the mesh disappears partially or completely. Is it a problem related to my model? Thanks for your help, hope you enjoyed the WE !
2. ## blender cycles baking

Hi AlexB, I am very interested by your tutorial ! Thanks for that. Do you have a sample scene you could show using this technique?
3. ## looking for a shader tutorial

I recommend you this one, http://blogs.msdn.com/b/eternalcoding/archive/2014/04/17/learning-shaders-create-your-own-shaders-with-babylon-js.aspx I have been able to create a "half" shader with it. If you have success to create the cell shading shader i am interested ! I can't make the light appear on a sphere so if you can let me know !!

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 ?

With the new direction it works. But there is a point i'm missing, a direction it's a start and a end so i need X,Y,Z for the start point and X,Y,Z for the end point, obviously this is not the case here can you explain to me what mean exactly new BABYLON.Vector3(0, -2, 20)? You can access my scene here : http://www.sociusrocket.com

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 !

I added my scene in the playground, but i don't know where i can load my tree.babylon file to make it useable in the playground. http://www.babylonjs.com/playground/#WBVYZ#8

Thanks Dad72, still the same problem, below is a screenshot....

Ok, so with your help i made some progress. Below is a screenshot of my scene. I used the worldmonger example to create my scene. The black shadow is supposed to be a pine tree but as you can see there is almost no light on it ? i don't understand how lighting works. I have a point light called sun : var sun = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);The lighting on the ground is ok : var ground = BABYLON.Mesh.CreateGround("ground", 30, 30, 30, scene, sun);ground.material = new BABYLON.StandardMaterial("ground", scene);ground.material.diffuseColor = BABYLON.Color3.FromInts(193, 181, 151);ground.material.specularColor = BABYLON.Color3.Black();ground.receiveShadows = true;ground.checkCollisions = true;But the lighting on the tree doesn't work : BABYLON.SceneLoader.ImportMesh("", "asset/3D/", "tree.babylon", scene, function (newTree) { setup(newTree[0]);}); function setup(mesh) { mesh.position.y = 5; mesh.scaling.x = mesh.scaling.y = mesh.scaling.z = 2; mesh.checkCollisions = true;}I don't understand what i'am doing wrong.

Thats exactly what i wanna do ! Sources are downloadable ? there is some example somewhere?

Ok, i see ... so if i understand well i can't create an external lighting ? Even without shader ?