POV-Ray : Newsgroups : povray.general : Heightfields from textures? : Re: Heightfields from textures? Server Time
2 Nov 2024 07:27:15 EDT (-0400)
  Re: Heightfields from textures?  
From: Mike Williams
Date: 7 May 2004 16:41:41
Message: <KYWh5AA+L$mAFwao@econym.demon.co.uk>
Wasn't it Thomas de Groot who wrote:
>Now consider the code Isosurface/Heightfield:
>#if (HF)
>  height_field{function 300,300{P(x,0,y)}
>    translate <-0.5,0,-0.5>
>    scale <4,0.75,4>
>    pigment{G}
>  }
>#else
>  isosurface {
>    function { y - P(x,0,1-z)}
>    open
>    max_gradient 7
>    contained_by{box{<0,0,0>,<1,1,1>}}
>    translate <-0.5,0,-0.5>
>    scale <4,0.75,4>
>    pigment {G}
>  }
>#end
>
>It is possible, for later use, to increase the isosurface by increasing the
>bounding box. If I want to test this larger object with a heightfield
>because my landscape is larger than the unit HF (not considering the scale
>of course), how should I do that? Is that possible at all?

Try this, setting M and N to the scale you require in the X and Z
directions respectively.

#if (HF)
  height_field{function 300*M,300*N{P((x-0.5)*M+0.5,0,(y-0.5)*N+0.5)}
    translate <-0.5,0,-0.5>
    scale <4*M,0.75,4*N>
    pigment{G}
  }
#else
  isosurface {
    function { y - P(x,0,1-z)}
    open
    max_gradient 7
    contained_by{box{<0.5-M*0.5,0,0.5-N*0.5>,<0.5+M*0.5,1,0.5+N*0.5>}}
    translate <-0.5,0,-0.5>
    scale <4,0.75,4>
    pigment {G}
  }
#end

The "300*M,300*N" bit is optional

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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