POV-Ray : Newsgroups : povray.newusers : layered textures and csg Server Time
25 Nov 2024 19:39:27 EST (-0500)
  layered textures and csg (Message 1 to 6 of 6)  
From: blenderhead
Subject: layered textures and csg
Date: 2 Apr 2005 13:20:01
Message: <web.424ee1aeef5fde29dfc8659d0@news.povray.org>
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:

object {
 union {
  box {
   <wall_left+0.0001, wall_bottom+0.0001, -0.24>
   <wall_right-0.0001, wall_top-0.0001, 0.24>
   texture {
    Mortar_Tex
   }
  }

  //stone loop, each stone has is own texture
 }

 texture {                //stupid texture, I know... 8-/
  pigment {
   gradient y
   color_map {
    [0.0 color White filter 1]
    [1.0 color Blue]
   }
   scale 5
  }
 }
}

So why doesn't it work? Is there a simple way to do that?


Post a reply to this message

From: Alain
Subject: Re: layered textures and csg
Date: 3 Apr 2005 11:38:53
Message: <42500e0d$1@news.povray.org>
blenderhead nous apporta ses lumieres en ce 2005-04-02 13:17:
> 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:
> 
> object {
>  union {
>   box {
>    <wall_left+0.0001, wall_bottom+0.0001, -0.24>
>    <wall_right-0.0001, wall_top-0.0001, 0.24>
>    texture {
>     Mortar_Tex
>    }
>   }
> 
>   //stone loop, each stone has is own texture
>  }
> 
>  texture {                //stupid texture, I know... 8-/
>   pigment {
>    gradient y
>    color_map {
>     [0.0 color White filter 1]
>     [1.0 color Blue]
>    }
>    scale 5
>   }
>  }
> }
> 
> So why doesn't it work? Is there a simple way to do that?
> 
> 
In an union, when you define a texture for any element, that texture have priority and
override any 
texture applied to the whole union. The general texture will apply to any element that
DON'T have a 
specific texture.
The solution: remove the individual textures.

Alain


Post a reply to this message

From: Tom Melly
Subject: Re: layered textures and csg
Date: 3 Apr 2005 15:31:36
Message: <42504498$1@news.povray.org>
"blenderhead" <nomail@nomail> wrote in message
news:web.424ee1aeef5fde29dfc8659d0@news.povray.org...
> 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:

Basically, you can't do that (and it's a great shame). What you need to do
is have your outer texture included as a layered texture within each inner
texture.

See 2.3.4.10  Working With Layered Textures in the manual (but iirc the info
on the final normal is incorrect).


Post a reply to this message

From: blenderhead
Subject: Re: layered textures and csg
Date: 3 Apr 2005 15:45:01
Message: <web.4250467b7de8413753fb457d0@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> In an union, when you define a texture for any element, that texture have priority
and override any
> texture applied to the whole union. The general texture will apply to any element
that DON'T have a
> specific texture.
Ok, thank you for explaining this! Though this is somehow disappointing for
me... :,-(

> The solution: remove the individual textures.
That is not really a solution for me since I want some kind of graffiti on
it when I have finished it.


Post a reply to this message

From: Mike Williams
Subject: Re: layered textures and csg
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

From: blenderhead
Subject: Re: layered textures and csg
Date: 4 Apr 2005 07:05:01
Message: <web.42511e517de841375df994960@news.povray.org>
Thank you, it works!
It seems like I have to read the chapter about textures again... ;-)


Post a reply to this message

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