POV-Ray : Newsgroups : povray.advanced-users : In a mesh(triangle to smooth_traingle) Server Time
3 Jul 2024 05:48:31 EDT (-0400)
  In a mesh(triangle to smooth_traingle) (Message 1 to 10 of 10)  
From: here I am
Subject: In a mesh(triangle to smooth_traingle)
Date: 12 Feb 2008 00:20:00
Message: <web.47b12bbde548e1f33e2740f70@news.povray.org>
Hey everybody!

I am in the middle of a project, where i have to do smooth shading from a scene
file of 15000 triangles which have thge data as triangles rather that having in
smooth_traingle.And since the number of triangles is very large I simple can't
calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
smooth_triangle for every triangle

And I am not sure how to implement this thing with a function or something.
SO plz help me out here.

Thanks.


Post a reply to this message

From: Jan Dvorak
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 12 Feb 2008 01:10:58
Message: <47b13872@news.povray.org>
here_I_am napsal(a):
> Hey everybody!
> 
> I am in the middle of a project, where i have to do smooth shading from a scene
> file of 15000 triangles which have thge data as triangles rather that having in
> smooth_traingle.And since the number of triangles is very large I simple can't
> calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
> smooth_triangle for every triangle
either you can or you don't have to ;-)


Post a reply to this message

From: here I am
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 12 Feb 2008 05:30:00
Message: <web.47b1745efa7126197b1612e30@news.povray.org>
Jan Dvorak <jan### [at] centrumcz> wrote:
> here_I_am napsal(a):
> > Hey everybody!
> >
> > I am in the middle of a project, where i have to do smooth shading from a scene
> > file of 15000 triangles which have thge data as triangles rather that having in
> > smooth_traingle.And since the number of triangles is very large I simple can't
> > calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
> > smooth_triangle for every triangle
> either you can or you don't have to ;-)


yeah! I don't have :)
So could you please suggest something here??


Post a reply to this message

From: Le Forgeron
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 12 Feb 2008 12:40:46
Message: <47b1da1e$1@news.povray.org>
Le Tue, 12 Feb 2008 05:26:38 -0500, here_I_am a modifié des petits
morceaux de l'univers pour nous faire lire :

> Jan Dvorak <jan### [at] centrumcz> wrote:
>> here_I_am napsal(a):
>> > Hey everybody!
>> >
>> > I am in the middle of a project, where i have to do smooth shading
>> > from a scene file of 15000 triangles which have thge data as
>> > triangles rather that having in smooth_traingle.And since the number
>> > of triangles is very large I simple can't calculate
>> > vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
>> > smooth_triangle for every triangle
>> either you can or you don't have to ;-)
> 
> 
> yeah! I don't have :)
> So could you please suggest something here??

If all you want is a smooth_triangle with a normal at the vertex which is 
the true normal, there is little point at using the smooth_triangle at 
all.

Smooth_triangle are for faking the normals... which means you need more 
than vnormalize(vcross(v1-v2,v3-v2)) to gain from its usage.

A long long time ago in another galaxy (nope, in 3.1g), I did a patch 
which smooth a mesh (averaging the normal at a vertex using the various 
normals at this vertex... weight of each normal could be :
 - identical for each normal
 - proportional to the angle of the triangle
 - proportional to the product of the lengths meeting at the vertex
 - proportional to the surface of the triangle

There is no absolute good weighting.)

See it here: (in french)
http://jgrimbert.free.fr/pov/patch/tessel/smooth.html


Post a reply to this message

From: Jim Charter
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 12 Feb 2008 12:46:23
Message: <47b1db6f@news.povray.org>
here_I_am wrote:
> Jan Dvorak <jan### [at] centrumcz> wrote:
> 
>>here_I_am napsal(a):
>>
>>>Hey everybody!
>>>
>>>I am in the middle of a project, where i have to do smooth shading from a scene
>>>file of 15000 triangles which have thge data as triangles rather that having in
>>>smooth_traingle.And since the number of triangles is very large I simple can't
>>>calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
>>>smooth_triangle for every triangle
>>
>>either you can or you don't have to ;-)
> 
> 
> 
> yeah! I don't have :)
> So could you please suggest something here??
> 
It's a little puzzling, if you know how to derive the normal then you 
must realize that you have to reparse the data somehow. You could 
probably get pov to do it but it will probably require that you edit the 
data externally such that there is a single triangle per line.

