POV-Ray : Newsgroups : povray.general : Mesh rendering artifacts Server Time
2 Jul 2025 18:03:21 EDT (-0400)
  Mesh rendering artifacts (Message 14 to 23 of 63)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: yesbird
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 14:35:00
Message: <web.63d81b22249f0076df04b5ff10800fb2@news.povray.org>
> One of the easiest things to do when looking for "wrong" surface normals is to
> use an interior_texture {} which will color the opposite face of the triangles a
> different color.   Then you don't have to even look at the code - just look at
> the triangles in the render.

Thanks for this tip, I will check surface with it !


Post a reply to this message

From: yesbird
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 14:55:00
Message: <web.63d81f6f249f0076df04b5ff10800fb2@news.povray.org>
"yesbird" <nomail@nomail> wrote:
> > One of the easiest things to do when looking for "wrong" surface normals is to
> > use an interior_texture {} which will color the opposite face of the triangles a
> > different color.   Then you don't have to even look at the code - just look at
> > the triangles in the render.
>
> Thanks for this tip, I will check surface with it !

..... but only if I will be able. Can't figure out how to push interior_texture
into texture_list, this way is not working:

smooth_triangle {<-8.00, -8.00, -1.51>, <0.19, 0.19, 0.96>,
                 <-8.00, -7.67, -1.62>, <0.07, 0.07, 1.00>,
                 <-7.67, -7.67, -1.64>, <-0.06, -0.06, 1.00>

       #declare t1=texture { pigment {rgb<1.00, 0.66, 0.00>} finish {f} }
       #declare t2=texture { pigment {rgb<1.00, 0.61, 0.00>} finish {f} }
       #declare t3=texture { pigment {rgb<1.00, 0.61, 0.00>} finish {f} }

       #declare it1=interior_texture  { pigment {rgb<0, 0, 0>} }
       #declare it2=interior_texture  { pigment {rgb<0, 0, 0>} }
       #declare it3=interior_texture  { pigment {rgb<0, 0, 0>} }

       texture_list {t1 t2 t3}
       texture_list {it1 it2 it3}
}


Post a reply to this message

From: jr
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 15:20:00
Message: <web.63d82561249f0076fbdc16836cde94f1@news.povray.org>
hi,

"yesbird" <nomail@nomail> wrote:
> ...
>        #declare it1=interior_texture  { pigment {rgb<0, 0, 0>} }
>        #declare it2=interior_texture  { pigment {rgb<0, 0, 0>} }
>        #declare it3=interior_texture  { pigment {rgb<0, 0, 0>} }

only one interior, per mesh.  insert just before the scale.
<https://wiki.povray.org/content/Reference:Interior_Texture>


regards, jr.


Post a reply to this message

From: jr
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 15:25:00
Message: <web.63d826b9249f0076fbdc16836cde94f1@news.povray.org>
oops, forgot.  you may need to make the object "hollow", too.

> only one interior, per mesh.  insert just before the scale.
> <https://wiki.povray.org/content/Reference:Interior_Texture>

<https://wiki.povray.org/content/Reference:Hollow_Object_Modifier>


regards, jr.


Post a reply to this message

From: yesbird
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 19:00:00
Message: <web.63d8594a249f0076df04b5ff10800fb2@news.povray.org>
> only one interior, per mesh.  insert just before the scale.
> <https://wiki.povray.org/content/Reference:Interior_Texture>
Thanks, I'v checked it - normals are normal.

It's strange: flat surface looks good, oposite to peaked.


Post a reply to this message


Attachments:
Download 'surface3.png' (59 KB)

Preview of image 'surface3.png'
surface3.png


 

From: yesbird
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 19:05:00
Message: <web.63d85a46249f0076df04b5ff10800fb2@news.povray.org>
"yesbird" <nomail@nomail> wrote:
> > only one interior, per mesh.  insert just before the scale.
> > <https://wiki.povray.org/content/Reference:Interior_Texture>
> Thanks, I'v checked it - normals are normal.
Scene


