 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> What is your XY grid resolution for that mesh ?
50x50:
....
t = linspace (-8, 8, 50);
[x, y] = meshgrid (t, t);
r = sqrt (x .^ 2 + y .^ 2) + eps;
z = 18 * sin (r) ./ r;
s = surf(x,y,z, FaceColor = 'interp', EdgeColor = 'interp');
....
>
> How are you calculating the vertex normals and the vertex colors ?
>
Matlab do it for me)
> - And have you been careful to have the same clockwise or anticlockwise
> order of the vertices in all the triangles?
I will check it, thanks.
> If the problem persists after making sure that everything else is ok,
> you can try to divide each quadrilateral into two triangles along it's
> shortest diagonal. Alternatively you can divide it into two triangles
> according to which of the two ways of doing it deviates less from the
> surface (e.g. at the center of the quadrilateral).
May be it will help, but for this method I would like to stay sticked to
Matlab's generated geometry. Little bit late I will implement method that
completely replace 'surf' with POV-only techiques. I am sure, that it will work
much faster, et least.
Present implementation was only the first experiment, which helps me to start
working with POV and explore Matlab's geometry structures.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> What is your XY grid resolution for that mesh ?
50x50:
....
t = linspace (-8, 8, 50);
[x, y] = meshgrid (t, t);
r = sqrt (x .^ 2 + y .^ 2) + eps;
z = 18 * sin (r) ./ r;
s = surf(x,y,z, FaceColor = 'interp', EdgeColor = 'interp');
....
>
> How are you calculating the vertex normals and the vertex colors ?
>
Matlab do it for me)
> - And have you been careful to have the same clockwise or anticlockwise
> order of the vertices in all the triangles?
I will check it, thanks.
> If the problem persists after making sure that everything else is ok,
> you can try to divide each quadrilateral into two triangles along it's
> shortest diagonal. Alternatively you can divide it into two triangles
> according to which of the two ways of doing it deviates less from the
> surface (e.g. at the center of the quadrilateral).
May be it will help, but for this method I would like to stay sticked to
Matlab's generated geometry. Little bit late I will implement method that
completely replace 'surf' with POV-only techiques. I am sure, that it will work
much faster, et least.
Present implementation was only the first experiment, which helps me to start
working with POV and explore Matlab's geometry structures.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"yesbird" <nomail@nomail> wrote:
> I will play with vertex order as Tor suggested, but please take into account
> that effect is mostly visible on high elevation (along the vertical axis).
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.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |