POV-Ray : Newsgroups : povray.newusers : Box with different texture in each side Server Time
5 Nov 2024 05:25:42 EST (-0500)
  Box with different texture in each side (Message 1 to 3 of 3)  
From: Bin2Hex
Subject: Box with different texture in each side
Date: 13 May 2004 05:23:54
Message: <40a33eaa$1@news.povray.org>
Hi all,

I've worked some time ago with PovRay for a little time and now I needed to
do a simple thing, but don't know how to do it.

How can I have a different texture in each side of a box?

I know how to create the textures and the box and all the rest I need, but
don't know how to assign a different texture to each side.

TIA


Post a reply to this message

From: Mike Williams
Subject: Re: Box with different texture in each side
Date: 13 May 2004 14:09:02
Message: <pNWW9DAHV7oAFwvC@econym.demon.co.uk>
Wasn't it Bin2Hex who wrote:
>Hi all,
>
>I've worked some time ago with PovRay for a little time and now I needed to
>do a simple thing, but don't know how to do it.
>
>How can I have a different texture in each side of a box?
>
>I know how to create the textures and the box and all the rest I need, but
>don't know how to assign a different texture to each side.

You could uv_map the box, or you could replace the box by an
intersection of planes (like the way "cube" used to be defined in early
versions of POV).

// Write a macro, so we don't have to check the order of the X Y and Z
// values manually.

#macro CUBE(P1,P2,T1,T2,T3,T4,T5,T6)
  #local X1=min(P1.x,P2.x);
  #local X2=max(P1.x,P2.x);
  #local Y1=min(P1.y,P2.y);
  #local Y2=max(P1.y,P2.y);
  #local Z1=min(P1.z,P2.z);
  #local Z2=max(P1.z,P2.z);
  intersection {
    plane { x, X2 texture {T1}}
    plane {-x,-X1 texture {T2}}
    plane { y, Y2 texture {T3}}
    plane {-y,-Y1 texture {T4}}
    plane { z, Z2 texture {T5}}
    plane {-z,-Z1 texture {T6}}
  }
#end

//Invoke the macro, passing it the points at opposite corners
//and six textures

CUBE(<0,0,0>,<1,1,1>,
  texture{pigment{rgb x}},
  texture{pigment{rgb x}},
  texture{pigment{rgb y}},
  texture{pigment{rgb y}},
  texture{pigment{rgb z}},
  texture{pigment{rgb z}}
)

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Christopher James Huff
Subject: Re: Box with different texture in each side
Date: 13 May 2004 16:23:07
Message: <cjameshuff-59672A.15231613052004@news.povray.org>
In article <pNW### [at] econymdemoncouk>,
 Mike Williams <nos### [at] econymdemoncouk> wrote:

> You could uv_map the box, or you could replace the box by an
> intersection of planes (like the way "cube" used to be defined in early
> versions of POV).

You should add "bounded_by {box {P1, P2}}" to that intersection. POV-Ray 
is incapable of automatically bounding that shape, since it is just an 
intersection of infinite shapes.

Anyway, that is likely to be slower than an actual box. You could also 
use a mesh, or a more complex pattern...there are many ways one could do 
it with a pattern.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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