POV-Ray : Newsgroups : povray.general : Feature Request - Texture Override, Help Request : Re: Feature Request - Texture Override, Help Request Server Time
1 May 2024 01:26:00 EDT (-0400)
  Re: Feature Request - Texture Override, Help Request  
From: SharkD
Date: 16 Jan 2008 17:45:00
Message: <web.478e882f26ad74ae368884fc0@news.povray.org>
Kyle <hob### [at] gatenet> wrote:
> SharkD,
>
> Thanks for your reply.
>
> That's an interesting approach, but the lines would still be duplicated for each
section, which is not what I'm looki
ng for.  Also, there may be some coinciding surfaces issues by just scaling the
> bricks in the y direction, but they may not be visible enough for concern.
>
> A similar effect can be achieved by using layered textures for each brick, as
demonstrated below.  This eliminates th
e need to have a second brick object and avoids the possible coinciding surfaces
> issue.

You're right. Applying the texture to the brick is the proper way of doing it.
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, 100, 0> look_at 0// angle 54
  right x*image_width/image_height
  translate z*20
}

#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_Clear =
  pigment {
   color rgbt <1,1,1,1,>
  }

#declare p_White =
  pigment {
   color rgbt <1,1,1,0,>
  }

#declare p_Stripe_x =
  pigment {
    gradient x
    pigment_map {
      [0 p_Clear]
      [7/16 p_Clear]
      [7/16 p_White]
      [9/16 p_White]
      [9/16 p_Clear]
      [1 p_Clear]
    }
    warp { turbulence 0.1 octaves 3 lambda 1.5 omega 0.3 }
  }

#declare p_Stripe_z =
  pigment {
    gradient z
    pigment_map {
      [0 p_Clear]
      [3/16 p_Clear]
      [3/16 p_Stripe_x]
      [13/16 p_Stripe_x]
      [13/16 p_Clear]
      [1 p_Clear]
    }
    warp { turbulence 0.1 octaves 3 lambda 1.5 omega 0.3 }
  }


// build a section of brick road
#declare o_Section = 0;


// put some sections together to build a road
#declare o_Road =
  union {
    #declare S = 0;
    #while (S < 10)
    union {
      #declare Z = 0;
      #declare section_translate = z*S*20*(4+l_Gap)/12;
      #while (Z < 20)
        #declare X = 0;
        #while (X < 20)
          #declare brick_translate = <(X-10 #if(Z/2=int(Z/2)) +0.5
#end)*(8+l_Gap), 0, Z*(4+l_Gap)>/12;
          object {
            o_Brick
            texture {
              pigment { eval_pigment(p_Brick, x*rand(l_Seed)) }
            }
       texture {
         pigment {p_Stripe_z}
         translate x*.5
         scale 10
         translate -brick_translate
         translate -section_translate
       }
            translate brick_translate
          }
          #declare X = X + 1;
        #end
        #declare Z = Z + 1;
      #end
   translate section_translate
    }
      #declare S = S + 1;
    #end
  }

object { o_Road }
//END


Post a reply to this message

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