POV-Ray : Newsgroups : povray.general : "Smoothing" a mesh2 object Server Time
26 Nov 2024 22:40:07 EST (-0500)
  "Smoothing" a mesh2 object (Message 1 to 7 of 7)  
From: Inquisitor
Subject: "Smoothing" a mesh2 object
Date: 25 Sep 2009 13:30:01
Message: <web.4abcfd29b8262dab182abe670@news.povray.org>
I am using a height_field to generate an island out in the water.  The

facets just blend away.  I was also using a height_field for the ocean generated


Unfortunately, for other reasons, I converted the ocean to use a mesh2 object.



Is there some way of smoothing the facets of a mesh2 object without having to
calculate all the normals of each facet and then averaging them at each point?
Obviously there is code in POVRay already since its used for smoothing the
height_field.  Is there some other way to apply it to the mesh2 object?

Thanks


Post a reply to this message

From: mone
Subject: Re: "Smoothing" a mesh2 object
Date: 25 Sep 2009 17:30:01
Message: <web.4abd363ecd70e16b96d7ef40@news.povray.org>
"Inquisitor" <dec### [at] sybasecom> wrote:
> I am using a height_field to generate an island out in the water.  The

> facets just blend away.  I was also using a height_field for the ocean generated

>
> Unfortunately, for other reasons, I converted the ocean to use a mesh2 object.


>
> Is there some way of smoothing the facets of a mesh2 object without having to
> calculate all the normals of each facet and then averaging them at each point?
> Obviously there is code in POVRay already since its used for smoothing the
> height_field.  Is there some other way to apply it to the mesh2 object?
>
> Thanks


I don't know if this is of any help in your case, but to smooth any mesh objects
I always use the freeware program poseray http://mysite.verizon.net/sfg0000/ and
then import the generated include file to POV-Ray. Huge files, but very good
results.


Post a reply to this message

From: Inquisitor
Subject: Re: "Smoothing" a mesh2 object
Date: 2 Oct 2009 14:30:00
Message: <web.4ac64668cd70e16182abe670@news.povray.org>
"mone" <mon### [at] alienenterprisesde> wrote:
> "Inquisitor" <dec### [at] sybasecom> wrote:
> I don't know if this is of any help in your case, but to smooth any mesh objects
> I always use the freeware program poseray http://mysite.verizon.net/sfg0000/ and
> then import the generated include file to POV-Ray. Huge files, but very good
> results.

I was hoping for something either built into POVRay or a script to handle it.  I
need it to be a more automated process.  Unfortunately, I'm doing this for a
video and the current (un smoothed) mesh is calculated for every frame for
multiple "wave trains" from multiple directions.  So generating the mesh and
then exporting the data to be process and then reloaded would make a month long
rendering into a year long rendering.

But thanks... at least it confirms that it wasn't built in and I was just
overlooking something obvious.  I guess, I'll just have to do the vector math in
the script from scratch.  Just a little disappointing that POV-Ray does it...
just not exposing it on Mesh or Mesh2 as an option.


Post a reply to this message

From: Reactor
Subject: Re: "Smoothing" a mesh2 object
Date: 3 Oct 2009 04:50:00
Message: <web.4ac70f71cd70e167f60427b0@news.povray.org>
"Inquisitor" <dec### [at] sybasecom> wrote:
> "mone" <mon### [at] alienenterprisesde> wrote:
> > "Inquisitor" <dec### [at] sybasecom> wrote:
> > I don't know if this is of any help in your case, but to smooth any mesh objects
> > I always use the freeware program poseray http://mysite.verizon.net/sfg0000/ and
> > then import the generated include file to POV-Ray. Huge files, but very good
> > results.
>
> I was hoping for something either built into POVRay or a script to handle it.

There is the subdivision patch of POV 3.6 here:
http://www.cise.ufl.edu/~xwu/Pov-Sub/
I've used it quite a bit with Wings3D models, and it works well, and quickly
too.

> I need it to be a more automated process.  Unfortunately, I'm doing this for a
> video and the current (un smoothed) mesh is calculated for every frame for
> multiple "wave trains" from multiple directions.  So generating the mesh and
> then exporting the data to be process and then reloaded would make a month long
> rendering into a year long rendering.

Wait... wouldn't pre-generating it (externally), then loading it be faster?  If
you are calculating it directly in POV using functions and macros, native code
would likely be *many* times faster.


