|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
i wrote a simple triangulation algo for a noise program to generate
something like a hieghtfield, and i wanted to use this with
smooth_triangles, does anybody knows how to calculate the normals of the
three points from the known triangle?
greetings, Marcus
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 11 Sep 2002 14:02:16 +0200, Marcus Fritzsch <m### [at] fritschyde> wrote:
> does anybody knows how to calculate the normals of the
> three points from the known triangle?
It is averaged addition from normals of all triangles in this vertex.
Be aware it can be weighted with angle/area:
http://news.povray.org/povray.binaries.images/13313/
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Marcus Fritzsch <m### [at] fritschyde> wrote:
> i wrote a simple triangulation algo for a noise program to generate
> something like a hieghtfield, and i wanted to use this with
> smooth_triangles, does anybody knows how to calculate the normals of the
> three points from the known triangle?
There are basically two ways:
1. If you know the function which was used to generate the mesh and you
can derive the function with respect to x, y and z (or x and y in the
case of a heightfield function f(x,y)), then you can use the gradient
of the function (ie. <df(x,y)/dx, df(x,y)/dy>) to calculate the normal
vector at any point of the function.
2. If you don't know the function, or the function is not differentiable
(or it's just too difficult to do so), then you can use an approximation
which works quite well for (almost) any mesh: The normal vector at a vertex
point is the sum of all the normal vectors of the triangles sharing that
vertex.
(The normal vector of a triangle can be calculated with the cross-product
of two of its edges. According to empirical tests, *not* normalizing these
normals gives the best result in the sum described above (because the
dot-product of the two edges of a triangle gives a normal vector which
length is equal to the area of the triangle, and not normalizing this
vector means that a larger triangle has more effect in the normal of the
vertex than other smaller triangles sharing that same vertex, which
reportedly gives better results).)
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
this was exactly what i searched!!
Warp schrieb:
> Marcus Fritzsch <m### [at] fritschyde> wrote:
>
>>i wrote a simple triangulation algo for a noise program to generate
>>something like a hieghtfield, and i wanted to use this with
>>smooth_triangles, does anybody knows how to calculate the normals of the
>>three points from the known triangle?
> 1. If you know the function...
Hmm, i guess i don't know the function...
> 2. If you don't know the function, or the function is not differentiable
> (or it's just too difficult to do so)...
I'll try this way!
thx a lot :o)
regards, Marcus
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
>Marcus Fritzsch <m### [at] fritschyde> wrote:
>> i wrote a simple triangulation algo for a noise program to generate
>> something like a hieghtfield, and i wanted to use this with
>> smooth_triangles, does anybody knows how to calculate the normals of the
>> three points from the known triangle?
>
> There are basically two ways:
......
......
> 2. If you don't know the function, or the function is not differentiable
>(or it's just too difficult to do so), then you can use an approximation
>which works quite well for (almost) any mesh: The normal vector at a vertex
>point is the sum of all the normal vectors of the triangles sharing that
>vertex.
> (The normal vector of a triangle can be calculated with the cross-product
>of two of its edges. According to empirical tests, *not* normalizing these
>normals gives the best result in the sum described above (because the
>dot-product of the two edges of a triangle gives a normal vector which
^^^
I guess you meant to write 'cross-product' here ;)
>length is equal to the area of the triangle, and not normalizing this
>vector means that a larger triangle has more effect in the normal of the
>vertex than other smaller triangles sharing that same vertex, which
>reportedly gives better results).)
>...
Tor Olav
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi again...
Warp schrieb:
> ...
> (The normal vector of a triangle can be calculated with the cross-product
> of two of its edges. According to empirical tests, *not* normalizing these
> normals gives the best result in the sum described above (because the
> dot-product of the two edges of a triangle gives a normal vector which
> length is equal to the area of the triangle, and not normalizing this
> vector means that a larger triangle has more effect in the normal of the
> vertex than other smaller triangles sharing that same vertex, which
> reportedly gives better results).)
I have some problems with this part, first you told me about
cross-product of
the edges, than, 2 lines below of the dot-product of the 2 edges...
which one
is right? my maths aren't enough to understand this before have it used
it and
seen the result...
greetings, Marcus
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tor Olav Kristensen <tor### [at] hotmailcom> wrote:
>>dot-product of the two edges of a triangle gives a normal vector which
> ^^^
> I guess you meant to write 'cross-product' here ;)
Yes.
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Marcus Fritzsch <m### [at] fritschyde> wrote:
> I have some problems with this part, first you told me about
> cross-product of
> the edges, than, 2 lines below of the dot-product of the 2 edges...
> which one
> is right?
Writing "dot-product" was a mistake. It should have been "cross-product".
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi, :o)
Warp schrieb:
>>I have some problems with this part, first you told me about
>>cross-product of
>>the edges, than, 2 lines below of the dot-product of the 2 edges...
>>which one
>>is right?
>
>
> Writing "dot-product" was a mistake. It should have been "cross-product".
oops, i wrote my message while the other was postet... :o) ok, now i
know it, thx!
mfg Marcus
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
>...
>(because the
>dot-product of the two edges of a triangle gives a normal vector which
>length is equal to the area of the triangle,
>...
Its length is equal to twice the area of the triangle.
Tor Olav
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |