POV-Ray : Newsgroups : povray.general : Smooth level for smooth_triangle. Server Time
13 May 2024 02:19:18 EDT (-0400)
  Smooth level for smooth_triangle. (Message 11 to 20 of 56)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Bald Eagle
Subject: Re: Smooth level for smooth_triangle.
Date: 19 Nov 2023 16:00:00
Message: <web.655a765e84c692a31f9dae3025979125@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:

> sure, last night I started with two faces, then three, then a cube (bad idea),

Well, it was a good idea, because it shows you what can happen  ;)


> I was thinking, for your idea, instead of the area, which means many operations,
> finding the center of the triangle, and comparing the size of the triangles
> using the center- 1 vertex distance.
> G.

Well, you can do whatever you like, but I'm not sure how much faster it will be,
or how much better it will be.

First you have to compute the center, and then you have to pick - what - the
maximum distance to 3 vertices?  What if you have 2 triangles that share the
only a single vertex?  |X|  Which of the 2 sides on the one triangle do you use
to scale the face normal by?

If you have vertices, A, B, and C, then you have vectors (A-B) and (C-B), and
the vector cross product of those will give you a vector perpendicular to the
surface (the face normal), AND it's length will be a scalar value proportional
to the surface area of the triangle, all in a single calculation.

What I usually do when experimenting with different methods, is either use a
#switch block to choose what method I'm using, or use macros with similar names
that do things a slightly different way.
#macro Method1 ()
#macro Method2 ()
#macro Method3 ()

and then I just change the name of what macro I'm calling to do the part of the
code where I'm doing the experimentation to see what will work best / fastest.


- BW


Post a reply to this message

From: Bald Eagle
Subject: Re: Smooth level for smooth_triangle.
Date: 20 Nov 2023 14:15:00
Message: <web.655baf1e84c692a31f9dae3025979125@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:
> Hi all, first I apologize for my bad english.
> 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.
> 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?
> Thanks in advanced!
> Giovanni

Glassner, Andrew, Building Vertex Normals from an Unstructured Polygon List,
Graphics Gems IV, p. 60-73, code: p. 64-73, vert_norm/.
https://www.realtimerendering.com/resources/GraphicsGems/gemsiv/vert_norm/


Post a reply to this message

From: GioSeregni
Subject: Re: Smooth level for smooth_triangle.
Date: 20 Nov 2023 16:45:00
Message: <web.655bd2d784c692a35464b73e59126100@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "GioSeregni" <gms### [at] hotmailcom> wrote:
> > Hi all, first I apologize for my bad english.
> > 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.
> > 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?
> > Thanks in advanced!
> > Giovanni
>
> Glassner, Andrew, Building Vertex Normals from an Unstructured Polygon List,
> Graphics Gems IV, p. 60-73, code: p. 64-73, vert_norm/.
> https://www.realtimerendering.com/resources/GraphicsGems/gemsiv/vert_norm/

Thanks, but I my code with normals works fine, see my code and render pictures
above.
Furthermore, even if I am able to calculate the normals, in the binary STL files
to be converted, they are already present and available.
The question is about the level of the smooth.
I would like to get the effect of a smaller radius in the rounding illusion.
As Bald Eagle suggested I'm trying to work on the single "weight" of normals in
their average for each point  (which creates the smooth effect) , considering
the size of each triangle.
I hope I have explained myself, I have little command of English, and the
question is not very simple
Many Thanks!
G.


Post a reply to this message

From: GioSeregni
Subject: Re: Smooth level for smooth_triangle.
Date: 20 Nov 2023 16:55:00
Message: <web.655bd5a184c692a35464b73e59126100@news.povray.org>
I'm slowly clearing my head
For an excellent result the code must have at least 3 steps
1) (already done), calculation of the average of the normals affecting the
point.
2) Correcting the weight of the normals per point if they also come from
triangles with a large surface area
3) Corrective of the normals if the adjacent triangles have an inclination
between them that tends to approach 90 degrees

G.


Post a reply to this message

From: jr
Subject: Re: Smooth level for smooth_triangle.
Date: 21 Nov 2023 00:05:00
Message: <web.655c3a6384c692a3f11225116cde94f1@news.povray.org>
hi,

"GioSeregni" <gms### [at] hotmailcom> wrote:
> For an excellent result the code must have at least 3 steps
> 1) (already done), calculation of the average of the normals affecting the
> point.
> 2) Correcting the weight of the normals per point if they also come from
> triangles with a large surface area
> 3) Corrective of the normals if the adjacent triangles have an inclination
> between them that tends to approach 90 degrees

fwiw, my 'gts2pov' takes triangle area into account when calculating the
normals.  also just found mention of a 'stl2pov' software :
<https://news.povray.org/web.6156c51533af95845bd1b3ba6cde94f1%40news.povray.org>

<https://wiki.povray.org/content/User:Jr>


regards, jr.


Post a reply to this message

From: GioSeregni
Subject: Re: Smooth level for smooth_triangle.
Date: 21 Nov 2023 02:30:00
Message: <web.655c5bc784c692a35464b73e59126100@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "GioSeregni" <gms### [at] hotmailcom> wrote:
> > For an excellent result the code must have at least 3 steps
> > 1) (already done), calculation of the average of the normals affecting the
> > point.
> > 2) Correcting the weight of the normals per point if they also come from
> > triangles with a large surface area
> > 3) Corrective of the normals if the adjacent triangles have an inclination
> > between them that tends to approach 90 degrees
>
> fwiw, my 'gts2pov' takes triangle area into account when calculating the
> normals.  also just found mention of a 'stl2pov' software :
> <https://news.povray.org/web.6156c51533af95845bd1b3ba6cde94f1%40news.povray.org>
>
> <https://wiki.povray.org/content/User:Jr>
>
>
> regards, jr.

