POV-Ray : Newsgroups : povray.binaries.images : My first (working script) Server Time
18 Aug 2024 10:21:47 EDT (-0400)
  My first (working script) (Message 1 to 7 of 7)  
From: Thomas Lake
Subject: My first (working script)
Date: 12 May 2001 19:36:21
Message: <3afdc8f5@news.povray.org>
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? 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. 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.


Post a reply to this message


Attachments:
Download 'brick.JPG' (41 KB)

Preview of image 'brick.JPG'
brick.JPG


 

From: Kevin Ellis
Subject: Re: My first (working script)
Date: 12 May 2001 21:58:09
Message: <3afdea31@news.povray.org>
> 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?

This could be quite useful. Look in the documentation for the mod function,
this should help with what you want to do.

Kev
--
http://perso.libertysurf.co.uk/kevin.ellis


Post a reply to this message

From: Christoph Hormann
Subject: Re: My first (working script)
Date: 13 May 2001 04:10:25
Message: <3AFE41BB.2D345327@gmx.de>
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] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Thomas Lake
Subject: Re: My first (working script)
Date: 13 May 2001 04:21:44
Message: <3afe4418$1@news.povray.org>
Hmm sorry I don't understand how can the modulo function help me here?

"Kevin Ellis" <kev### [at] libertysurfcouk> wrote in message
news:3afdea31@news.povray.org...
> > 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?
>
> This could be quite useful. Look in the documentation for the mod
function,
> this should help with what you want to do.
>
> Kev
> --
> http://perso.libertysurf.co.uk/kevin.ellis
>
>
>
>


Post a reply to this message

From: Thomas Lake
Subject: Re: My first (working script)
Date: 13 May 2001 04:28:42
Message: <3afe45ba$1@news.povray.org>
> 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.
<code>

I'll have to take a good look at this, not quite sure about all of your
code, but you've given me an idea if the #if derective in the while loop.

> 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...

Yeah I know, actually that gap was WAY larger in my first render untill I
tweaked the the height of the bricks and mortar width.

> > 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.

I've read his post and I'm going to play around with it.

> > 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,

Thanks

> just the style of indention could be improved, better use a
> constant amount (like two spaces) everywhere.

Yeah, only problem is I'm lazy;-)
>
> Christoph
>
> --
> Christoph Hormann <chr### [at] gmxde>
> IsoWood include, radiosity tutorial, TransSkin and other
> things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Freddy D 
Subject: Re: My first (working script)
Date: 13 May 2001 13:20:01
Message: <3afec241$1@news.povray.org>
// init
#declare trans_value = 50;

#while (<some test here>)
  #declare trans_value = 50 - trans_value;
  object { <good object here> translate <trans_value,0,0> }
  #end  // end while

assuming the bricks are line-up to x axis..

-- 
FD aka Freddy D. aka Prof D.
Pro### [at] wanadoofr
http://profd.est-ici.org


Post a reply to this message

From: Dan Johnson
Subject: Re: My first (working script)
Date: 14 May 2001 19:16:41
Message: <3B01B909.ED7CDF0A@hotmail.com>
Thomas Lake wrote:

> Hmm sorry I don't understand how can the modulo function help me here?
>

Like this see previous reply to your first post.

#macro R2 (Block,NumBlocks,Angle,Radius)
         #local N = 0;
         #while (N<NumBlocks)
           object {Block R(Radius,Angle*N+Angle/2)translate <0,0,4*mod(N+1,2)>}

           #local N = N + 1;
         #end
#end




--
Dan Johnson

http://www.geocities.com/zapob


Post a reply to this message


Attachments:
Download 'brickarch2.gif' (6 KB)

Preview of image 'brickarch2.gif'
brickarch2.gif


 

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