|
|
For the fun of it, I re-coded my original method to trace the height_field in a
step-by-step linear fashion, rather than randomly. (The statistical process
still uses rand, though.) And for added fun, I let the found y-values of the HF
determine (somewhat) the scale of the small spheres; the result looks a bit like
halftone printing. (In that process, the printed dots vary in size.) The photo
is of Sophia Loren in the film EL CID--a beautiful film to study
for its lighting and image composition, BTW.
The only value that needs changing here is foobar; it determines the "scanning
resolution" of the traces (and automatically scales the spheres.) It can be any
value at all; it doesn't depend on the pixel resolution of the image_map. I.e.,
the trace rays don't *need* to hit a HF triangle vertex / image_map pixel in
order to return a valid height value; they can hit the triangles
anywhere.
One of the reasons I decided to try this linear tracing scheme was that it might
have some relevance to the time-saving 'tiling' idea that's been mentioned (re:
eliminating unnecessary traces from the large dark areas of the image_map/HF.)
I'm working up an overall tiling scheme, and will be back with it ASAP.
Meanwhile, here's the linear-tracing code. I'm not totally sure what values
counter_x and counter_z should start with--1 or 0. Either one *works* but it
should be a logically correct value. Sorry, my brain is tired...
---------
#declare mask =
height_field {jpeg "sophia_image.jpeg"}
#declare S1 = seed(6455);
#declare counter_x = 0; // one or zero?
#declare counter_z = 0; // one or zero?
#declare foobar = 200; // You can think of this as the "scanning resolution."
union{
// two NESTED #while loops...
#while (counter_z <= foobar) // number of horizontal rows
#while (counter_x <= foobar) // number of trace rays in each row; reset after
// each row is completed.
#declare intersexion =
trace(mask, <counter_x/foobar,10,counter_z/foobar>, <0,-1,0>);
#if(rand(S1) <= intersexion.y)
// MAKE object
sphere{0,1
scale (.5/foobar)*(.3 + .7*intersexion.y)
translate <intersexion.x,0,intersexion.z>
}
#else
// make NO object
#end
#declare counter_x = counter_x + 1;
#end // of INNER #while loop
#declare counter_x = 0; // one or zero? Resets this for each new row
#declare counter_z = counter_z + 1; // to start a new row of traces
#end // of OUTER #while loop
texture {....}
}
Post a reply to this message
Attachments:
Download 'sophia_render.jpg' (341 KB)
Preview of image 'sophia_render.jpg'
|
|