|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |