|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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] tomandlucouk> 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] 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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] citywalkcoza> 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] tomandlucouk> 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] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, 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] tomandlucouk> wrote in message news:3af02196$1@news.povray.org...
> "Nekar Xenos" <j-p### [at] citywalkcoza> 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] maccom> wrote in message
news:chrishuff-667E7B.16174602052001@news.povray.org...
> In article <3af02196$1@news.povray.org>, "Tom Melly"
> <tom### [at] tomandlucouk> 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] citywalkcoza> 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
|
|
| |
| |
|
|
|
|
| |
|
|