POV-Ray : Newsgroups : povray.general : "Smoothing" a mesh2 object : Re: "Smoothing" a mesh2 object Server Time
30 Jul 2024 04:10:28 EDT (-0400)
  Re: "Smoothing" a mesh2 object  
From: CShake
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.