POV-Ray : Newsgroups : povray.general : Feature Request - Texture Override, Help Request : Re: Feature Request - Texture Override, Help Request Server Time
1 May 2024 01:19:52 EDT (-0400)
  Re: Feature Request - Texture Override, Help Request  
From: SharkD
Date: 16 Jan 2008 14:15:00
Message: <web.478e576326ad74ae368884fc0@news.povray.org>
Try this:

//BEGIN
//+w700 +h500
//+w700 +h500 +a0.1 +j0.5 +am2

#include "functions.inc"

global_settings {
  assumed_gamma 1
  max_trace_level 15
}

light_source { vrotate (<0, 500, -500>, <0, -60, 0>), rgb 1 }

camera {
  location <0, 10, 0> look_at 0// angle 54
  right x*image_width/image_height
}

#declare l_Seed = seed(123);
#declare l_Gap = 0.125;

// basic brick
#declare o_Brick = box { <-4, -1, -2>, <4, 1, 2> scale 1/12 }

// brick pigment source
#declare p_Brick =
  pigment {
    gradient x
    color_map {
      [0 rgb <0.6055, 0.4423, 0.3066>]
      [1 rgb <0.7, 0.3, 0.2>]
    }
  }

#declare p_Stripe =
  pigment {
    gradient x
    color_map {
      [0 rgbt <1,1,1,1,>]
      [1/2 rgbt <1,1,1,1,>]
      [1/2 rgbt <1,1,1,0,>]
      [1 rgbt <1,1,1,0,>]
    }
  }

// build a section of brick road
#declare o_Section =
  union {
    #declare Z = 0;
    #while (Z < 20)
      #declare X = 0;
      #while (X < 20)
        object {
          o_Brick
          texture
          {
            pigment { eval_pigment(p_Brick, x*rand(l_Seed)) }
          }
          translate <(X-18 #if(Z/2=int(Z/2)) +0.5 #end)*(8+l_Gap), 0,
Z*(4+l_Gap)>/12
        }
        object {
          o_Brick
          translate <(X-18 #if(Z/2=int(Z/2)) +0.5 #end)*(8+l_Gap), 0,
Z*(4+l_Gap)>/12
          scale <1,1.001,1>
        }
        #declare X = X + 1;
      #end
      #declare Z = Z + 1;
    #end
    texture
    {
      pigment {p_Stripe}
    }
  }

// put some sections together to build a road
#declare o_Road =
  union {
    #declare Z = 0;
    #while (Z < 10)
      object { o_Section translate z*Z*100*(4+l_Gap)/12}
      #declare Z = Z + 1;
    #end
  }

object { o_Road }
//END

What I did was duplicate each brick object (except without the texture), scale
it slightly in the y direction, and add a partially transparent texture to the
union of both sets of bricks.

This may not be what you want. But, it looks OK to me from a reasonable
distance. Since the shape of the bricks is the same (I didn't notice any random
values that might cause problems if overlooked), the striped pattern will
conform to the desired shape.

I know that you it /is/ possible to override the texture (or stack multiple
textures) within a single object. I guess this is in fact not possible for the
union of the very same objects. There's probably a good reason for this (at
least as a default behavior).

Let me know if this works out OK for you.


Post a reply to this message

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