Cabochons (CabochonGeometry)

Hi community!

Picture:

Demo: https://1w41ek.csb.app/

This is an attempt to build a geometry for cabochons.
Contour: THREE.CatmullRomCurve3
Edges: THREE.Path

Prototype: https://codepen.io/prisoner849/full/VwdZGNm

14 Likes

Your sharing is always great!

this is awesome rendering, perfect for jewelry

@eze @Umbawa_Sarosong Thanks :slight_smile:

A bit of an issue right there

I guess there’s a uv/normal/tangent mispatch? Doesn’t happen on the other side of the shape

Anyway, looks really nice and slick. I love the specular highlights and how they glide across the surface when you move the camera around.

2 Likes

Yes, true :slight_smile: It’s because I’m lazy and didn’t want to spend time on calculation of indices, thus, CabochonGeometry in its base is distorted PlaneGeometry, and the place of mismatch is the seam, where edges of the plane meet.

1 Like

Added a quick fix for finding the average normal for points on the seam.

1 Like

I had noticed the problem too, but I’m not as quick to respond as the author himself. :running_man:

In my geometry examples hofk (Klaus Hoffmeister) · GitHub I had the problem more often. In the last examples I wrote myself an extra function to not have to think about it every time.


function smoothEdge( idxa, idxb ) {
    
    const v3a = new THREE.Vector3( );
    const v3b = new THREE.Vector3( );
    const v3  = new THREE.Vector3( );
    
    v3a.set( g.attributes.normal.getX( idxa ), g.attributes.normal.getY( idxa ), g.attributes.normal.getZ( idxa ) );
    v3b.set( g.attributes.normal.getX( idxb ), g.attributes.normal.getY( idxb ), g.attributes.normal.getZ( idxb ) );
    
    v3.addVectors( v3a, v3b ).normalize( );
    
    g.attributes.normal.setXYZ( idxa, v3.x, v3.y, v3.z );
    g.attributes.normal.setXYZ( idxb, v3.x, v3.y, v3.z );
    
}

Used at Curved2Geometry - a twofold curved geometry and Multi Form Geometry in a similar form.

1 Like