 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
A new trend? The main problem with this macro is that changing one param.
has too great an effect on the behaviour of other params. Oh, and the bolt
is upside down.
// lightning macro w/ sample scene
#version unofficial MegaPov 0.6;
camera{location <0.0, 0.5, -25.0> look_at <0.0, 0.0, 0.0>}
//LArraySize = increase this if you get array error messages
//LSeed = random seed for bolt
//LWidth = width of bolt threads
//LHeight = height of whole bolt
//LSpread = spread of bolt
//LBranch = increase for more spikes
//LCutoff = start point for possible forks
//LSpike = increase for a more jagged bolt
#macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff, LSpike)
#declare myArray = array[LArraySize]
#declare checkCount = -1;
#declare highCount = 0;
#declare arrayCount = 0;
#declare myArray[arrayCount] = <0,0,0>;
#declare myRand = seed(LSeed);
#declare Lightning_Bolt =
merge{
#while (checkCount < highCount)
#declare checkCount = checkCount + 1;
#declare segPosA = myArray[arrayCount];
#declare arrayCount = arrayCount + 1;
#declare xPlus = (rand(myRand)-0.5)*LSpread;
#declare zPlus = (rand(myRand)-0.5)*LSpread;
#while(segPosA.y < LHeight)
#declare xShift = segPosA.x + ((rand(myRand)-0.5)*LSpike) + xPlus;
#declare yShift = segPosA.y + (rand(myRand)/5);
#declare zShift = segPosA.z + ((rand(myRand)-0.5)*LSpike) + zPlus;
#if (yShift > LHeight)
#declare yShift = LHeight;
#end
#declare segPosB = <xShift, yShift, zShift>;
cylinder{segPosA, segPosB, LWidth}
sphere{segPosB, LWidth + 0.0001}
#declare segPosA = segPosB;
#declare randNum = rand(myRand);
#if (randNum < LBranch & segPosA.y > LCutoff)
#declare highCount = highCount + 1;
#declare myArray[highCount] = segPosA;
#end
#end
#end
}
#end
Make_Bolt(500, 7, 0.05, 6, 0.3, 0.065, 0.5, 0.5)
object{
Lightning_Bolt
pigment{rgbf 1}
interior{media{emission rgb <40,40,50>} media{absorption rgb <50,50,40>}}
hollow on
rotate x*180
no_shadow
translate y*6
}
--
"To stop children being afraid of the dark, try to fill their daylight hours
with as much terror as possible"
www.tomandlu.co.uk
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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.
BTW what are the file://... stuff? I got it to work without them...
It would be nice if you could have a thick main bolt with decreasingly
smaller branches :)
Nekar
"Tom Melly" <tom### [at] tomandlu co uk> wrote in message
news:3aed8503$1@news.povray.org...
> A new trend? The main problem with this macro is that changing one param.
> has too great an effect on the behaviour of other params. Oh, and the bolt
> is upside down.
>
> // lightning macro w/ sample scene
>
> #version unofficial MegaPov 0.6;
> camera{location <0.0, 0.5, -25.0> look_at <0.0, 0.0, 0.0>}
>
> file://LArraySize = increase this if you get array error messages
> file://LSeed = random seed for bolt
> file://LWidth = width of bolt threads
> file://LHeight = height of whole bolt
> file://LSpread = spread of bolt
> file://LBranch = increase for more spikes
> file://LCutoff = start point for possible forks
> file://LSpike = increase for a more jagged bolt
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Nekar Xenos" <j-p### [at] citywalk co za> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I've changed Tom Melly's version a bit and I think it's looking good.
Nekar
// lightning macro w/ sample scene
#version unofficial MegaPov 0.6;
#include "colors.inc"
global_settings
{
assumed_gamma 1.0
}
// ----------------------------------------
camera{location <0, 0.5, -10.0> look_at <2, 1.2, 0.0>}
sky_sphere
{
pigment
{
bozo
color_map { [0.0 color rgb <0.1, 0.2, 0.3>] [1.0 color rgb <0.11, 0.3,
0.4>] }
// scale <0.1, 0.01, 10>
}
scale <0.1, 0.05, 100>
}
light_source
{
0*x // light's position (translated below)
color red 1.0 green 1.0 blue 1.0 // light's color
translate <-30, 30, -30>
}
// ----------------------------------------
plane { y, -1 pigment { color rgb <0.7, 0.5, 0.3> }
normal{bumps
scale 3 }
}
plane { y, 0 pigment {bozo
color_map { [0.0 color rgbt <0,0,0,1>] [1.0 color rgbt <0.11, 0.3, 0.4,
0>] }
scale 10
}
normal{bumps
scale <1,1,10>}
rotate x*180
translate y*10
}
fog
{
// fog_type 4
distance 50
color rgb 0
}
/*
file://LArraySize = increase this if you get array error messages
file://LSeed = random seed for bolt
file://LWidth = width of bolt threads
file://LHeight = height of whole bolt
file://LSpread = spread of bolt
file://LBranch = increase for more spikes
file://LCutoff = start point for possible forks
file://LSpike = increase for a more jagged bolt
*/
#macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff, LSpike)
#declare myArray = array[LArraySize]
#declare checkCount = -1;
#declare highCount = 0;
#declare arrayCount = 0;
#declare myArray[arrayCount] = <0,0,0>;
#declare myRand = seed(LSeed);
#declare Lightning_Bolt =
// blob{ threshold 0.001 //
merge{
#while (checkCount < highCount)
#declare checkCount = checkCount + 1;
#declare segPosA = myArray[arrayCount];
#declare arrayCount = arrayCount + 1;
#declare xPlus = (rand(myRand)-0.5)*LSpread;
#declare zPlus = (rand(myRand)-0.5)*LSpread;
#while(segPosA.y < LHeight)
#declare xShift = segPosA.x + ((rand(myRand)-0.5)*LSpike) + xPlus;
#declare yShift = segPosA.y + (rand(myRand)/5);
#declare zShift = segPosA.z + ((rand(myRand)-0.5)*LSpike) + zPlus;
#if (yShift > LHeight)
#declare yShift = LHeight;
#end
#declare segPosB = <xShift, yShift, zShift>;
cylinder{segPosA, segPosB, LWidth}
// cylinder{segPosA, segPosB, LWidth*2 + 0.0001 } // pigment{rgbt
1}interior{media{emission<1,2,2> }}hollow no_shadow}
// sphere{segPosB, LWidth + 0.0001}
#declare segPosA = segPosB;
#declare randNum = rand(myRand);
#if (randNum < LBranch & segPosA.y > LCutoff)
#declare highCount = highCount + 1;
#declare myArray[highCount] = segPosA;
#end
#declare LWidth = (LWidth*0.995) ;
#end
#declare LWidth = (LWidth*0.9) ;
#end
}
#end
/*
Make_Bolt(500, 1110, 0.05, 6, 0.3, 0.01, 0.5, 0.2)
object{
Lightning_Bolt
pigment{rgbt 1}interior{media{emission<1,5,5>*3 }}hollow
// hollow on
rotate x*180
no_shadow
translate y*6
}
*/
Make_Bolt(500, 11, 0.03, 6, 0.3, 0.01, 0.5, 0.2)
object{
Lightning_Bolt
pigment{rgbt 1}interior{media{emission<1,5,5>*3 }}hollow
// hollow on
rotate x*180
no_shadow
translate y*6
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Nekar Xenos" <j-p### [at] citywalk co za> wrote in message
news:3af015bc@news.povray.org...
> I've changed Tom Melly's version a bit and I think it's looking good.
Now, if only emitting media worked with radiosity....
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3af02196$1@news.povray.org>, "Tom Melly"
<tom### [at] tomandlu co uk> wrote:
> Now, if only emitting media worked with radiosity....
Use MegaPOV...it's required (well, used) for this macro anyway.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Replacing
merge{
with
blob{threshold 1
and adding
,1
into the cylinder statement makes it a lot faster.
I've also tried replacing the cylinder with my own lightning and it worked well,
making it nicely scalable without any unnatural straight parts.
Nekar
"Tom Melly" <tom### [at] tomandlu co uk> wrote in message news:3af02196$1@news.povray.org...
> "Nekar Xenos" <j-p### [at] citywalk co za> wrote in message
> news:3af015bc@news.povray.org...
> > I've changed Tom Melly's version a bit and I think it's looking good.
>
> Now, if only emitting media worked with radiosity....
>
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Chris Huff" <chr### [at] mac com> wrote in message
news:chrishuff-667E7B.16174602052001@news.povray.org...
> In article <3af02196$1@news.povray.org>, "Tom Melly"
> <tom### [at] tomandlu co uk> wrote:
>
> > Now, if only emitting media worked with radiosity....
>
> Use MegaPOV...it's required (well, used) for this macro anyway.
>
Hmm, well I ran this with mp (obviously), but I can't get the lightening to
light up the scene, which would seem to indicate that emitting media doesn't
contribute to radiosity. Am I missing something?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Nekar Xenos" <j-p### [at] citywalk co za> wrote in message
news:3af11d83@news.povray.org...
> Replacing
>
> merge{
> with
> blob{threshold 1
>
> and adding
>
> ,1
>
> into the cylinder statement makes it a lot faster.
>
> I've also tried replacing the cylinder with my own lightning and it
worked well, making it nicely scalable without any unnatural straight parts.
>
Will you post your modified version (the one using your lightning)?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> Will you post your modified version (the one using your lightning)?
I was going to but I had that stiffy(3.5" disk unable to read stuff) problem
again. Can't wait till I get a CDRW so that I can bring files from home...
I'll try again tomorrow. But I think it would be better if I could
completely replace you branches with mine. That would be easy if you could
modify your version to have only straight arms without the 'jaggedness'.
Could you try that for me. I'm still rather 'new' to coding so it's not
always that easy for me to decipher what is what.
Thanks
Nekar
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Nekar Xenos" <j-p### [at] citywalk co za> wrote in message
news:3af12624@news.povray.org...
> > Will you post your modified version (the one using your lightning)?
>
> I was going to but I had that stiffy(3.5" disk unable to read stuff)
problem
> again. Can't wait till I get a CDRW so that I can bring files from home...
> I'll try again tomorrow. But I think it would be better if I could
> completely replace you branches with mine. That would be easy if you could
> modify your version to have only straight arms without the 'jaggedness'.
> Could you try that for me. I'm still rather 'new' to coding so it's not
> always that easy for me to decipher what is what.
>
> Thanks
>
Well, removing the jaggedness is easy enough:
#declare xShift = segPosA.x; // + ((rand(myRand)-0.5)*LSpike) + xPlus;
#declare yShift = segPosA.y + 0.5; // (rand(myRand)/5);
#declare zShift = segPosA.z; // + ((rand(myRand)-0.5)*LSpike) + zPlus;
The trouble is that all the forks then just go straight down. Is that what
you meant? (probably not).
The most significant params are LSpread and LSpike in terms of the basic
shape of the bolt.
Try these four settings:
//Make_Bolt(500, 11211, 0.03, 6, 0.3, 0.05, 0.5, 0.2) // normal (whatever
that means)
//Make_Bolt(500, 11211, 0.03, 6, 0.0003, 0.05, 0.5, 0.2) // small LSpread -
quite nice!
//Make_Bolt(500, 11211, 0.03, 6, 0.3, 0.05, 0.5, 0.0002) // small LSpike
//Make_Bolt(500, 11211, 0.03, 6, 0.0003, 0.05, 0.5, 0.0002) // small LSpread
and LSpike
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Tom Melly" <tom### [at] tomandlu co uk> wrote in message
news:3af132c1@news.povray.org...
Oh, Outlook....
Make_Bolt(500, 11211, 0.03, 6, 0.3, 0.05, 0.5, 0.2) // normal
Make_Bolt(500, 11211, 0.03, 6, 0.0003, 0.05, 0.5, 0.2) // small LSpread -
nice
Make_Bolt(500, 11211, 0.03, 6, 0.3, 0.05, 0.5, 0.0002) // small LSpike
Make_Bolt(500, 11211, 0.03, 6, 0.0003, 0.05, 0.5, 0.0002) // small LSpread &
LSpike
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3af1203a$1@news.povray.org>, "Tom Melly"
<tom### [at] tomandlu co uk> wrote:
> Hmm, well I ran this with mp (obviously), but I can't get the
> lightening to light up the scene, which would seem to indicate that
> emitting media doesn't contribute to radiosity. Am I missing
> something?
Yeah, you are. From the MegaPOV documentation, section 10.2.7,
"Miscellaneous changes & bug fixes":
"Radiosity estimation can be affected by media. To enable this feature,
add media on to the radiosity {} block within global_settings {}."
Sorry I wasn't more specific in my previous post...
PS: "lightning", not "lightening". The same error was made in the
include files...
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Thanks, I'll see what I can do.
BTW a workaround for the file://problem is to /* use these */ instead
Nekar
"Tom Melly" <tom### [at] tomandlu co uk> wrote in message
news:3af1333c@news.povray.org...
> "Tom Melly" <tom### [at] tomandlu co uk> wrote in message
> news:3af132c1@news.povray.org...
>
> Oh, Outlook....
>
> Make_Bolt(500, 11211, 0.03, 6, 0.3, 0.05, 0.5, 0.2) // normal
> Make_Bolt(500, 11211, 0.03, 6, 0.0003, 0.05, 0.5, 0.2) // small LSpread -
> nice
> Make_Bolt(500, 11211, 0.03, 6, 0.3, 0.05, 0.5, 0.0002) // small LSpike
> Make_Bolt(500, 11211, 0.03, 6, 0.0003, 0.05, 0.5, 0.0002) // small LSpread
&
> LSpike
>
>
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Chris Huff" <chr### [at] mac com> wrote in message
news:chrishuff-264ADB.05301703052001@news.povray.org...
> In article <3af1203a$1@news.povray.org>, "Tom Melly"
> <tom### [at] tomandlu co uk> wrote:
>
>
> Yeah, you are. From the MegaPOV documentation, section 10.2.7,
> "Miscellaneous changes & bug fixes":
>
> "Radiosity estimation can be affected by media. To enable this feature,
> add media on to the radiosity {} block within global_settings {}."
Aha! Many thanks.
>
> Sorry I wasn't more specific in my previous post...
You are forgiven ;)
> PS: "lightning", not "lightening". The same error was made in the
> include files...
I know, I know.... I've corrected several, but missed more. It's a word that
I habitually mispell. My mind knows how it is spelt, but my fingers
disagree...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
What I actually meant is it should have straight branches like the tree in
Robert J Becrafts IRTC fortress entry.(posted 2001/04/28 21:56 PM in
p.b.i.). The number of cylinders in the whole lightning bolt should be the
same as the number of branches(stem included). So it would look like a
'stick drawing'.
Like this:
\
/\_
/I I I\
Each symbol represents 1 cylinder.
As I have exact control over where to put my lightning bolt I can then just
replace each cylinder with one of my lightning bolts.
I hope this explains it better.
Thanks
Nekar
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Nekar Xenos" <j-p### [at] citywalk co za> wrote in message
news:3af141f5@news.povray.org...
<snip>
Ah! Now I understand. Hmm, my first thought was that this was impossible
with the way my macro works, but I have a cunning plan....
Get back to you later...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hey, it worked! (image in binary.images - no lights, just emitting media)
"Chris Huff" <chr### [at] mac com> wrote in message
news:chrishuff-264ADB.05301703052001@news.povray.org...
>
> Yeah, you are. From the MegaPOV documentation, section 10.2.7,
> "Miscellaneous changes & bug fixes":
>
> "Radiosity estimation can be affected by media. To enable this feature,
> add media on to the radiosity {} block within global_settings {}."
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly wrote in message <3af14d7a$1@news.povray.org>...
>
>Get back to you later...
>
Try this - you only get an object stretching between junctions, you can also
use any object as your key shape.
// use any object as your building block (needs to take 2 co-ords)
#macro Cylinder_Object(CStart, CEnd, CWidth)
cylinder{CStart, CEnd, CWidth}
#end
#macro Box_Object(BCorner1, BCorner2)
box{BCorner1, BCorner2}
#end
//plane{y, 0 pigment{checker Gray, Green}}
#macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff)
#declare myArray = array[LArraySize]
#declare checkCount = -1;
#declare highCount = 0;
#declare arrayCount = 0;
#declare myArray[arrayCount] = <0,0,0>;
#declare myRand = seed(LSeed);
#declare Lightning_Bolt =
merge{
#while (checkCount < highCount)
#declare checkCount = checkCount + 1;
#declare segPosA = myArray[arrayCount];
#declare segPosB = segPosA;
#declare arrayCount = arrayCount + 1;
#declare xPlus = (rand(myRand)-0.5)*LSpread;
#declare zPlus = (rand(myRand)-0.5)*LSpread;
#declare no_base = true;
#while(segPosB.y < LHeight)
#declare xShift = segPosB.x + xPlus;
#declare yShift = segPosB.y + (rand(myRand)/5);
#declare zShift = segPosB.z + zPlus;
#if (yShift > LHeight)
#declare yShift = LHeight;
#end
#declare segPosB = <xShift, yShift, zShift>;
#declare randNum = rand(myRand);
#if (randNum < LBranch & segPosB.y > LCutoff) // we only need a new
cylinder here
Cylinder_Object(segPosA, segPosB, LWidth)
// Box_Object(segPosA, segPosB)
#declare no_base = false;
#declare segPosA = segPosB;
#declare highCount = highCount + 1;
#declare myArray[highCount] = segPosA;
#end
#end
#if(no_base & segPosB.y < LHeight)
Cylinder_Object(segPosA, segPosB, LWidth)
// Box_Object(segPosA, segPosB)
#end
#declare LWidth = (LWidth*0.9);
#end
}
#end
//#macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff)
Make_Bolt(500, 11211, 0.03, 6, 0.5, 0.05, 0.5)
object{
Lightning_Bolt
pigment{rgbt 1}
interior{media{emission<3,3,5>*5}}
hollow
rotate x*180
no_shadow
translate y*5
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Thanks.
I probably won't be here again before Monday. I'll post the result then.
Nekar
--
#version unofficial MegaPov 0.7;#local Q=seed(7);#local S=<-2,2,5>;#local
E=<2
,-2,5>;#local B=S;#while(vlength(B-E)>.1)#local
B=(B+(<rand(Q),rand(Q),rand(Q)
>/20));#local B=B-(2*(B-S))*((vlength(B-E)>vlength(S-E)));#local
S=B;glow{//NX
location S size.1 radius.07}glow{location S size.1 radius.07 rotate
z*90}#end
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I've added my lightning in but there are empty spaces between the branches.
I'm not quite sure why.
Nekar
#version unofficial MegaPov 0.6;
camera{location <0.0, 0.5, -10.0> look_at <2, 1, 0.0>}
// use any object as your building block (needs to take 2 co-ords)
#macro Cylinder_Object(CStart, CEnd, CWidth)
cylinder{CStart, CEnd, CWidth}
#end
#macro Box_Object(BCorner1, BCorner2)
box{BCorner1, BCorner2}
#end
// plane{y, 0 pigment{checker Gray, Green}}
#macro Bolt (LightnStart, LightnEnd, Scale,Seed)
#ifndef (Seed)
#local Seed=seed(0) ;
#end
#ifndef (LightnStart)
#local LightnStart=<0,0,0> ;
#end
#ifndef (LightnEnd)
#local LightnEnd=<0,0,0> ;
#end
#ifndef (Scale)
#local Scale=0.05 ;
#end
// #ifndef (Color)
// #local Color=<1,1,1> ;
// #end
#local Seed = seed(Seed);
#local BlobPosition = LightnStart ;
blob{
threshold 1 // 0.6
sphere { <0,0,0>, 0.1, 0.1
scale Scale
translate LightnStart
}
///// Add random blob closer to lightnEnd
#while (vlength(BlobPosition - LightnEnd) > 0.1)
#local Rx=rand(Seed); #local Ry=rand(Seed); #local Rz=rand(Seed);
#local BlobPosition = ( BlobPosition + (<0.5-Rx, 0.5-Ry,
0.5-Rz> * 0.04 ) ) ;
#if ( ( vlength(BlobPosition - LightnEnd) > vlength (LightnStart -
LightnEnd) ))
#local BlobPosition = (BlobPosition - ( 2*(BlobPosition -
LightnStart) )) ;
#end
#local LightnStart = BlobPosition ;
sphere { <0,0,0>, 1, 1
scale Scale
translate LightnStart
}
#end
sphere { <0,0,0>, 1, 1
scale Scale
translate LightnEnd }
// pigment{rgbt 1}interior{media{emission Color }}hollow
}
#end
#macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff)
#declare myArray = array[LArraySize]
#declare checkCount = -1;
#declare highCount = 0;
#declare arrayCount = 0;
#declare myArray[arrayCount] = <0,0,0>;
#declare myRand = seed(LSeed);
#declare Lightning_Bolt =
merge{
#while (checkCount < highCount)
#declare checkCount = checkCount + 1;
#declare segPosA = myArray[arrayCount];
#declare segPosB = segPosA;
#declare arrayCount = arrayCount + 1;
#declare xPlus = (rand(myRand)-0.5)*LSpread;
#declare zPlus = (rand(myRand)-0.5)*LSpread;
#declare no_base = true;
#while(segPosB.y < LHeight)
#declare xShift = segPosB.x + xPlus;
#declare yShift = segPosB.y + (rand(myRand)/5);
#declare zShift = segPosB.z + zPlus;
#if (yShift > LHeight)
#declare yShift = LHeight;
#end
#declare segPosB = <xShift, yShift, zShift>;
#declare randNum = rand(myRand);
#if (randNum < LBranch & segPosB.y > LCutoff) // we only need a new
cylinder here
// Bolt (LightnStart, LightnEnd, Scale, Seed)
Bolt (segPosA, segPosB,LWidth,myRand)
// Cylinder_Object(segPosA, segPosB, LWidth*2)
// Box_Object(segPosA, segPosB)
#declare no_base = false;
#declare segPosA = segPosB;
#declare highCount = highCount + 1;
#declare myArray[highCount] = segPosA;
#end
#end
#if(no_base & segPosB.y < LHeight)
Bolt (segPosA, segPosB,LWidth,myRand)
// Cylinder_Object(segPosA, segPosB, LWidth*2)
// Box_Object(segPosA, segPosB)
#end
#declare LWidth = (LWidth*0.95);
#end
}
#end
// #macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff)
Make_Bolt(500, 11, 0.05, 6, 0.1, 0.06, 0.5)
object{
Lightning_Bolt
pigment{rgbt 1}
interior{media{emission<3,4,5>}}
hollow
rotate x*180
no_shadow
translate y*5
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |