POV-Ray : Newsgroups : povray.news-submissions : Pov-Ray With Subdivision available Server Time
28 Mar 2024 21:02:41 EDT (-0400)
  Pov-Ray With Subdivision available (Message 1 to 6 of 6)  
From: Xiaobin Wu
Subject: Pov-Ray With Subdivision available
Date: 11 May 2004 18:07:08
Message: <40a14e8c@news.povray.org>
During one of my research projects, I needed to quickly create the
ray-tracing images of subdivision surfaces. What I did is to subdivide
the object offline and import the subdivided surface into Pov-Ray,
which of course led to huge pov-ray files.

I found it extremely convenient to have the mesh2 object directly support
the subdivision algorithms. So I and another student (Jianhua Fan) spent
some
time to expand the mesh2 object so that it can be directly used to
generate smooth subdivision surfaces.

The new syntax would be:
   mesh2 {
        subdivision {
             substeps n              // n= steps of subdivision
             flatshading              // optional flag to set flat shading
        }

       vertex_list ...
       ...
   }

Anyway, the examples and new executable can be downloaded from

  http://www.cise.ufl.edu/~xwu/Pov-Sub

This is different to SSS from Mr. John VanSickle in that this doesn't
require
rewriting the existing mesh2 object. If the original scene is built using
mesh2,
it will take a minute to generate a scene with subdivided meshes.

Comments and suggestions are welcome.
-
Xiaobin Wu
xwu### [at] ciseufledu


Post a reply to this message

From: Christoph Hormann
Subject: Re: Pov-Ray With Subdivision available
Date: 11 May 2004 18:40:02
Message: <c7rkne$4ui$1@chho.imagico.de>
Xiaobin Wu wrote:
> During one of my research projects, I needed to quickly create the
> ray-tracing images of subdivision surfaces. What I did is to subdivide
> the object offline and import the subdivided surface into Pov-Ray,
> which of course led to huge pov-ray files.
> 
> I found it extremely convenient to have the mesh2 object directly support
> the subdivision algorithms. So I and another student (Jianhua Fan) spent
> some
> time to expand the mesh2 object so that it can be directly used to
> generate smooth subdivision surfaces.
> 
> The new syntax would be:
>    mesh2 {
>         subdivision {
>              substeps n              // n= steps of subdivision
>              flatshading              // optional flag to set flat shading
>         }
> 
>        vertex_list ...
>        ...
>    }
> 
> Anyway, the examples and new executable can be downloaded from
> 
>   http://www.cise.ufl.edu/~xwu/Pov-Sub

The source would be important to evaluate your patch.  Concerning the 
syntax - 'flatshading' is a bad choice for the keyword - a simple 
'smooth' would be more descriptive and already exists from heightfields.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 01 May. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: jms
Subject: Re: Pov-Ray With Subdivision available
Date: 12 May 2004 11:19:55
Message: <40a2409b@news.povray.org>
Xiaobin Wu wrote:

> During one of my research projects, I needed to quickly create the
> ray-tracing images of subdivision surfaces. What I did is to subdivide
> the object offline and import the subdivided surface into Pov-Ray,
> which of course led to huge pov-ray files.
> 
> I found it extremely convenient to have the mesh2 object directly support
> the subdivision algorithms. So I and another student (Jianhua Fan) spent
> some
> time to expand the mesh2 object so that it can be directly used to
> generate smooth subdivision surfaces.
> 
> The new syntax would be:
>    mesh2 {
>         subdivision {
>              substeps n              // n= steps of subdivision
>              flatshading              // optional flag to set flat shading
>         }
> 
>        vertex_list ...
>        ...
>    }
> 
> Anyway, the examples and new executable can be downloaded from
> 
>   http://www.cise.ufl.edu/~xwu/Pov-Sub
> 
> This is different to SSS from Mr. John VanSickle in that this doesn't
> require
> rewriting the existing mesh2 object. If the original scene is built using
> mesh2,
> it will take a minute to generate a scene with subdivided meshes.
> 
> Comments and suggestions are welcome.
> -
> Xiaobin Wu
> xwu### [at] ciseufledu
> 
> 

hi,

I did a test under win98/win2000pro and the return is always:
"out of memory : cannot allocate - 304 bytes for triangle mesh data".
For just two triangles without anything else nor texture, nor normal
indices.


