|
|
I will try height field and lights with this image.
It's rsult is very good,I think.
Y.Tanabe
Kobe,Japan
//code start
// Mega Persistence of Vision Ray Tracer 0.7 Scene Description File
#version unofficial MegaPov 0.7;
global_settings
{
assumed_gamma 1.8
}
camera
{
orthographic
location <0,0,-5>
up <0,5,0>
right <5,0,0> * image_width / image_height
direction <0,0,1>
look_at <0,0,0>
}
sky_sphere {pigment {color rgb <0.25,0.25,0.25>}}
light_source {<0,0,-50> color rgb <1,1,1> parallel point_at <0,0,0>}
light_source {<-50,50,-50> color rgb <1,0,0> * 2.82 parallel point_at <0,0,0>}
light_source {<-50,-50,-50> color rgb <0,0,1> * 2.82 parallel point_at <0,0,0>}
light_source {<50,50,-50> color rgb <0,0,1> * 2.82 parallel point_at <0,0,0>}
light_source {<50,-50,-50> color rgb <1,0,0> * 2.82 parallel point_at <0,0,0>}
light_source {<0,50,-50> color rgb <0,1,0> * 1.414 parallel point_at <0,0,0>}
light_source {<0,-50,-50> color rgb <0,1,0> * 1.414 parallel point_at <0,0,0>}
light_source {<50,0,-50> color rgb <0,1,0> * 1.414 parallel point_at <0,0,0>}
light_source {<-50,0,-50> color rgb <0,1,0> * 1.414 parallel point_at <0,0,0>}
//This determines the final size of the height field.
//It is used used to scale and translate tthe HF so it is centered at the origin
(<0,0,0>).
#declare square_size = 5;
//This reads in the height field data
#debug "\nStart height field parsing....\n"
#declare hf =
height_field
{
png "lights.png"
smooth
pigment
{
gradient y
color_map
{
[0.0 rgb 0]
[0.0625 rgb 0.0625]
[0.125 rgb 0.125]
[0.1875 rgb 0.1875]
[0.25 rgb 0.25]
[0.3125 rgb 0.3125]
[0.375 rgb 0.375]
[0.4375 rgb 0.4375]
[0.5 rgb 0.5]
[0.5625 rgb 0.5625]
[0.625 rgb 0.625]
[0.6875 rgb 0.6875]
[0.75 rgb 0.75]
[0.8125 rgb 0.8125]
[0.875 rgb 0.875]
[0.9375 rgb 0.9375]
[1.0 rgb <1,1,1>]
}
}
scale <square_size,1,square_size>
translate <-square_size/2,0,-square_size/2>
}
#debug "\nFinish height field parsing\n"
//create Mesh
#declare interval = square_size / 80; // the higher the number,the finer the grid
patter
#declare CX = -square_size/2+interval/2; // do not alter
#declare CZ = -square_size/2+interval/2; //do not alter
#declare cyl_width = 0.005; //width of the cylinder components of the
grid
#declare cyl_tex = texture{pigment {color rgb <1,1,1> }} // texture of the grid itself
#debug "\nStarting grid formation\n"
#declare grid =
union
{
#while(CX < square_size/2-interval/2)
#debug concat ( "CX = ",str (CX,3,3)," of ",str(square_size/2,3,3),"\n")
#while(CZ < square_size/2-interval/2)
#declare YValue = trace(hf,<CX,20,CZ>,-y);
#declare YValueX1 = trace(hf,<CX+interval,20,CZ>,-y);
#declare YValueZ1 = trace(hf,<CX,20,CZ+interval>,-y);
#if(YValue.x = 0 & YValue.y = 0 & YValue.z = 0)
//do nothing
#else
cylinder {<CX,YValue.y,CZ>,<CX+interval,YValueX1.y,CZ>,cyl_width texture
{cyl_tex}}
cylinder {<CX,YValue.y,CZ>,<CX,YValueZ1.y,CZ+interval>,cyl_width texture
{cyl_tex}}
#end
#declare CZ = CZ + interval;
#end
#declare CZ = -square_size/2+interval/2;
#declare CX = CX + interval;
#end
// cap off +X axis
#declare CX1 = square_size/2-interval/2;
#declare CZ1 = -square_size/2+interval/2;
#while(CZ1 <= square_size/2-interval/2)
#declare YValue = trace(hf,<CX1,20,CZ1>,-y);
#declare YValueX1 = trace(hf,<CX1+interval,20,CZ1>,-y);
#declare YValueZ1 = trace(hf,<CX1,20,CZ1+interval>,-y);
cylinder {<CX1,YValue.y,CZ1>,<CX1,YValueZ1.y,CZ1+interval>,cyl_width texture
{cyl_tex}}
#declare CZ1 = CZ1 + interval;
#end
// cap off +z axis
#declare CX2 = -square_size/2+interval/2;
#declare CZ2 = square_size/2-interval/2;
#while(CX2 <= square_size/2-interval/2)
#declare YValue = trace (hf,<CX2,20,CZ2>,-y);
#declare YValueX1 = trace (hf,<CX2+interval,20,CZ2>,-y);
#declare YValueZ1 = trace (hf,<CX2,20,CZ2+interval>,-y);
cylinder {<CX2,YValue.y,CZ2>,<CX2+interval,YValueX1.y,CZ2>,cyl_width texture
{cyl_tex}}
#declare CX2 = CX2 + interval;
#end
}
// objects
union
{
//object {grid translate <0,cyl_width,0>}
object {hf}
rotate x*-90
}
//end code
Post a reply to this message
Attachments:
Download 'lighthf.jpg' (311 KB)
Preview of image 'lighthf.jpg'
|
|