Jump to content

How can I make a lathe shape radially smooth, but axially flat?


xiphiaz
 Share

Recommended Posts

See my example: https://www.babylonjs-playground.com/#165IV6#435

I have a lathe mesh that is a swept surface, that I want to appear smooth around the surface, but not have the vertex normals be vertically smooth (if that makes sense?). Basically without converting to flat mesh, the normals make it appear to curve around hard edges that should remain to be hard.

 

Is there a way I can update the normals to make it appear to have hard edges, but not be faceted on the cylindrical surfaces?

Link to comment
Share on other sites

  • 2 weeks later...

Awesome thanks @jerome & @Pryme8. For completeness this is what I ended up with.

 

```ts

private generateFlatLathe(name: string, shape: Vector3[]): Mesh {
  return MeshBuilder.CreateLathe(
    name,
    {
      shape: shape.reduce((duplicatedPoints, point, index, allPoints) => {
        // only duplicate the non start & end points
        index !== 0 && index < allPoints.length - 1
          ? duplicatedPoints.push(point, point)
          : duplicatedPoints.push(point);
        return duplicatedPoints;
      }, []),
    },
    this.scene
  );
}

```

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