POV-Ray : Newsgroups : povray.general : Smooth level for smooth_triangle. : Re: Smooth level for smooth_triangle. Server Time
20 May 2024 00:02:56 EDT (-0400)
  Re: Smooth level for smooth_triangle.  
From: Bald Eagle
Date: 19 Nov 2023 12:35:00
Message: <web.655a465884c692a31f9dae3025979125@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:
> Hi all, first I apologize for my bad english.

It's fine, and you probably speak better English than many people who speak it
natively.  ;)

> I finished now developing (basic version no color at this moment)  a small
> transformation tool from STL mesh, in the center, to mesh with smooth_triangles.

Excellent.  Hopefully it was simple, can be invoked from SDL with a
pre_frame_command, and makes an .ini file with a built-in inside_vector
statement.

> But I have a problem. Too smooth. I thought that the length of the normal vector
> caused a gradation, but this is not the case, even if I reduce the length of the
> vectors the smoothness level remains the same. What am I doing wrong?

Not sure what "too smooth" means.

We would also need to see your exact code to make the smooth_triangle from the
stl triangle vertices.  That can get complicated, especially with a free-form
mesh like you're starting with.

For any given triangle, you're going to have neighboring triangles with
different face normals.  The normals of your smooth_triangle vertices should be
the average of all of the face normals that meet at that vertex.
So, you're going to have to find all of the neighboring triangles that share
common edges/vertices.

You're also going to have to have ways to handle missing triangles, edges, and
things like the edges of a cubic mesh - since on face of a cube should not
influence the normal of a separate face.

It's looking great, and anything is better than nothing!
I would suggest that you just search for calculating triangle normals, and you
ought to come up with articles and forum posts on scratchapixel.com,
gamedev.net, etc.  There's likely going to be instructional videos on YouTube
from people like Daniel Schiffman, Sebastian Lague, Martijn Steinrucken, Inigo
Quilez and a host of others.

Try rendering with a texture {} AND and interior_texture {} of contrasting color
to get a true idea of where your normals are facing.

- BW


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.