Jump to content

CSG and light problem


Edemsky
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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...