POV-Ray : Newsgroups : povray.text.tutorials : single colour layers, texturing Server Time
19 Apr 2024 17:04:21 EDT (-0400)
  single colour layers, texturing (Message 1 to 1 of 1)  
From: ingo
Subject: single colour layers, texturing
Date: 29 Aug 2004 15:18:48
Message: <Xns9554D8D51C652seed7@news.povray.org>
This is not a true tutorial, it's more like a receipe showing a possible 
way of creating textures and keeping control on them.

In p.a-u Gary Blessing asked how to re-colour an existing wood texture 
from 'woods.inc'. When I started with POV-Ray I had similar problems. 
The use of many differently coloured entries in a colour_map makes it 
complex to change the colour of a texture, especialy if it is also a 
layered texture.

In the world of printing one can only use one colour per printing 
cylinder. So all a cylinder does is put more or less pigment on the 
substrate. I tried to do the same with POV-Ray.

It is doen by using layered textures. Each layer has only one colour in 
it. The "density" of the colour is controlled by the filter / transmit 
component. Both these components are fixed. The only thing that can be 
changed when using the texture is the colour of it. 

By layering the various patterns colour mixing occurs, so in the end 
you'll have more colour shades than layers. The first layer is a plain 
base colour, with no pattern. Changing this colour can give you quickly 
a different looking colour-way, think of varying the colours of a 
planched floor. 

Each layer is put inside a macro to make use and control easier.

Below, a simple scene to play with:

//---%<------%<---
#version 3.6;

#macro T1_base(cBase)
  texture {pigment{rgb cBase}}
#end

#macro T1_layer01(cLayer01)
  texture {
    pigment {
      wood
      sine_wave
      turbulence <0.01,0.03,0.01>
      octaves 7
      lambda 0.75
      omega 0.5
      colour_map {
        [0.0, rgb cLayer01 filter 0.1]
        [0.8, rgb cLayer01 filter 0.8]
        [1.0, rgb cLayer01 filter 1]
      }
    }
  }
#end

#macro T1_layer02(cLayer02)
  texture {
    pigment {
      wood 
      scale <1.2,1,1.3>
      turbulence <0.03,0.01,0.02>
      octaves 3
      lambda 1
      omega 0.75
      colour_map {
        [0.3, rgb cLayer02 filter 0.7]
        [0.4, rgb 1 filter 1 transmit 0.3]
        [0.7, rgb cLayer02 filter 0.3]
        [1.0, rgb 1 filter 1]
      }
    }
  }
#end

#macro T1(cBase,cLayer01,cLayer02)
  T1_base(cBase)
  T1_layer01(cLayer01)
  T1_layer02(cLayer02)
#end

global_settings {
  assumed_gamma 1.0
}

camera {
  //orthographic
  location  <0.0, 0, -6>
  right     x*image_width/image_height
  look_at   0
  angle 60
}

sky_sphere {pigment{function{abs(y)}}}

light_source {
  <0, 0, -550>, 1
}

sphere {
  0.0, 1.2
  material {
    T1(<1,0.85,0.7>,<1,0.75,0.8>,<0.8,0.75,0.9>)
    texture {
      pigment{rgbf 1}
      finish{specular 0.4}
    }
    scale 0.1
    rotate <0,44,0>
  }
  translate -1.2*x
}

box {
  -1,1
  material {
    T1_base(<0.92,0.75,0.6>)
    T1_layer01(<0.8,0.62,0.45>)
    T1_layer02(<0.75,0.60,0.45>)
    scale 0.1
    rotate <0,88,0>
  }  
  translate <1.2,-1,0>
}

box {
  -1,1
  material {
    T1_base(1)
    T1_layer01(0.7)
    T1_layer02(0.4)
    scale 0.1
    rotate <0,88,0>
  }  
  translate <1.2,1,0>
}
//---%<------%<---

Ingo


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.