Home < Solutions < Hardwood Floors
The POV-Ray Cyclopedia
www.spiritone.com/~english/cyclopedia/

I was wondering how I could make a decent hardwood floor out of a procedural texture for an image I was working on, and this came out of my head as I tried to fall asleep one night.

Part Zero
Getting Started

I realized that the repeat warp would solve this problem nicely. The offset feature of the repeat warp could easily make a brick pattern. I started by going through the woods.inc file and picking a pattern:

#include "woods.inc"

#declare light_wood = pigment { P_WoodGrain7A color_map { M_Wood7A } }

box { <-10,-1,-10> <10,0,10>  pigment { light_wood } }
A wood texture</desctription>
<caption>Simpe Wood</caption>
<width>240</width>
<height>180</height

Simpe Wood

Part One
Creating the Floor

Now we need to declare a few variables and the warp patterns:

#declare light_wood = pigment { P_WoodGrain7A color_map { M_Wood7A } }

#declare board_length = 1.5;
#declare board_width = 0.25;
box { <-10,-1,-10> <10,0,10> 
      pigment { light_wood
                warp { repeat board_length*z offset 0.5*y }
                warp { repeat board_width*x offset board_length/2*z }
} }

This looks nice. The brick-like pattern is there. There are a few things that could help us demostrate the pattern is creating the spaces between the boards.

A floorlike pattern

Now it looks like boards

Part Two
Creating the Cracks

Since the boards are rectangular, we can use the box normal pattern to simulate the surface of the boards.

#include "woods.inc"

#declare light_wood = pigment { P_WoodGrain7A color_map { M_Wood7A } }

#declare board_length = 1.5;
#declare board_width = 0.25;

box { <-10,-1,-10> <10,0,10> 
      pigment { light_wood 
                warp { repeat board_length*z offset 0.5*y } 
                warp { repeat board_width*x offset board_length*5/2*z } }
      normal { boxed
               slope_map { [ 0.5 <1,0> ] [1.0 <0,0> ] } 
               bump_size 0.1
               scale <board_width,1,board_length>
               warp { repeat board_length*z  } 
               warp { repeat board_width*x offset board_length/2*z } } }  

This creates shadows in the boards. Other things to note is that I altered the second warp in the pigment. This creates a little more variety in the floor. I removed the offset from the first warp in the normal block because it would eventually disappear. You should also use something that doesn't divide evenly into 1 for the offset of the first warp. offset 0.37*y will create a much more interesting pattern that repeats less frequently.

Headache Creator Despite the fact that I am using essentially the same warps in two different places, I cannot place them in their own block of code and follow the edit once, change everywhere rule of coding that I follow.

A floorlike pattern

The boards are easier to see

Part Three
One more level of variation

Now this floor looks fairly nice so far, but we can do one more thing to spice it up. All of the planks are colored with the same basic pattern. It's proving to be quite a flexible pattern so far. If we use a pigment_map we can get more variation in the theme:

#include "woods.inc"

#declare light_wood = pigment { P_WoodGrain7A color_map { M_Wood7A } }
#declare  dark_wood = pigment { P_WoodGrain14A color_map { M_Wood14A } }

#declare board_length = 1.5;
#declare board_width = 0.25;

box { <-10,-1,-10> <10,0,10> 
      pigment { gradient y triangle_wave
                pigment_map { [0.0 light_wood ]
                              [1.0 dark_wood ] }
                warp { repeat board_length*z offset 0.37*y } 
                warp { repeat board_width*x offset board_length*5/2*z } }
      normal { boxed
               slope_map { [ 0.5 <1,0> ] [1.0 <0,0> ] } 
               bump_size 0.1
               scale <board_width,1,board_length>
               warp { repeat board_length*z  } 
               warp { repeat board_width*x offset board_length/2*z } } }

Now we have more variation in the floor, but there is still a hint of a pattern in the floor. This can be used to create deliberate panels of light and dark colors without repeating the same boards.

Using more wood pigments

Using lighter wood and darker wood

Part Four
The Floor in use

This floor was designed with "The Thing Under the Stairs" in mind, and I used a quilted normal pattern for it instead of the boxed pattern and added a phong hightlight.

box { <-5,-0.1,-4> <9,0,14>
      pigment { gradient y
                pigment_map { [ 0.0 light_wood_floor ]
                              [ 1.0 dark_wood_floor ] }
                warp { repeat board_length *z offset 0.28*y }
                warp { repeat board_width*x offset board_offset } }
      normal {	quilted 0.25 
                control0 0.0
                control1 0.66
                bump_size 0.25
                scale <board_width,1,board_length>
                warp { repeat board_length *z  }
                warp { repeat board_width*x offset board_length*1.5*z } }
      finish { phong 1 } }
Floor from

The floor from "The Thing Under the Stairs"


Send feedback, or head back to the Cyclopedia.

This page was last updated on 31 Aug 2001 20:50 .

Valid HTML 4.01! Valid CSS! Powered by Python