POV-Ray : Newsgroups : povray.binaries.images : subdivision Server Time
14 Nov 2024 16:26:53 EST (-0500)
  subdivision (Message 1 to 2 of 2)  
From: Zeger Knaepen
Subject: subdivision
Date: 19 Mar 2009 18:31:18
Message: <49c2c7b6@news.povray.org>
This is something I made a long time ago (incidentally for my newest version 
of the Millennium Falcon, which is about as finished as my plans to conquer 
the world.. With that difference that I do plan to complete the Falcon one 
day :)).
It's a collection of subdivision-macros, but they don't work in the usual 
subdivision-like way.  Most subdivision-systems smooth the object to where 
the original shape is barely recognizable.  My macros try to recreate the 
intended shape.

So, for example: in the top-left of the image you have a very crude cylinder 
(bottom-left is the version with normal triangles instead of 
smooth_triangles).  Most subdivision-systems would create a cylinder-shaped 
object with a radius far less than what the original cylinder seemed to be, 
my subdivision-system subdivides the triangles creating the objects in the 
top-right (smooth_triangle) and bottom-right (triangle).

The way this is done, is by recursively subdividing a patch (a quad or a 
triangle) in 4 (or 3 for a triangle) sub-patches (or in the case of the 
image: in 2 sub-patches, since there was no need for 4 sub-patches).
Maybe some ascii-art will help me explain it :)

A quad has 4 points:

P1-------P2
 |        |
 |        |
P3-------P4

Every point has a normal, N1 to N4.  The macro tries to find points/normals 
P12/N12, P13/N13, P24/N24, P34/N34 and P1234/N1234

P1----P12----P2
 |     |      |
P13--P1234--P24
 |     |      |
P3----P34----P4

so that P1, P12 and P2 are on the a ellipse where the normal of the ellipse 
at P1 is N1, and the normal of the ellipse of P2 is N2.  N12 then is the 
normal of the ellipse at P12. (The other points are analogous, as is the 
case with a triangle-patch).
Then, if needed, every subpatch again gets subdivided, or drawn using 
(smooth_)triangles.  The result is a subdivided patch where the original 
given points stay in the same place, making it, IMHO, far easier to control.

just thought I'd share this :)

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message


Attachments:
Download 'subdivisiontests.jpg' (28 KB)

Preview of image 'subdivisiontests.jpg'
subdivisiontests.jpg


 

From: Zeger Knaepen
Subject: Re: subdivision
Date: 19 Mar 2009 21:13:18
Message: <49c2edae@news.povray.org>
a second set of images, I think here it's clearer what's happening :)
First the object without subdivision, then 3 times subdivided, then 5 times 
subdivided but with normal triangles.  As you can see, the lighting on the 
bottom object is almost identical as the one on the first two, this means 
the geometry of the third object is the implied geometry of the first.

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message


Attachments:
Download 'subdivisiontest2.jpg' (53 KB)

Preview of image 'subdivisiontest2.jpg'
subdivisiontest2.jpg


 

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