POV-Ray : Newsgroups : povray.advanced-users : cutaway_textures when not using the default texture Server Time
8 Jul 2024 18:47:14 EDT (-0400)
  cutaway_textures when not using the default texture (Message 1 to 4 of 4)  
From: clum
Subject: cutaway_textures when not using the default texture
Date: 3 Jan 2007 05:20:00
Message: <web.459b82efd67de44323100790@news.povray.org>
I have several objects, each with a different texture, which need to be cut
away with the same CSG cut. I decided to union them together, and
difference that union with this one object. This larger difference, is then
a part of a union of various objects, which has a texture, to give all of
the untextured objects the same texture. (Hold on a second, there'll be a
code sample soon.) When I rendered, I discovered that the cutout was given
the color of the whole union. I did a quick search, and found that I'm
supposed to add the cutaway_textures keyword. However, it still didn't
help! I worked on simpler cases, and found that it was failing because of
the texture in the outer union. I can think of workarounds (i.e. putting
all of the non-textured items in my bigger union into its own union, but
that's not simple because of all of the transformations done on each union,
or to do a difference on each set of objects with the same texture, which
isn't easy because of the number of textures), but I wouldn't mind a
simpler solution.
Reading this over, this was a very unclearly written post, so hopefully this
bit of code will make it clearer:

camera {location <2,5,3> look_at 0}
light_source {<4,5,2> rgb 1}

union {
    difference {
        box {-1, 1 texture{pigment{rgb<0, 1, 1>}}}
        box {0, 2}
        cutaway_textures
    }
    box {<-2, -1, -1>, <-1, 1, 1>}
    texture{pigment{rgb<1, 0, 0>}} // Commenting out this line makes the
cutaway work, but makes the last box disappear
}


Post a reply to this message

From: Tim Attwood
Subject: Re: cutaway_textures when not using the default texture
Date: 3 Jan 2007 20:42:58
Message: <459c5ba2@news.povray.org>
I see what you are saying...
The texture assigned by using cutaway_textures isn't
flagged as being a textured surface... so later it
gets re-assigned.

I usually declare my textures so I can change stuff
at one spot. Then I declare objects without textures.
Finally, I add textures with the scene.  I don't hold
to this 100% of course...

camera {location <2,5,3> look_at 0}
light_source {<4,5,2> rgb 1}

// textures
#declare TCyan = texture{pigment{rgb<0, 1, 1>}};
#declare TRed = texture{pigment{rgb<1, 0, 0>}};
#declare TThing = texture {
   object { box {<-1,-2,-1>, <1,2,2>}
      texture{TRed}
      texture{TCyan}
   }
};
// objects
#declare Thing = difference {
   box {<-2, -1, -1>, <1, 1, 1>}
   box {0, 2}
};
// scene
object {Thing texture{TThing}}


Post a reply to this message

From: Jim Charter
Subject: Re: cutaway_textures when not using the default texture
Date: 3 Jan 2007 22:20:13
Message: <459c726d$1@news.povray.org>
clum wrote:
Sounds like you just can't have you cake and eat it too in this case :(

Rather than applying the texture to the other bits in a separate union I 
expect the most dependable thing would be to apply at the most granular 
object level.

Perhaps use a macro with an object wrapper and pass the texture in that 
way somehow?  Or put the texture in a macro?  Without understanding the 
larger problem exactly these suggestions may very well be useless, but 
just spitballin' here.


Post a reply to this message

From: Jim Charter
Subject: Re: cutaway_textures when not using the default texture
Date: 3 Jan 2007 23:40:54
Message: <459c8556$1@news.povray.org>
Jim Charter wrote:

e.g.


#macro T(P)
   texture {
           finish{ambient .5}
           pigment { rgb P }
   }
#end

#macro DefT()
   texture {
           finish{ambient .5}
           pigment { rgb 1 }
   }
#end

union {
   difference {
     union {
       object{box {-1, 1 DefT()} T(x)}
       object{box {<-2,-1,-1><-3, 1, 1> DefT() } T(x+y)}
       object{box {<-3,-1,-1><-4, 1, 1> DefT() }}
     }
     object{box {0,<-5,2,2>}}
     cutaway_textures
   }

   object{box {<-1,-1,-1><-2, 1, 1> DefT()}}
   object{box {<-4,-1,-1><-5, 1, 1> DefT()} T(z)}

}

light_source {
   0*x
   color rgb <1,1,1>
   translate <0.0, 2.0,  15.0>
}
camera {
   location  <3.0, 6.0,  15.0>
   look_at   <0.0, 0.0,  0.0>
   right     x*image_width/image_height
}


Post a reply to this message

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