POV-Ray : Newsgroups : povray.newusers : layered textures and csg : Re: layered textures and csg Server Time
29 Jul 2024 20:21:26 EDT (-0400)
  Re: layered textures and csg  
From: Mike Williams
Date: 4 Apr 2005 01:40:13
Message: <NKmA9AA0MNUCFwCb@econym.demon.co.uk>
Wasn't it blenderhead who wrote:
>Hello everybody!
>
>I use CSG to build a wall of bricks. It is a union of a box with a mortar
>texture and some stones. Each of these sub-objects has is own texture but
>now I want to have some kind of paiting on it. The following doesn't work:

What you have to do is to layer the graffiti onto both the brick texture
and the mortar texture separately, rather than trying to do both in one
operation. Like this:

#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <10,1,-10> look_at <0,.5,0> angle 8}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}
#include "colors.inc"


#declare wall_left = -1;
#declare wall_right = 1;
#declare wall_bottom = 0;
#declare wall_top = 1;
#declare brick_x = 0.2;
#declare brick_y = 0.1;
#declare brick_gap = 0.02;

// The basic textures for mortar, brick and graffiti

#declare Mortar_Tex = texture {pigment {LightGray}}

#declare Brick_Tex  = texture {pigment {Firebrick}}

#declare Graffiti_Tex = 
 texture {
  pigment {
   spherical
   color_map {
    [0.5 color White filter 1]
    [0.6 color Blue]
   }
  }
  translate y*0.5
 }

// Now apply the graffiti to both brick and mortar

#declare Full_Mortar_Tex = 
  texture {Mortar_Tex}
  texture {Graffiti_Tex}
 
#declare Full_Brick_Tex = 
  texture {Brick_Tex}
  texture {Graffiti_Tex}

object {
 union {
  // mortar
  box {
   <wall_left+0.0001, wall_bottom+0.0001, -0.24>
   <wall_right-0.0001, wall_top-0.0001, 0.24>
   texture {Full_Mortar_Tex}
  }
  // bricks
  union {
   #declare X=wall_left;
   #while (X<wall_right-brick_x)
    #declare Y=wall_bottom;
    #while (Y<wall_top-brick_y)
     box {<X,Y,-0.25><X+brick_x,Y+brick_y,0.25>}
     #declare Y=Y+brick_y+brick_gap;
    #end
    #declare X=X+brick_x+brick_gap;
   #end
   texture {Full_Brick_Tex}
  }  
 }
}


Post a reply to this message

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