PART 1 - Size Matters

Staircase.png

HEIGHT FIELDS ARE TRIANGLE MESHES

I stated in the introduction that "Given a 2-dimensional image file(x and y dimensions), PovRay will create a 3-dimensional object by assigning a y-value to every (x, z) pair...". If this were the whole story however, a height field might look something like the image on the right.

What PovRay really does is create a triangle mesh from the data-source you provide. The mesh of triangles gives a sloping or "mountainous" appearance to a height field rather than the "staircase", or block, type look that we see here.

PIXELS, TRIANGLES, DETAIL

The size of the source-image and the size of the height field are completely independent. However, The size of the image-file is critically important - How so?
The size of the source image determines the level of detail in the resulting height field

Let's see how this works.
The three images below are all created with the "same" source-image. The only difference is that the source image has been scaled to 3 different sizes. The sizes of the source-image (from left to right are 400 * 400, 100 * 100 and 50 * 50 pixels. Spot the difference? (Downloading the code and rendering the images youself at a larger size will make the differences more apparent)

images/HF101SizeMatters1_44.png images/HF101SizeMatters1_11.png images/HF101SizeMatters1_0505.png

How it works

Quoting Directly from the PovRay documentation: "The mesh of triangles corresponds directly to the pixels in the image file. Each square formed by four neighboring pixels is divided into two triangles. An image with a resolution of N*M pixels has (N-1)*(M-1) squares that are divided into 2*(N-1)*(M-1) triangles."

The first sentence is the key. Simply put: More pixels -> More Triangles -> More Detail.
All 3 height fields are the same size in our scene. When Pov has less pixels to spread over the same area, the triangles are larger and the detail is less, resulting in a "blockier" surface. Looking at the three images above, you can clearly see the individual triangles of the heightfield in the centre and right-most images. Read the docs and you will also see that the bits-per pixel of the source image also affect the amount of detail.

You're a smooth operator...

The next three images, ladies and gentleman, have been rendered with the same source-images at the above. The difference here is that the smooth keyword has been specified in the height field declaration. When smooth is specified, PovRay quite literally smooths the surface of your heightfield, making it appear continuous and flowing rather than discrete and segmented.
Showing here...

images/HF101SizeMatters1_44sm.png images/HF101SizeMatters1_11sm.png images/HF101SizeMatters1_0505sm.png

You might notice that the differences are not as dramatic amongst the smoothed height fields.
This is worth noting; You can often use a smaller source image with a smooth height field.

IS BIGGER BETTER?

It may appear that a bigger source image will provide a better-looking heightfield but this is not necessarily true. The best size really depends entirely on what you want to acheive. Look again at the following two images. The left is 400*400. The right is 100*100 and both have been smoothed. Which looks better?

HF101SizeMatters1_44sm.png      HF101SizeMatters1_11sm.png

The question is entirely subjective. In a landscape scene, the one on the left might work better as a mountain-peak, whereas the one on the left might be better suited for gentle, rolling terrain. So, is bigger, better?

BIGGER IS BETTER - USUALLY!

My advice yo you in the closing of this chaper is Always make your source-image bigger than you need. If you are creating a source-image by hand, think how big it needs to be and then double it. The reason for this is that you can always scale an image down to lower size but scalling upwards is darn-near impossible (unless you are using a vector-based drawing program). In the past I have created the perfect-size heightfield and then found that I needed to change the scaling of the rest of the scene, which resulted in having to recreate the height field source image. This can seriously knot your knitting! Another handy tip is to create several versions of the source-image, all different sizes. This is, in fact, the technique I used to create most of the images on this page. A bigger source-image will take longer to load and render than a smaller sized one. You can use a smaller version of the source-image for quick test renders and then invoke the monster size for your final render.

SUMMARY

There was a lot to cover on this page so here is a summary of the main points you need to remember

TRY IT OUT!

Download HF101SizeMatters1.pov. This is the code I used to create most of the images on this pages. You will also need these 3 image files HF101SizeMaters44.png, HF101SizeMaters11.png, HF101SizeMaters0505.png

Back Contents Next