POV-Ray : Newsgroups : povray.general : Infinite (tiled) Heightfields : Re: Infinite (tiled) Heightfields Server Time
12 Aug 2024 19:36:06 EDT (-0400)
  Re: Infinite (tiled) Heightfields  
From: Ron Parker
Date: 25 Jan 1999 09:04:27
Message: <36ac79eb.0@news.povray.org>
On Sat, 23 Jan 1999 14:09:06 +1300, The Crazy Mule 
	<smi### [at] paradisenetnz> wrote:
>If we say a function RayHits finds out where, if anywhere, the ray hits on a
>single hf tile, then we can use the following recursive wrapper function to
>extend functionality to infinitely tiled:
>
>Function RayHitsHF(Ray) {	
>	Modulus the ray origin or entry point to find where on a single tile it
>enters/starts
>	If (RayHits) then return hitpoint
>	else {
>		If(Ray Exits Top or bottom) then return no intersection
>		Else RayHitsHF(ray_exitpoint translated to the opposite edge of the tile
>bounding box)
>	}
>}

You'll still have glitches along the edges, unless you use a tileable 
image and kludge the hf to wrap around correctly.  But why should it
be recursive?  It seems like you're just following the ray through a 
virtual "grid" of heightfields, finding any intersections for each 
instance of the heightfield.  No need for recursion there.  You will,
as you say, have to terminate somehow.  I can't think of any way to
detect a ray that is parallel to the bounding slab but that does not
intersect the height field at any point, so maybe you'd have to bail
out after traversing a set number of grid squares or a set distance.

This isn't a bad idea, and it seems far easier to implement than one 
might at first think.  A further modification might be to "flip" 
adjacent copies of the HF along the appropriate axes, to make it
tile relatively smoothly without the need for a tileable image.


Post a reply to this message

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