> But thanks... at least it confirms that it wasn't built in and I was just
> overlooking something obvious.  I guess, I'll just have to do the vector math in
> the script from scratch.  Just a little disappointing that POV-Ray does it...
> just not exposing it on Mesh or Mesh2 as an option.

If the functions are in POV, can this be done using the isosurface object?  With
the correct bounding shape, isosurfaces with smallish gradients render pretty
quickly.


-Reactor


Post a reply to this message

From: clipka
Subject: Re: "Smoothing" a mesh2 object
Date: 3 Oct 2009 11:53:32
Message: <4ac7737c$1@news.povray.org>
Inquisitor schrieb:

> But thanks... at least it confirms that it wasn't built in and I was just
> overlooking something obvious.  I guess, I'll just have to do the vector math in
> the script from scratch.  Just a little disappointing that POV-Ray does it...
> just not exposing it on Mesh or Mesh2 as an option.

POV-Ray does it for /height fields/, but those are totally different 
animals. Normal computations for height fields are not performed in the 
"mesh domain" (in fact height fields are not even represented as meshes 
internally), but in the "image domain" (based on the value differences 
between adjacent pixels), which obviously is impossible to apply to meshes.


Post a reply to this message

From: Le Forgeron
Subject: Re: "Smoothing" a mesh2 object
Date: 4 Oct 2009 04:22:02
Message: <4ac85b2a$1@news.povray.org>
Le 02/10/2009 20:28, Inquisitor nous fit lire :

> I was hoping for something either built into POVRay or a script to handle it.  I
> need it to be a more automated process.  Unfortunately, I'm doing this for a
> video and the current (un smoothed) mesh is calculated for every frame for
> multiple "wave trains" from multiple directions.  So generating the mesh and
> then exporting the data to be process and then reloaded would make a month long
> rendering into a year long rendering.
> 
> But thanks... at least it confirms that it wasn't built in and I was just
> overlooking something obvious.  I guess, I'll just have to do the vector math in
> the script from scratch.  Just a little disappointing that POV-Ray does it...
> just not exposing it on Mesh or Mesh2 as an option.
> 
If you are open to patch, have a look

at http://jgrimbert.free.fr/pov/patch/tessel/index.html

especially the smooth object.


Post a reply to this message

From: CShake
Subject: Re: "Smoothing" a mesh2 object
Date: 9 Nov 2009 23:48:26
Message: <4af8f09a$1@news.povray.org>
Inquisitor wrote:
> I was hoping for something either built into POVRay or a script to handle it.  I
> need it to be a more automated process.  Unfortunately, I'm doing this for a
> video and the current (un smoothed) mesh is calculated for every frame for
> multiple "wave trains" from multiple directions.  So generating the mesh and
> then exporting the data to be process and then reloaded would make a month long
> rendering into a year long rendering.
> 
> But thanks... at least it confirms that it wasn't built in and I was just
> overlooking something obvious.  I guess, I'll just have to do the vector math in
> the script from scratch.  Just a little disappointing that POV-Ray does it...
> just not exposing it on Mesh or Mesh2 as an option.
> 

I see that you've already found responses here, but I recently had a 
similar problem with a .pov exporter from Milkshape3D incorrectly 
handling smoothing of the mesh object. It would generate a single normal 
vector for each triangle instead of per vertex, which then wouldn't 
smooth anything in pov. For this problem I was able to write a .php 
script that reads the .pov file (or any string passed to the function, 
doing smaller groups at a time increases total speed) and will modify 
(average) the normal vectors for shared vertices to correctly smooth the 
object.

I set it up to smooth anything within a maximum specified angle (usually 
set to 90 degrees or so), and it can handle multiple sets of locally 
smooth points that are at the same location (where sharp edges are 
intended). If your pov file is set up this way, where the mesh is 
defined as lots of smooth_triangle{} patches, I'd be happy to share this 
script. If it is set up as a group of triangle{} patches, then I think 
it would be possible to generate a normal vector and do the same thing, 
possibly in two passes though (assuming the triangles have vertices 
specified in a counterclockwise direction).
Another note is that the way I set this up requires that each vector for 
the triangle vertices needs to be identical (same string representation, 
not just numerically equivalent), but again with more work that could be 
fixed.

Feel free to send me an email at this address if you would like this 
script (that goes for anyone), I'm not posting it just now to the 
newsgroups because it's a bit of a hack and isn't pretty or optimized yet.

CShake


Post a reply to this message

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