POV-Ray : Newsgroups : povray.text.scene-files : Another Lightning macro : Re: Another Lightning macro Server Time
5 Jul 2024 10:54:38 EDT (-0400)
  Re: Another Lightning macro  
From: Tom Melly
Date: 2 May 2001 06:36:16
Message: <3aefe320@news.povray.org>
"Nekar Xenos" <j-p### [at] citywalkcoza> wrote in message
news:3aefc52e@news.povray.org...
> At least you got it to make multiple branches - I'm still struggling to
get
> more than 3...  I'll take a deeper look into the code and see if I can
> figure out how yours works.
>

Well, I don't know if it's applicable to your lightning macro model, but
here's a brief explanation of how I do the multiple branches (I have no idea
if this is a "standard" way of handling such things, or how efficient it
is). BTW, your lightning is looking very nice.

branch logic:

1. set counter of number of branches to 0 ("highCount")

2. set checkCount to -1 ( a kludge, it should really be 0, but we're just
about to increment it)

3. increment checkCount

4. create main branch out of joined-up cylinders

5. as each cylinder is added, use random function to decide whether to
create a fork

6. if yes, increment "highCount" and store start position for branch in
array using highCount as address (myArray[highCount] = segPosA)

7. carry on with main fork until "ground" reached

8. check if highCount > checkCount

9. if so, increment checkCount, and repeat steps 3 to 8 (this is the  #while
(checkCount < highCount) loop)

Hope that helps.


> BTW what are the file://... stuff? I got it to work without them...

Ah, that's outlook adding "file:" to // if the // are followed immediately
by anything except a space. //like this. (and if you got the code to work
with the // I'm amazed.)

>
> It would be nice if you could have a thick main bolt with decreasingly
> smaller branches :)
>

Yep, it would ;)


Post a reply to this message

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