POV-Ray : Newsgroups : povray.general : Heightfields from textures? : Re: Heightfields from textures? Server Time
2 Nov 2024 07:23:59 EDT (-0400)
  Re: Heightfields from textures?  
From: Mike Williams
Date: 27 Apr 2004 15:31:00
Message: <I3E+TDAh0hjAFwwD@econym.demon.co.uk>
Wasn't it Jon Berndt who wrote:
>[I've been using POV-Ray for years on and off, but I still consider myself a
>sort of newbie]
>
>I have used heightfields with a provided bitmap, but I often found that they
>didn't quite work for me, at least the way I was using them.  I wanted to
>make a landscape (terrain) that was rolling hills, but that exhibited detail
>even when viewed up close.  I have some ideas how to do this, but the most
>important aspect of this for me to get started is to know, first, if POV-Ray
>can essentially model heightfields algorithmically rather than from
>(potentially limited) bitmaps. I am guessing that there might be a way to
>generate a heightfield that is based on a texture, perhaps?

There's more than one way to do it. One way is to generate a
height_field based on a pattern function

#declare P1=function{pattern{leopard turbulence 0.3 scale 0.2/4}}
#declare P2=function{pattern{leopard turbulence 0.3 scale 0.5/4}}
height_field{function 300,300{P1(x,y,z)*0.3+P2(x,y,z)}
  translate <-0.5,0,-0.5>
  scale <4,0.7,4>
  . . . 

and the other way is to use an isosurface

#declare P1=function{pattern{leopard turbulence 0.3 scale 0.2}}
#declare P2=function{pattern{leopard turbulence 0.3 scale 0.5}}
isosurface {function { y - P1(x,0,z)*0.3 - P2(x,0,z)*1.0}
  . . .

The significant differences are:-

1. The height field renders much faster

2. The isosurface has as much resolution as the scene requires, when you
come in for a close up you get the details automatically. You have to
specify an appropriate resolution for the height_field. When you're
doing a close up view you'll need to replace "function 300,300" with
larger numbers.

3. The height field uses more memory, since the whole function image is
calculated once and stored in memory. If you're doing an extreme closeup
you might need to set the size of the function image to be very large,
and therefore need quite a lot of memory.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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