|
![](/i/fill.gif) |
Hope this is the right group... Ok, trying to simulate a small planetoid and
follow the terrian in an animation. I manage to figure out how to follow the
surface using the trace function, but I would like for my camera angle to
"more smoothly" follow the surface. I'm thinking I might could use a search
macro that traces a few points ahead to find the terrian slope, tests for
the edge of the slope within a range of angles and point the camera there.
Ideas, comments, code and constructive critism are welcome.
Thanks in advance
Jonathan
red### [at] redmasq com
Current code (minus textures, lighting, and other irrelivant stuff):
#macro MyVec(MaxRad, MyObject, Long, Lat)
// I know, I never bothered to look up the actual formula to
calculate Long and Lat
// But it behaves close enough for tests.
#local Start=vrotate(vrotate(<0,0,-MaxRad>,<Lat,0,0>), <0,Long,0>);
trace(MyObject, Start, <0,0,0>-Start)
#end
#declare PlanetSize = 50000;
#declare ThePlanet = isosurface {
// Borrowed from the help files
function { f_sphere(x, y, z, 20)-fn_Pigm(x/2, y/2, z/2).gray*0.5 }
contained_by { sphere{ <0,0,0>,PlanetSize/100 }}
max_gradient 4.5
pigment { color <.7,.6,0,0,0> }
scale 2230
finish { ambient 1 }
}
#declare MyLong = clock*45;
#declare MyLat = 0;
#declare CameraVec=MyVec(PlanetSize*10/10, ThePlanet, MyLong, MyLat);
#declare LookAtVec=MyVec(PlanetSize*10/10, ThePlanet, mod(MyLong+10,360),
MyLat);
camera { location 0
look_at CameraVec*2
translate y*vlength(CameraVec)
look_at VPerp_To_Vector(LookAtVec)
}
object { ThePlanet }
Post a reply to this message
|
![](/i/fill.gif) |