PART 1 - GETTING STARTED

ESSENTIAL MATERIAL

HFFitsInABox.jpg Let's jump right in and render a height field. The image on the right shows a height field rendered in the simplest way possible - no scales, transforms, etc. Three blue cylinders are used to show the location of Pov's coordinate axes and a partially transparent box surrounds the height field. Now, What's wrong with this picture? You may notice that the box starts at the origin <0,0,0>. Its upper-right corner is located at <1,1,1>. The height-field fits nicely inside this box. We're cool with that, but the code doesn't specify this.

A primitive height field always fits inside a one unit box or cube...always!

This may seem a bit inconvenient at first but this is, in fact, what makes heightfields so flexible. As we shall see...

Ommiting the camera and light-source, The code to render the above image looks like this

height_field {
  png "hf1.png" // <-You must specify the source-image type
  texture{pigment{colour rgb <0,1,0>} finish{ambient 0.3}}
}

#declare CylPig = pigment{colour rgb <0,0,1>}
cylinder{ <-100,0,0> <100,0,0> 0.02 pigment{CylPig}}
cylinder{ <0,-100,0> <0,100,0> 0.02 pigment{CylPig}}
cylinder{ <0,0,-100> <0,0,100> 0.02 pigment{CylPig}}

box{<0,0,0> <1,1,1> hollow texture{ pigment{colour rgbt <1,1,1,.8> }}}        

HFScaled.jpg Because a height field is always a one-unit cube in size, scaling the heightfield to whatever size we want is a breeze; We are effectively multiplying by 1 so all we have to do is type scale< x,y,z > replacing x, y and z with the appropriate values. e.g. scale <10,10,10> will give us a height field which is 10 units long, high and wide. The image on the right shows an example of a height field scaled by <3,1.5,3>.
There is something about this that bothers me however; I like my newly-created objects to be centered at the origin. Because a height field is always a one-unit square in size, centering it at the origin simply requires translating by <-0.5,-0.5,-0.5> (or the shorter version - translate -0.5} Once this has been done, we can scale the height field to the size we want. Settling the height field comfortably around the origin also means that any rotation of the height field will be about its own origin.

HFCentered.jpg The image on the right shows a heightfield centered about the origin and then scaled to a desrable size. By now, one question which should be nagging at you is "If a height field is alwasys one-unit in size, how does the size of the source-image relate to the size of the height field?". The answer is...it doesn't!.

The size of the source-image and the size of the height field are independent.

We already saw that a height field is always a one-unit box or square. So what part does the size of the source-image play in this circus? This is what we will look at next. Firstly though, you need to do some rendering...

TRY IT OUT!

The best way to learn is by doing. Download the files used to create the images above: HFFitsInABox.pov, HFScaled.pov, HFCentered.pov. You will also need the source-image file HF1.png Render the scenes yourself and mess around until the cows come home. Try scaling, rotating, translating and so forth. Try using a different source-image than the one I've given. (Remember you MUST specify the file type if it is not your system default -[See Pov Docs]). Come up with a better texture than ambient green.

Back Contents Next