|
![](/i/fill.gif) |
Thomas Lake wrote:
>
> IF you were wondering what the hell I was talking about in my previous post
> you can forget about it, I solved the problem, actually I simply realized
> that what I was trying to do didn't make any sense at all, and that there
> was a far easier way of doing it. I've posted a sample picture here. It
> should be very easy to make this into a macro. The script is quite flexible,
> you can change the width, height, and length of the bricks, the width of the
> mortar, and the width, height and length of the tunnel. There are still some
> things I need to do. For example I'd like to be able to stagger the bricks
> so that they don't all line up. I don't know how to do this, I could
> translate every second row twice the amount I translate the other rows, but
> I'm not sure how to do this in the while loops I'm using, maybe someone can
> help?
Here is the loop i use for my current 'water tunnel' scene. It's quite
ugly and uses a Block() macro generating a box like shape with origin in
the middle of the one side of the box. I'm not sure if it's of much use,
but you can see how to alternate the lines of bricks with the 'Sw'
variable. BTW, it only generates one half of the tube and randomly varies
the length of the bricks.
#declare Sw=-1;
#declare RA = seed(134);
#declare CCnt=(TBlockZ*0.61/TubeRadius)*(180/pi);
#while (CCnt<90)
union {
#declare LCnt=0;
#while (LCnt<TubeLength)
#declare Len=BlockX*(1.5-rand(RA)*0.7);
#if (LCnt=0)
#declare Len=Len-((Sw>0)?BlockX*0.6:0);
#end
object {
Block(Len, BlockY, BlockZ*1.02, BrickRound, true)
translate <LCnt, TubeRadius, 0>
rotate (90-CCnt)*x
}
#declare LCnt=LCnt+Len*1.02;
#end
#declare CCnt=CCnt + (BlockZ*1.03/TubeRadius)*(180/pi);
#declare Sw=-Sw;
}
#end
Also note that to avoid the unnatural gap on the left side of the curved
part in your picture you either have to tweak the 'BlockZ' value of do
some exact geometrical calculations which i was to lazy for...
> The other thing I'm going to do is add some randomness into the scene,
> take a look at my next post and let me know if there is a better way of
> handling randomness.
As Dave Blandston mentioned, you will probably want to multiply the rand()
values with a factor to get the required range.
> Please take a look at the source file for this image in
> p.t.scene-files and let me know what you think, this is my first try at
> scripting so feedback would be helpful.
>
It looks good, just the style of indention could be improved, better use a
constant amount (like two spaces) everywhere.
Christoph
--
Christoph Hormann <chr### [at] gmx de>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
![](/i/fill.gif) |