POV-Ray : Newsgroups : povray.newusers : newbie's question - CSG&Loop Server Time
24 Nov 2024 17:52:28 EST (-0500)
  newbie's question - CSG&Loop (Message 1 to 5 of 5)  
From: dcnstrct
Subject: newbie's question - CSG&Loop
Date: 15 Aug 2007 08:45:00
Message: <web.46c2f52f1190d2489e64eda60@news.povray.org>
hi all.
as I happily played along with POV I stumbled across the following problem,
where I seem to lack basic understanding of how things work, example given:

i want the brown thingies to cut holes into the grey block:
image: www.zensorama.de/rnd_cuts1.jpg

####################################################

camera{
    location <50,16,50>
    look_at <0,0,0>
    angle 40
  }


#declare S = seed(0);
#declare Index = 1;
#while(Index <= 300)
#declare graus = 1*rand(S);             // random farbe
#declare bocks = box {<1,1,1> .1
        pigment {rgb<1,0.7,0>}
        translate <10*rand(S),3,-0.0*rand(S)>
        scale <0.4*rand(S)-1,4*rand(S),0.4*rand(S)>
        rotate <0*rand(S), 90*rand(S)-45, 90*rand(S)>
        };
    object {bocks rotate <0,90,0> translate <0,5,0> }
#declare Index = Index + 1;
#end



box {<-10,-10,-10>,<10,12,10>
        pigment { rgb <0.8,0.8,0.8>}
        translate <0,0,0>
        rotate <0*rand(S), 0*rand(S), 0*rand(S)>
        }

####################################################

where and how would I place the CSG? I managed to intersect both objects
(although this probably gave me 300 big grey blocks first;), I managed to
subtract the block from the random boxes, but vice versa didn't work...

help appreciated


Post a reply to this message

From: Sherry Shaw
Subject: Re: newbie's question - CSG&Loop
Date: 15 Aug 2007 09:14:58
Message: <46c2fc52@news.povray.org>
dcnstrct wrote:

>hi all.
>as I happily played along with POV I stumbled across the following problem,
>where I seem to lack basic understanding of how things work, example given:
>
>i want the brown thingies to cut holes into the grey block:
>image: www.zensorama.de/rnd_cuts1.jpg
>
>####################################################
>
>camera{
>    location <50,16,50>
>    look_at <0,0,0>
>    angle 40
>  }
>
>
>#declare S = seed(0);
>#declare Index = 1;
>#while(Index <= 300)
>#declare graus = 1*rand(S);             // random farbe
>#declare bocks = box {<1,1,1> .1
>        pigment {rgb<1,0.7,0>}
>        translate <10*rand(S),3,-0.0*rand(S)>
>        scale <0.4*rand(S)-1,4*rand(S),0.4*rand(S)>
>        rotate <0*rand(S), 90*rand(S)-45, 90*rand(S)>
>        };
>    object {bocks rotate <0,90,0> translate <0,5,0> }
>#declare Index = Index + 1;
>#end
>
>
>
>box {<-10,-10,-10>,<10,12,10>
>        pigment { rgb <0.8,0.8,0.8>}
>        translate <0,0,0>
>        rotate <0*rand(S), 0*rand(S), 0*rand(S)>
>        }
>
>####################################################
>
>where and how would I place the CSG? I managed to intersect both objects
>(although this probably gave me 300 big grey blocks first;), I managed to
>subtract the block from the random boxes, but vice versa didn't work...
>
>help appreciated
>
>
>
>
>
>
>  
>
Try this and see if it's what you need:


#declare S = seed(0);
difference {
box {<-10,-10,-10>,<10,12,10>
        pigment { rgb <0.8,0.8,0.8>}
        translate <0,0,0>
        rotate <0*rand(S), 0*rand(S), 0*rand(S)>
        }
#declare Index = 1;
#while(Index <= 300)
#declare graus = 1*rand(S);             // random farbe
#declare bocks = box {<1,1,1> .1
        pigment {rgb<1,0.7,0>}
        translate <10*rand(S),3,-0.0*rand(S)>
        scale <0.4*rand(S)-1,4*rand(S),0.4*rand(S)>
        rotate <0*rand(S), 90*rand(S)-45, 90*rand(S)>
        };
    object {bocks rotate <0,90,0> translate <0,5,0> }
#declare Index = Index + 1;
#end
}

Hope this helps.

--Sherry Shaw

-- 
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}//                                   TenMoons


Post a reply to this message

From: dcnstrct
Subject: Re: newbie's question - CSG&Loop
Date: 15 Aug 2007 09:55:01
Message: <web.46c3057ae29cc73e9e64eda60@news.povray.org>
Sherry Shaw <tenmoonsPutAtCharacterHereaol-dot-com> wrote:
> [...]
>
> Hope this helps.
>
> --Sherry Shaw


it did, thanks :)


(which leads to another question:
if I add a color to the final csg-object, the cutted surfaces don't change.
Am I doing something wrong or is it that I can't overwrite given properties
and I would have to remove the color from the random boxes?)


Post a reply to this message

From: M a r c
Subject: Re: newbie's question - CSG&Loop
Date: 15 Aug 2007 10:10:17
Message: <46c30949$1@news.povray.org>

web.46c3057ae29cc73e9e64eda60@news.povray.org...
>
> (which leads to another question:
> if I add a color to the final csg-object, the cutted surfaces don't 
> change.
> Am I doing something wrong or is it that I can't overwrite given 
> properties
> and I would have to remove the color from the random boxes?)
>
You answered your own question :-)
If you want the random boxes cutting their own color or texture, give them 
one.
If you want the  CSG has a whole texture don't give properties to nested 
objects

Marc


Post a reply to this message

From: Christian Froeschlin
Subject: Re: newbie's question - CSG&Loop
Date: 16 Aug 2007 11:44:33
Message: <46c470e1$1@news.povray.org>
M_a_r_c wrote:

> You answered your own question :-)
> If you want the random boxes cutting their own color or texture, give them 
> one.
> If you want the  CSG has a whole texture don't give properties to nested 
> objects

or use the keyword cutaway_textures which specifies that the
texture of the clipped object is retained instead of applying
that of the clipping object.  Although I remember the results
were not always what I expected when the differencing
complex CSG structures ;)


Post a reply to this message

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