Tx JR!
My code is already working from STL to POV even with the color subset of STL.
In fact I have to add the surface calculation to the loops from triangle to
smooth_triangle, I'll take a look at your system. But first I also want to
translate the color, as I already do with the triangles, dividing groups of
differently colored meshes. This way my translator will also become faster
because the loops are compact and short on small meshes.
(between different colors I don't want smooth).
In the center STL, on the left the current smooth routine, on the right the
simple triangle mesh. Thank you!


Post a reply to this message


Attachments:
Download 'clipboard01.png' (158 KB)

Preview of image 'clipboard01.png'
clipboard01.png


 

From: Mr
Subject: Re: Smooth level for smooth_triangle.
Date: 21 Nov 2023 04:45:00
Message: <web.655c7b9b84c692a316086ed06830a892@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > hi,
> >
> > "GioSeregni" <gms### [at] hotmailcom> wrote:
> > > For an excellent result the code must have at least 3 steps
> > > 1) (already done), calculation of the average of the normals affecting the
> > > point.
> > > 2) Correcting the weight of the normals per point if they also come from
> > > triangles with a large surface area
> > > 3) Corrective of the normals if the adjacent triangles have an inclination
> > > between them that tends to approach 90 degrees
> >
> > fwiw, my 'gts2pov' takes triangle area into account when calculating the
> > normals.  also just found mention of a 'stl2pov' software :
> > <https://news.povray.org/web.6156c51533af95845bd1b3ba6cde94f1%40news.povray.org>
> >
> > <https://wiki.povray.org/content/User:Jr>
> >
> >
> > regards, jr.
>
> Tx JR!
> My code is already working from STL to POV even with the color subset of STL.
> In fact I have to add the surface calculation to the loops from triangle to
> smooth_triangle, I'll take a look at your system. But first I also want to
> translate the color, as I already do with the triangles, dividing groups of
> differently colored meshes. This way my translator will also become faster
> because the loops are compact and short on small meshes.
> (between different colors I don't want smooth).
> In the center STL, on the left the current smooth routine, on the right the
> simple triangle mesh. Thank you!

I May be wrong but I don't believe the normals length will be taken into account
at all. I believe they are rather always 'normalized' (no pun) to a value of 1
and just their directions used. Some of the most valuable input may be from
Alain with all his technical POV knowledge. the only things that then would
change the apparent curvature of normals *globally* is the 'brilliance' keyword
value or more locally the slope normal pattern... but again all this needs to be
verified.


Post a reply to this message

From: jr
Subject: Re: Smooth level for smooth_triangle.
Date: 21 Nov 2023 05:30:00
Message: <web.655c869e84c692a3f11225116cde94f1@news.povray.org>
hi,

"GioSeregni" <gms### [at] hotmailcom> wrote:
> ...
> Tx JR!

welcome.  a visual to compare, the mesh is from the GTS home site.
<https://news.povray.org/web.610401e9687fa6155e0fed26cde94f1%40news.povray.org>


> My code is already working from STL to POV even with the color subset of STL.

ah, colour is something I ought to look into, too.  cheers.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: Smooth level for smooth_triangle.
Date: 21 Nov 2023 06:45:00
Message: <web.655c978784c692a31f9dae3025979125@news.povray.org>
I tried a search of the NG to see what else there might be, these were the only
2 so far to catch my eye.

Maybe some small thing in there might trigger an idea, yet untested.

Warp:
https://news.povray.org/3cd536d5%40news.povray.org

jceddy:
http://news.povray.org/povray.general/thread/%3Cweb.442a6fe16260549766ffc7a50@news.povray.org%3E/

- BW


Post a reply to this message

From: GioSeregni
Subject: Re: Smooth level for smooth_triangle.
Date: 21 Nov 2023 08:25:00
Message: <web.655caf7584c692a35464b73e59126100@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> I tried a search of the NG to see what else there might be, these were the only
> 2 so far to catch my eye.
>
> Maybe some small thing in there might trigger an idea, yet untested.
>
> Warp:
> https://news.povray.org/3cd536d5%40news.povray.org
>
> jceddy:
>
http://news.povray.org/povray.general/thread/%3Cweb.442a6fe16260549766ffc7a50@news.povray.org%3E/
>
> - BW

Tx Jr and BW for the links, I use exactly the average..
warning about colors in STL
They aren't true color
I use this code by STL (subset of colors)  to POV (truecolor)

r=STLface.descriptor AND 31744
r=r SHR 10
r=r*8
g=STLface.descriptor AND 992
g=g SHR 5
g=g*8
b=STLface.descriptor AND 31
b=b*8
POV_COLOR=b+(g*256)+(r*65536)

NOTE: this is my struct for STL's face

TYPE STL
 header    As String * 80
 numfacets As Long  '4 b then -> loop
 nx        As Single   '4 b
 ny        As Single
 nz        As Single
 x0        As Single
 y0        AS Single
 z0        As Single
 x1        As Single
 y1        As Single
 z1        As Single
 x2        As Single
 y2        As Single
 z2        As Single
 descriptor As Short '2 b <--- end loop
END TYPE
DIM STLface AS STL


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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