Mesh generated with ThreeCsg and problem of vertices

geometry

#1

Hello

I have a problem with the shadows of a cone to which I subtracted a smaller cone.

Example: https://codepen.io/andreamk5/pen/ddNBpp

cone lightblue -> no action
cone green -> computeVertexNormals
cone violet -> mergeVertices and computeVertexNormals

I can’t find a solution
Can someone help me?

thanks


#2

The way CylinderGeometry is generated does not allow the usage of .computeVertexNormals(). (Vertices of the caps are not shared with the torso so uv mapping works correctly).

It is normally not necessary to call .computeVertexNormals() since the normal vectors are already calculated. The default geometries in three.js are not intended for that sort of of post-processing.


#3

Thanks for the reply.

I did not understand well but I changed the approach.

I draw a section and do a circle extrusion.
The result is better but not perfect.

How should I proceed because the geometry is flat at the top and bottom but smoothed on side ?

here is the example


#4

Like i said before, what you are doing in your code is not supported by three.js's default geometries. Recalculating the normals via .computeVertexNormals() does not always produce proper results.


#5

That circle extrusion is a bit exotic approach. I’d offer to use THREE.LatheGeometry().
Well, I’ve tried it, but the result is far from ideal :slight_smile:

https://jsfiddle.net/prisoner849/vbhuw3jt/

LatheGeometry


#6

Hello
I can’t use LatheGeometry because I have to create a more complex object

I have to do this


#7

I’ve updated my jsfiddle from the previous message with the profile that you provided in the picture. It works as expected. I see no problem with using THREE.LatheGeometry() in this case.

LatheGeometry2


#8

Ok now I understand :slight_smile:

Thank you so much you helped me a lot

Last example


#9

You’re welcome :wink: