Obviously, we cannot try them all. It would take a tutorial a lot more pages to use every texturing option available in POV-Ray. For this limited tutorial, we will content ourselves to just trying a few of them to give you an idea of how textures are created. With a little practice, you will soon be creating beautiful textures of your own.
Create a file called texdemo.pov and edit it as follows:
Giving this file a quick test render at 200x150 -A we see that it is a simple red sphere against a green and white checkered plane. We will be using the sphere for our textures.
Rendering this we see a three-color hexagonal pattern. Note that this pattern requires three colors. Now change the pigment to...
Looking at the resulting image see that the plane now has a brick pattern. Note that we had to rotate the pattern to make it appear correctly on the flat plane. This pattern normally is meant to be used on vertical surfaces. We also had to scale the pattern down a bit so we could see it more easily. Feel free to play around with these color list pigments, change the colors, etc. until you get a floor that you like.
Rendering this we see that it gives us an interesting pattern of vertical stripes. Try changing the gradient direction to y. The stripes are horizontal now. Try changing the gradient direction to z. The stripes are now more like concentric rings. This is because the gradient direction is directly away from the camera. Change the direction back to x and add the following change to the pigment block.
The vertical bars are now slanted at a 45 degree angle. All patterns can be rotated, scaled, and translated in this manner. Let's now try some different types of patterns. One at a time, substitute the following keywords for gradient x and render to see the result: bozo , marble , agate , granite , leopard , spotted , and wood (if you like you can test all patterns listed in section "Patterns" ).
Rendering these we see that each results in a slightly different pattern. But to get really good results each type of pattern requires the use of some pattern modifiers.
The frequency modifier determines the number of times the color map repeats itself per unit of size. This change makes the bozo pattern we saw earlier have many more bands in it. Now change the pattern type to marble . When we rendered this earlier, we saw a banded pattern similar to gradient y that really did not look much like marble at all. This is because marble really is a kind of gradient and it needs another pattern modifier to look like marble. This modifier is called turbulence . Change the line frequency 3 to turbulence 1 and render again. That's better! Now let's put frequency 3 back in right after the turbulence and take another look. Even more interesting!
But wait, it gets better! Turbulence itself has some modifiers of its own. You can adjust the turbulence several ways. First, the float that follows the turbulence keyword can be any value with higher values giving you more turbulence. Second, you can use the keywords omega , lambda , and octaves to change the turbulence parameters. Let's try this now:
Rendering this we see that the turbulence has changed and the pattern looks different. Go ahead and play around with the numerical values of turbulence , lambda , omega , and octaves to see what they do.
There is another kind of transparency in POV-Ray. It is called transmittance or non-filtering transparency (the keyword is transmit ). It is different from filter in that it does not filter the light according to the pigment color. It instead allows all the light to pass through unchanged. It can be specified like this: rgbt<1, 0, 0, 1> .
Let's use some transparent pigments to create another kind of texture, the layered texture. Returning to our previous example, declare the following texture.
This texture will be the land area. Now let's make the oceans by declaring the following.
Note how the ocean is the opaque blue area, and the land is the clear area which will allow the underlying texture to show through.
Now, let's declare one more texture to simulate an atmosphere with swirling clouds.
Now apply all of these to our sphere.
Render this and you'll have a pretty good rendition of a little planetoid. But it could be better. We don't particularly like the appearance of the clouds. There is a way they could be done that would be much more realistic.
Add the following declarations, making sure they appear before the other declarations in the file.
Now use these declared pigments in our cloud layer on our planetoid. Replace the declared cloud layer with.
Render this and you'll see a remarkable pattern that looks very much like weather patterns on the planet earth. They are separated into bands, simulating the different weather types found at different latitudes.
Here we have added a normal block in addition to the pigment block (note that these do not have to be included in a texture block unless they need to be transformed together or need to be part of a layered texture). Render this to see what it looks like. Now, one at a time, substitute for the keyword bumps the following keyowrds: dents , wrinkles , ripples , and waves (you can also use any of the patterns listed in "Patterns" ). Render each to see what they look like. Play around with the float value that follows the keyword. Try experimenting with the scale value too.
For added interest, change the plane texture to a single color with a normal as follows.
As you can see, the resulting pattern is neither a radial nor a gradient. It is instead the result of first calculating a radial pattern and then calculating a gradient pattern. The results are simply additive. This can be difficult to control so POV-Ray gives the user other ways to blend normals.
One way is to use normal maps. A normal map works the same way as the pigment map we used earlier. Let's change our sphere texture as follows.
Rendering this we see that the sphere now has a very irregular bumpy surface. The gradient pattern type separates the normals into bands but they are turbulated, giving the surface a chaotic appearance. But this give us an idea.
Suppose we use the same pattern for a normal map that we used to create the oceans on our planetoid and applied it to the land areas. Does it follow that if we use the same pattern and modifiers on a sphere the same size that the shape of the pattern would be the same? Wouldn't that make the land areas bumpy while leaving the oceans smooth? Let's try it. First, let's render the two spheres side-by-side so we can see if the pattern is indeed the same. Un-comment the planetoid sphere and make the following changes.
Now change the gray sphere as follows.
Now render this to see if the pattern is the same. We see that indeed it is. So let's comment out the gray sphere and add the normal block it contains to the land area texture of our planetoid. Remove the transformations so that the planetoid is centered in the scene again.
Looking at the resulting image we see that indeed our idea works! The land areas are bumpy while the oceans are smooth. Add the cloud layer back in and our planetoid is complete.
There is much more that we did not cover here due to space constraints. On your own, you should take the time to explore slope_map , average , and bump_map .