-- 
@+
jms - http://jmsoler.free.fr


Post a reply to this message

From: Xiaobin Wu
Subject: Re: Pov-Ray With Subdivision available
Date: 12 May 2004 18:43:01
Message: <40a2a875$1@news.povray.org>
First of all, thanks to all that responded or tested my patch.

I have posted the modified source. There are five files modified:
tokenize.cpp, mesh.h, mesh.cpp, parse.h, parse.cpp
( I want to thank Andrew for testing it under Linux. )
Also I wish the code is only used in Pov-Ray community. If you need
to use it for something else, please let me know beforehand.

Here are a few things that I have fixed/changed according to the feedback:

1.   Fixed a problem that leads to slower rendering of un-subdivided meshes.
     (Thanks, Mika)

> Christoph wrote:
>
> Concerning the  syntax - 'flatshading' is a bad choice for the keyword - a
simple
> 'smooth' would be more descriptive and already exists from heightfields.
>

2.  The syntax to switch on flat shading is changed to "smooth off" from
"flatshading".
     Christoph is right, and I do like "smooth" better. But I want the
default to be smooth
     shaded, so you will need to add an "off" to switch on flat shading.

3.   Removed the restriction on the maximum valence of the vertices. (Thanks
Kristof).

> Jms wrote:
> I did a test under win98/win2000pro and the return is always:
> "out of memory : cannot allocate - 304 bytes for triangle mesh data".
> For just two triangles without anything else nor texture, nor normal
> indices.

4.   This problem is a little bit more complex. When you subdivide an object
     with open boundary, the behavior of the faces on the boundary is not
well-defined.
     The strategy that I used is to simply discard those new boundary faces.

    What happened to the two triangle cases is that there is no more faces
left after
    1-step subdivision.

    I fixed the memory allocation error and spit out a warning instead when
the similar case happens.
    The object will disappear naturally.

    Eventually one would like to have other strategies on the boundary. But
that is on currently
    Wish List.  For more information about this issue, please refer to
papers such as:

      *Towards Hardware Implemention of Loop Subdivision*
      by S. Bischoff, L. Kobbelt and H-P. Seidel.
     in Proceedings of the 2000 SIGGRAPH/EUROGRAPHICS  Workshop on Graphics
Hardware


The newest version is called 0.01b.

Xiaobin


Post a reply to this message

From: John VanSickle
Subject: Re: Pov-Ray With Subdivision available
Date: 12 May 2004 19:51:01
Message: <40A2B85E.F1B90624@hotmail.com>
Xiaobin Wu wrote:
> 
> 4.   This problem is a little bit more complex. When you subdivide an object
>      with open boundary, the behavior of the faces on the boundary is not
> well-defined.
>      The strategy that I used is to simply discard those new boundary faces.
> 
>     What happened to the two triangle cases is that there is no more faces
> left after
>     1-step subdivision.
> 
>     I fixed the memory allocation error and spit out a warning instead when
> the similar case happens.
>     The object will disappear naturally.
> 
>     Eventually one would like to have other strategies on the boundary. But
> that is on currently
>     Wish List.

If you look at the current version of the SSS macros, you'll find ways to
implement border faces.  It's not very difficult.

  http://enphilistor.users4.50megs.com/nsss.htm

If the user has supplied normals, you can use that information to identify
the creases, and support that feature as well.

Regards,
John


Post a reply to this message

From: Christoph Hormann
Subject: Re: Pov-Ray With Subdivision available
Date: 13 May 2004 03:00:02
Message: <c7v675$29l$1@chho.imagico.de>
Xiaobin Wu wrote:
> First of all, thanks to all that responded or tested my patch.
> 
> I have posted the modified source. There are five files modified:
> tokenize.cpp, mesh.h, mesh.cpp, parse.h, parse.cpp
> ( I want to thank Andrew for testing it under Linux. )
> Also I wish the code is only used in Pov-Ray community. 

Thanks for the code, a first glance at the code revealed the following 
things:

- you seem to discard any normal vectors specified for the mesh - this 
might often not be what the user wants and more important using the 
normal vectors could save you quite some computations (i.e. determining 
the neighbouring triangles).

- i can't find a reason why it should only work for mesh2 and not mesh.

Please use the follow-up i set for this posting, the news-submissions 
group is not for discussion.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 01 May. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

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