Tuesday, August 14th, 2012...1:05 pm

Adding some texture

Jump to Comments

In the last post, we began a series on creating computer graphics with POV-Ray. In that post, we constructed balls of various solid colors like that below.

Now, let’s wrap textures around them. For example, the image:

can be created from the code:


#include"colors.inc"
#include"textures.inc"
#include"stones.inc"
#include"woods.inc"

camera {
location <0, 1.5, -4>
look_at <0, 1, 0>
}

sphere {
<0, 1, 0>, 1
texture{T_Stone20}
}

box {
<-3,-.1,-1>, <3,0,6>
pigment { checker Red White scale .5}
}

light_source { <100, 150, -200> color White }
light_source { <100, 800, 0> color Gray50}

sphere { <0,0,0>,1
texture {
pigment { Blue_Sky3 }
}
scale 100000
}

A few things to notice about the code. First, notice that there are 2 light sources. One is full white and another is a softer light. Images usually have a more natural look with more than one light source. Studios often use more than one light and have reflective material to soften shadows in a similar way.

Second, notice how the image, light sources, and camera are placed in a larger sphere. That sphere has a Blue_Sky3 lecture which is the look of the sky. As such, the entire scene is contained in a large spherical universe.

Finally, at the beginning of the code, we include various libraries which allow us to refer to existing code that allows us to use words like White and Blue_Sky3 within the programming.

Now, take the line that reads:


texture{T_Stone20}

and alter it to read:


texture{T_Stone21}

This simple change creates the image:

Now, change this same line to read:


texture{Jade}

and you get:

Finally, have the line read:


texture{Peel scale 0.3}

and you get the Escher-like image:

Try changing the value of 0.3 and see what happens. Want to try more? You can find many more POV-Ray textures online. Remember that you may need to import a library. Here are a few you may wish to try:

PinkAlabaster, Blood_Sky, Lightning2 or NBwinebottle

Remember, spelling counts and so does capitalization! Keep in mind, you can change the texture of the sky, too!



Leave a Reply