Jump to content

CSG Lighting changes


Recommended Posts

Dear friends

I am pulling my hair out with a model imported from 3Ds max. When I use csg subtract the lighting on the new mesh looks different as if the vertices are in a different position to the original mesh. Or is it the normals.

I have reproduced it here https://www.babylonjs-playground.com/#EFXZ8U

The difference is a lot worse on the mesh I am working with. It is a lot darker after the operation.

Any help?

Thanks in advance

Link to comment
Share on other sites

Hi @Deltakosh

It does sort the lighting out but its making the curves faceted (the bottom is the original mesh)

image.thumb.png.1861301a1c8e18d6bb9f370a9b271aa0.png

This is how it looks after using subtract 

image.thumb.png.f6456d0098e68dc1a3680fb46957f803.png

I don't get how this works or if it would have any affect but when drawing normal positions they seem to be in different position and rotation on https://www.babylonjs-playground.com/#EFXZ8U#3

Link to comment
Share on other sites

Unfortunately this is not an easy one and the CSG algorithm does not help a lot. 

 

can you share a repro on the playground with only your mesh? I'll try to see how we can make sure the createNormals does not lose the smoothing

Link to comment
Share on other sites

Hi @Deltakosh

 

Please see https://www.babylonjs-playground.com/#EFXZ8U#5

You have to replace var data with below as the file was too big. Thanks.

_________________________

 

I've realised you get a different set of normals if you are using intersect depending on which mesh you intersect from.

See https://www.babylonjs-playground.com/#EFXZ8U#4

If you swap  bCSG.intersect(aCSG);for  aCSG.intersect(bCSG); The normal are ok

Link to comment
Share on other sites

Ok unfortunately this is because of the CSG :( it will separate the face and thus losing the smoothness

I have no solution for you this time (unless than digging into CSG to try to fix this behavior)

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