POV-Ray : Newsgroups : povray.general : Boned mesh file formats? : Re: Some answers Server Time
2 Aug 2024 22:19:02 EDT (-0400)
  Re: Some answers  
From: Sascha Ledinsky
Date: 27 Aug 2004 14:54:16
Message: <412f8358@news.povray.org>
Rune wrote:

> Sascha Ledinsky wrote:
> 
>>You will need at least *something* - take, for example, an arm or leg
>>of a human model: If it bends to the maximum allowed angle (let's say
>>170 degrees), the upper and lower parts would intersect
> 
> 
> Not necessarily if the vertices around the joint moves by an average between
> the two bones. I think.
> 

Smoothly blending between two bones is nice to have too, but it doesn't 
really solve the problem. Morphs on the other hand have more advantages 
- you can easily fake muscle motion and also doo facial expressions, 
lip-syncing, etc...

>>I'm about to implement it in my modeler (which used a spline based
>>approach and outputs bicubic patches to pov-ray), and use an xml-style
>>file format...
> 
> 
> That sounds interesting. I'm curious, how have you managed to get around the
> topology problem with bicubic patches?

Currently three sided patches are handled as degenerate rectangular 
patches, and five-sised ones are represented by five rectangular patches 
(I will treat the three-sided case similar once I've a better 
implementation). Currently both versions suffer from creases (which are 
visible on reflective sorfaces or surfaces showing sharp specular 
highlights). Here is an example image, modeled with my modeler and 
rendered with pov-ray:
http://www.jpatch.com/gallery/head.jpg

I have not yet solved the problem, but I am sure there is a solution. I 
have found a paper which explains how to convert a bezier triangle into 
four regular bicubic patches. The patches connect seamlessly (with G1 
continuity). I'm quite sure a similar solution exists for five-sided 
patches - I've found the (mathematical) conditions for connecting 
patches with G1-continuity in a book about curves and surfaces, I try to 
apply it to my problem (causing me some headaches, as I'm not a 
mathematician :-/ ...)

> and I've never seen three bicubic patches sharing one
> corner fit seamlessly together. Well, seamlessly I have seen, but not with a
> completely smooth surface...

As I mentioned above, it is possible (see the code at the end of this 
post) - it converts a bezier triangle into three "pov-ray compatible" 
patches. Bezier triangles are not exactly what I need for my three- (or 
five-) sided patch, but it's a start ;-)

> I'd be interested in hearing more about your plans and the format.

I'll let you know when it's ready...

Here's the code:

#macro makePatch()
	#local P00 = T00;
	#local P01 = 1/2 * (T01 + T00);
	#local P02 = 1/4 * (T02 + 2*T01 + T00);
	#local P03 = 1/8 * (T03 + 3*T02 + 3*T01 + T00);
	#local P10 = 1/2 * (T10 + T00);
	#local P11 = 1/18 * (3*T11 + 5*T10 + 5*T01 + 5*T00);
	#local P12 = 1/72 * (3*T12 + 14*T11 + 11*T10 + 11*T02 + 22*T01 + 11*T00);
	#local P13 = 1/12 * (T12 + 2*T11 + T10 + T03 + 3*T02 + 3*T01 + T00);
	#local P20 = 1/4 * (T20 + 2*T10 + T00);
	#local P21 = 1/72 * (3*T21 + 11*T20 + 14*T11 + 22*T10 + 11*T01 + 11*T00);
	#local P22 = 1/54 * (3*T21 + 5*T20 + 3*T12 + 13*T11 + 10*T10 + 5*T02 + 
10*T01 + 5*T00);
	#local P23 = 1/18 * (T21 + T20 + 2*T12 + 4*T11 + 2*T10 + T03 + 3*T02 + 
3*T01 + T00);
	#local P30 = 1/8 * (T30 + 3*T20 + 3*T10 + T00);
	#local P31 = 1/12 * (T30 + T21 + 3*T20 + 2*T11 + 3*T10 + T01 + T00);
	#local P32 = 1/18 * (T30 + 2*T21 + 3*T20 + T12 + 4*T11 + 3*T10 + T02 + 
2*T01 + T00);
	#local P33 = 1/27 * (T30 + 3*T21 + 3*T20 + 3*T12 + 6*T11 + 3*T10 + T03 
+ 3*T02 + 3*T01 + T00);
	
	bicubic_patch {
		type 1
		flatness 0
		u_steps 5
		v_steps 5
		P00,P01,P02,P03,
		P10,P11,P12,P13,
		P20,P21,P22,P23,
		P30,P31,P32,P33
	}
#end

#macro bezierTriangle(T003,T012,T021,T030,T102,T111,T120,T201,T210,T300)
	union {
		#declare T00 = T003;
		#declare T01 = T012;
		#declare T02 = T021;
		#declare T03 = T030;
		#declare T10 = T102;
		#declare T11 = T111;
		#declare T12 = T120;
		#declare T20 = T201;
		#declare T21 = T210;
		#declare T30 = T300;
		makePatch()
		
		#declare T00 = T030;
		#declare T01 = T021;
		#declare T02 = T012;
		#declare T03 = T003;
		#declare T10 = T120;
		#declare T11 = T111;
		#declare T12 = T102;
		#declare T20 = T210;
		#declare T21 = T201;
		#declare T30 = T300;
		makePatch()
		
		#declare T00 = T300;
		#declare T01 = T201;
		#declare T02 = T102;
		#declare T03 = T003;
		#declare T10 = T210;
		#declare T11 = T111;
		#declare T12 = T012;
		#declare T20 = T120;
		#declare T21 = T021;
		#declare T30 = T030;
		makePatch()		
	}
#end


background { color rgb 0.5 }
camera {
	location <0,3,-1.5>
	look_at <1.5,0,1.5>
	
}

light_source {
	<0,100,100>
	color rgb 1
}

union {
	bezierTriangle(
		<0,0,0>,<1,1,0>,<2,-1,0>,<3,0,0>,
		<0,-1,1>,<1,2,1>,<2,1,1>,
		<0,1,2>,<1,-1,2>,
		<0,0,3>
	)
	pigment { uv_mapping checker rgb 0.8 rgb 0.4 scale 0.2}
	finish { ambient 0.4 diffuse 0.6 specular 0.5 roughness 0.02
	reflection 0}
}



--sascha


Post a reply to this message

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