Post a reply to this message


Attachments:
Download 'surface3.pov.txt' (352 KB)

From: Bald Eagle
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 19:05:00
Message: <web.63d85a77249f00761f9dae3025979125@news.povray.org>
So, I worked out my own scene, using your equation, storing the <x, f(r), z> in
a 2D array, analytically calculating the vertex normals using fast forward
differencing to get the tangents by numerically approximating the partial
derivatives, then taking the vector cross product, and then making a mesh with
smooth_triangles with per-vertex normals.

(After horribly botching that 5 times in a row, I got the normals, and therefore
the triangles all working nicely.)

No textures for any of the triangles.

mesh {
 loop over arrays to make triangles
texture {gradient y}
interior_texture
}

I get a much steeper curve than you do, so I don't know if there's some kind of
scaling going on somewhere in the process.

I hard-coded the pigment_map for the texture, but it could probably be
calculated from the HSV2RGB macro in colors.inc


Post a reply to this message


Attachments:
Download 'ripple.png' (768 KB)

Preview of image 'ripple.png'
ripple.png


 

From: yesbird
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 19:15:00
Message: <web.63d85d0e249f0076df04b5ff10800fb2@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> So, I worked out my own scene, using your equation, storing the <x, f(r), z> in
> a 2D array, analytically calculating the vertex normals using fast forward
> differencing to get the tangents by numerically approximating the partial
> derivatives, then taking the vector cross product, and then making a mesh with
> smooth_triangles with per-vertex normals.
>
> (After horribly botching that 5 times in a row, I got the normals, and therefore
> the triangles all working nicely.)
>
> No textures for any of the triangles.
>
> mesh {
>  loop over arrays to make triangles
> texture {gradient y}
> interior_texture
> }
>
> I get a much steeper curve than you do, so I don't know if there's some kind of
> scaling going on somewhere in the process.
>
> I hard-coded the pigment_map for the texture, but it could probably be
> calculated from the HSV2RGB macro in colors.inc

Looks nice and smooth ! Could you share the code, please ?
I am continue struggle with Matlab's generated data )


Post a reply to this message

From: Bald Eagle
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 19:20:00
Message: <web.63d85e82249f00761f9dae3025979125@news.povray.org>
"yesbird" <nomail@nomail> wrote:

> Thanks, I'v checked it - normals are normal.

So, I'd say that you need to check your pigments for adjacent triangles, and
make sure that your vertex normals match for all triangles that share that
vertex.

Although the normals may point in the proper "facing" direction, they may not
all be pointing in the same precise direction where neighboring triangles all
meet at a corner vertex.

The thing that I'm most concerned about at this point is that there are so many
different approaches to accomplishing something in SDL, that you may be coding a
large number of single-use cases.

If you started a new thread, and gave a broad overview of all the different
types of things that you're wanting your rendering package to do, then we could
look at it and find some commonalities and propose some more generally
applicable approaches.

Not everything translates smoothly, or well, to SDL.

So, you could write your vertices to an array, and then calculate face normals,
and use the array to make the mesh.
You could loop over the array a second time, and sum all of the normals for the
SIX faces that share (almost) every vertex (except edges), then normalize that
sum.
You could write all your vertices to an array and write the normals to an array
- but rather than overwrite shared vertex normals, add to what's already there,
then do a final pass to normalize them all, or normalize it in the triangle
normal code.

There are lots and lots of different options.

- BW


Post a reply to this message

From: Bald Eagle
Subject: Re: Mesh rendering artifacts
Date: 30 Jan 2023 19:25:00
Message: <web.63d85ec8249f00761f9dae3025979125@news.povray.org>
"yesbird" <nomail@nomail> wrote:

> Looks nice and smooth ! Could you share the code, please ?
> I am continue struggle with Matlab's generated data )

Sure - let me know if you have any questions.  I'm for nearly another 2h.


Post a reply to this message


Attachments:
Download 'ripple.pov.txt' (5 KB)

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

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