Its a little bit trickier than you suggest though because you have to 
grab all the triangles containing a given vertex and average the 
cross-product from each triangle.  So I think there would be some 
intermediate steps involved. I think you would have to produce a list of 
vertices and a corresponding list of triangles referencing the vertex 
list. Then produce a list of normals calculated for each vertex. For 
each vertex you would have to retrieve all the triangles containing it. 
Finally rewrite the sdl for smooth_triangles now contructed with 
vertex-normal pairs.


It would might be easier to do it in some other external scripting 
language with flexible string manipulation abilities.  I found Python 
very easy to learn.


Post a reply to this message

From: Jim Charter
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 12 Feb 2008 12:51:19
Message: <47b1dc97$1@news.povray.org>
Jim Charter wrote:
Actually, now that I think of it, I think Warp once published a program 
which converted mesh, maybe even to and from mesh and mesh2.


Post a reply to this message

From: stbenge
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 13 Feb 2008 14:28:10
Message: <47b344ca@news.povray.org>
here_I_am wrote:
> Hey everybody!
> 
> I am in the middle of a project, where i have to do smooth shading from a scene
> file of 15000 triangles which have thge data as triangles rather that having in
> smooth_traingle.And since the number of triangles is very large I simple can't
> calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
> smooth_triangle for every triangle
> 
> And I am not sure how to implement this thing with a function or something.
> SO plz help me out here.
> 
> Thanks.

These guys mean well, but they go off on a slight tangent sometimes :)

You want something easy, right? I've got two solutions for you:

1) PoseRay
You can import a basic mesh (even POV format, evidently), add smoothing 
to it, and export it to POV.
http://mysite.verizon.net/sfg0000/

2) POV-Sub
Download POV-Sub for POV-Ray version 3.6. You can apply smoothing to 
your mesh directly in POV, without actually subdividing it.
http://www.cise.ufl.edu/~xwu/Pov-Sub/

Good luck!

Sam


Post a reply to this message

From: here I am
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 15 Feb 2008 08:00:00
Message: <web.47b58bfcfa7126192f1170d20@news.povray.org>
stbenge <stb### [at] hotmailcom> wrote:
> here_I_am wrote:
> > Hey everybody!
> >
> > I am in the middle of a project, where i have to do smooth shading from a scene
> > file of 15000 triangles which have thge data as triangles rather that having in
> > smooth_traingle.And since the number of triangles is very large I simple can't
> > calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
> > smooth_triangle for every triangle
> >
> > And I am not sure how to implement this thing with a function or something.
> > SO plz help me out here.
> >
> > Thanks.
>
> These guys mean well, but they go off on a slight tangent sometimes :)
>
> You want something easy, right? I've got two solutions for you:
>
> 1) PoseRay
> You can import a basic mesh (even POV format, evidently), add smoothing
> to it, and export it to POV.
> http://mysite.verizon.net/sfg0000/
>
> 2) POV-Sub
> Download POV-Sub for POV-Ray version 3.6. You can apply smoothing to
> your mesh directly in POV, without actually subdividing it.
> http://www.cise.ufl.edu/~xwu/Pov-Sub/
>
> Good luck!
>
> Sam


Hey thanks everybody...PoseRay worked well for me. :)

But I have this little doubt...actually I did modified my scene file in
Java.What I did was...I had all the vertices for all the triangles so I
calculated normal for each triangle..and used the same normal for all the
vertices for this semantics.... smooth_triangle{ v1,n,v2,n,v3,n}
I thought this should have been worked but it didn't..So could you please
explain this to me..why this didnt worked??


Post a reply to this message

