|
|
High!
I want to place objects randomly on an isosurface; as the isosurface lies
perpendicular to the y axis, I tested for directions parallel to the y axis
rather than pointing towards <0, 0, 0>.
But obviously all these rays missed - in a #warning output line, I always
get 0.00000 for the x and z components of trace(). What went wrong? Is it
in fact impossible, as the manual suggests, to safely test for
intersections other than
(Object, start_vector, -start_vector)? I even defined an auxiliary object
and translated it so that the starting point is exactly above the origin,
but this also failed...
Here are the relevant parts of the scene:
#declare Terrain_Part1_Function=
function
{
pattern
{
granite
scale 10
poly_wave 0.333
}
}
#declare Terrain_Part2_Function=
function
{
pattern
{
bozo
turbulence 2
octaves 5
}
}
#declare Terrain_Function=
function
{
y + Terrain_Part1_Function(x, 0, z)
+ Terrain_Part2_Function(x, y, z)*0.0004
}
#declare Terrain=
isosurface
{
function { Terrain_Function(x, y, z) }
contained_by
{
box { -10, 10 }
}
max_gradient 3
accuracy 0.0001
#if (!map)
texture { T_Sand }
#else
// texture { T_Physical_Map scale 2 }
#end
}
#declare r1=seed(1584);
#declare r2=seed(2953);
#declare r3=seed(5930);
#declare r4=seed(8634);
#declare Ball=
sphere
{
0, 1
}
object { Terrain }
#declare s=<4, 20, 5>;
#declare a=<4, -20, 5>;
#declare pos=trace(Terrain, s, a)+<0, 0.0017, 0>;
#if (!map)
#if (ground=1)
camera
{
location pos
look_at pos+<0, sin((-90+(clock*0.5))*(pi/180)),
sin(clock*0.5*(pi/180))>
angle 40
}
#else
camera
{
location <15, 8, -15>
look_at 0
angle 40
}
#end
#else
camera
{
orthographic
location <0, 50, 0>
look_at 0
angle 40
}
#end
#if (balls=1)
#declare a=0;
#while (a<1000)
#declare xpos=rand(r1)*20-10;
#declare zpos=rand(r2)*20-10;
#declare Terrain_Temporary=
object { Terrain translate <-xpos, 0, -zpos> }
#declare trvect=<0, 20, 0>;
#declare rad=0.01+rand(r3)/100*9;
#declare pos=trace(Terrain_Temporary, trvect, -trvect)+<0, rad, 0>;
#warning concat("<", str(pos.x, 2, -1), ", ", str(pos.y, 2, -1), ", "
str(pos.z, 2, -1), ">")
object
{
Ball
scale rad
translate pos
texture
{
pigment
{
color rgb <1, 0, 0>
}
finish
{
ambient 0.1
diffuse 0.9
brilliance 0.7
phong 150
phong_size 0.5
reflection 0.6
metallic
}
}
}
#declare a=a+1;
#end
#end
See you on www.khyberspace.de !
Yadgar
Now playing: my loved one on his Ensoniq synthesizer
Post a reply to this message
|
|