Edemsky Posted January 8, 2017 Share Posted January 8, 2017 Why the light on the mesh changes when I just subtract one mesh from another? It doesn't looks right and I just can't understand it. Here's an example in the playground. http://www.babylonjs-playground.com/#Q1SRN#2 Any ideas? Quote Link to comment Share on other sites More sharing options...
JohnK Posted January 8, 2017 Share Posted January 8, 2017 Hi. On mobile at moment so cannot test my idea. When you create box no material is applied to the box so a default shading is given. When you use toMesh this supplies a material as a parameter, in this case a new standard material which seems to apply a different default shading to the one when no material is set. Try creating a material and applying it to the box when created and the same material as the parameter in toMesh. If I am correct the shading of the box before and after csg is used should not change. Quote Link to comment Share on other sites More sharing options...
Edemsky Posted January 8, 2017 Author Share Posted January 8, 2017 37 minutes ago, JohnK said: Hi. On mobile at moment so cannot test my idea. When you create box no material is applied to the box so a default shading is given. When you use toMesh this supplies a material as a parameter, in this case a new standard material which seems to apply a different default shading to the one when no material is set. Try creating a material and applying it to the box when created and the same material as the parameter in toMesh. If I am correct the shading of the box before and after csg is used should not change. Okay, think I've done evrything right but the light still changes.http://www.babylonjs-playground.com/#Q1SRN#3 Quote Link to comment Share on other sites More sharing options...
JohnK Posted January 8, 2017 Share Posted January 8, 2017 So it seems my idea was wrong (not for the first time). Back on PC tomorrow will have a look at CSG code to see if light or material used is changed. Or maybe someone else will pick up on problem. Quote Link to comment Share on other sites More sharing options...
Mist Posted January 9, 2017 Share Posted January 9, 2017 It is known as specular highlights in 3d modeling and texturing. what you are seeing is that the light source is perpendicular to the normal of the polygon's face. Comment out line 25 of your code //box.rotation.y = Math.PI/2; then change your setTimeout duration to something like 7-8 seconds so you have time to maneuver the camera to better view - this should illustrate whats happening there maybe a couple of ways to deal with this in BJS, but I am not yet familiar with the engine so.......a couple of things I would do in blender would be lowering the strength of the light source moving the light source further away in 3d space lower the specular value on the material of the object Quote Link to comment Share on other sites More sharing options...
JohnK Posted January 9, 2017 Share Posted January 9, 2017 Still not entirely sure but seems to be something to do with the new geometry of mesh from CSG . This PG shows the wireframes of the mesh before and after together with the normals. http://www.babylonjs-playground.com/#Q1SRN#7 this PG shows he distribution of normals by color over the meshes so again some change between original and from CSG http://www.babylonjs-playground.com/#Q1SRN#8 It seems that you will have to adjust the material and lights o what you want after meh from CSG created. 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.