From: Alain
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 15 Feb 2008 16:42:05
Message: <47b6072d$1@news.povray.org>
here_I_am nous apporta ses lumieres en ce 2008/02/15 07:57:
> stbenge <stb### [at] hotmailcom> wrote:
>> here_I_am wrote:
>>> Hey everybody!
>>>
>>> I am in the middle of a project, where i have to do smooth shading from a scene
>>> file of 15000 triangles which have thge data as triangles rather that having in
>>> smooth_traingle.And since the number of triangles is very large I simple can't
>>> calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
>>> smooth_triangle for every triangle
>>>
>>> And I am not sure how to implement this thing with a function or something.
>>> SO plz help me out here.
>>>
>>> Thanks.
>> These guys mean well, but they go off on a slight tangent sometimes :)
>>
>> You want something easy, right? I've got two solutions for you:
>>
>> 1) PoseRay
>> You can import a basic mesh (even POV format, evidently), add smoothing
>> to it, and export it to POV.
>> http://mysite.verizon.net/sfg0000/
>>
>> 2) POV-Sub
>> Download POV-Sub for POV-Ray version 3.6. You can apply smoothing to
>> your mesh directly in POV, without actually subdividing it.
>> http://www.cise.ufl.edu/~xwu/Pov-Sub/
>>
>> Good luck!
>>
>> Sam
> 
> 
> Hey thanks everybody...PoseRay worked well for me. :)
> 
> But I have this little doubt...actually I did modified my scene file in
> Java.What I did was...I had all the vertices for all the triangles so I
> calculated normal for each triangle..and used the same normal for all the
> vertices for this semantics.... smooth_triangle{ v1,n,v2,n,v3,n}
> I thought this should have been worked but it didn't..So could you please
> explain this to me..why this didnt worked??
> 
> 
> 
> 
The way you put it, all the normals are the same, resulting in a flat aspect.

It should be:
smooth_triangle{ v1,n1,v2,n2,v3,n3}

-- 
Alain
-------------------------------------------------
I love you not because of who you are, but because of who I am when I am with you..


Post a reply to this message

From: here I am
Subject: Re: In a mesh(triangle to smooth_traingle)
Date: 17 Feb 2008 05:10:01
Message: <web.47b807a8fa712619b61821680@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> here_I_am nous apporta ses lumieres en ce 2008/02/15 07:57:
> > stbenge <stb### [at] hotmailcom> wrote:
> >> here_I_am wrote:
> >>> Hey everybody!
> >>>
> >>> I am in the middle of a project, where i have to do smooth shading from a scene
> >>> file of 15000 triangles which have thge data as triangles rather that having in
> >>> smooth_traingle.And since the number of triangles is very large I simple can't
> >>> calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
> >>> smooth_triangle for every triangle
> >>>
> >>> And I am not sure how to implement this thing with a function or something.
> >>> SO plz help me out here.
> >>>
> >>> Thanks.
> >> These guys mean well, but they go off on a slight tangent sometimes :)
> >>
> >> You want something easy, right? I've got two solutions for you:
> >>
> >> 1) PoseRay
> >> You can import a basic mesh (even POV format, evidently), add smoothing
> >> to it, and export it to POV.
> >> http://mysite.verizon.net/sfg0000/
> >>
> >> 2) POV-Sub
> >> Download POV-Sub for POV-Ray version 3.6. You can apply smoothing to
> >> your mesh directly in POV, without actually subdividing it.
> >> http://www.cise.ufl.edu/~xwu/Pov-Sub/
> >>
> >> Good luck!
> >>
> >> Sam
> >
> >
> > Hey thanks everybody...PoseRay worked well for me. :)
> >
> > But I have this little doubt...actually I did modified my scene file in
> > Java.What I did was...I had all the vertices for all the triangles so I
> > calculated normal for each triangle..and used the same normal for all the
> > vertices for this semantics.... smooth_triangle{ v1,n,v2,n,v3,n}
> > I thought this should have been worked but it didn't..So could you please
> > explain this to me..why this didnt worked??
> >
> >
> >
> >
> The way you put it, all the normals are the same, resulting in a flat aspect.
>
> It should be:
> smooth_triangle{ v1,n1,v2,n2,v3,n3}
>
> --
> Alain
> -------------------------------------------------
> I love you not because of who you are, but because of who I am when I am with you..

Thanx Alain and everybody :)


Post a reply to this message

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