POV-Ray : Newsgroups : povray.newusers : strange behaviour of difference function Server Time
26 Nov 2024 07:23:38 EST (-0500)
  strange behaviour of difference function (Message 1 to 3 of 3)  
From: Maurice
Subject: strange behaviour of difference function
Date: 12 Sep 2004 14:57:37
Message: <41449c21$1@news.povray.org>
Hi

Please refer to the image posted in p.b.images in the thread with the 
same subject.

To get that image I have declared an object called spring, as given below.

I then draw the spring simply with object{spring}
Please notice that there is a part of the object's shadow missing.
Question 1 is: where did it go?
Question 2 is: how to get this fixed?

The difference with the box is needed to get a nice blunt end on the 
spring.

---8<---

#declare spring=
difference{
   isosurface{
   	// f_helix1(x,y,z, P0, P1, P2, P3, P4, P5, P6)
	  //
		// P0 : Number of helixes - e.g. 2 for a double helix
		// P1 : Period - is related to the number of turns per unit length
		// P2 : Minor radius (major radius > minor radius)
		// P3 : Major radius
		// P4 : Shape parameter. If this is greater than 1 then the tube 
becomes fatter in the y direction
		// P5 : Cross section type
		// P6 : Cross section rotation angle (degrees)
     function{
      f_helix1(x,y,z, 1, 1.5, wire_r, 4*bead_size, 1, 1, 0)
     }
 
contained_by{box{<-5*bead_size,-.3,-5*bead_size>,<5*bead_size,8*bead_size,5*bead_size>}}
     texture{RedWire_T}
   }
   box{
   	<-5*bead_size,-1,-5*bead_size>,
   	<0,1,0>
   	texture{RedWire_T}
   }
}

-- 
Maurice


Post a reply to this message

From: Slime
Subject: Re: strange behaviour of difference function
Date: 12 Sep 2004 15:28:33
Message: <4144a361$1@news.povray.org>
> Please notice that there is a part of the object's shadow missing.
> Question 1 is: where did it go?
> Question 2 is: how to get this fixed?

When an intersection test is done with an isosurface, by default only the
first intersection is found. In the area of your image with the missing
shadow, that first intersection (from the shadowed area towards the light
source) is inside the box{} which is differenced from the isosurface. Since
it's inside the box, the intersection doesn't count (because the object does
not exist there). However, since that was the first intersection, the
algorithm doesn't go on to find more intersections with the isosurface, so
it never sees the part which *should* cast a shadow.

Normally this is a helpful speedup, but in this case it's causing problems.
To force POV-Ray to look for more than one intersection, use the max_trace
keyword with an integer for how many intersections to find. In this case
max_trace 3 should work.

You can also use the all_intersections keyword which is essentially
"max_trace infinity".

This is explained in the documentation at the end of "3.4.4  Isosurface
Object".

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Maurice
Subject: Re: strange behaviour of difference function
Date: 12 Sep 2004 15:39:33
Message: <4144a5f5@news.povray.org>
Slime wrote:
>>Please notice that there is a part of the object's shadow missing.
>>Question 1 is: where did it go?
>>Question 2 is: how to get this fixed?
>[...}
> Normally this is a helpful speedup, but in this case it's causing problems.
> To force POV-Ray to look for more than one intersection, use the max_trace
> keyword with an integer for how many intersections to find. In this case
> max_trace 3 should work.
> 
> You can also use the all_intersections keyword which is essentially
> "max_trace infinity".
> 
> This is explained in the documentation at the end of "3.4.4  Isosurface
> Object".


all_intersections does the job. Thanks.


Post a reply to this message

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