|
![](/i/fill.gif) |
Am 16.04.2012 12:56, schrieb D103:
> Ok, problems. :(
>
> To generate a unique cloud map for each planet, I need to (among other things)
> load the image map and normal map.
>
> From these, I need to take samples along the x and y axis, and I don't know how
> to do so. My first thought was the trace() function, but I don't know whether I
> can get trace() to return the colour of the intersection.
>
> Second problem, even if I can use trace(), this means that I have to have the
> colour_maps in the scene in some form or another, and as the cloud_map is
> partially transparent, this would mean that the other objects would appear in
> the final render. :(
>
> Perhaps I could get around this by using two scene files? Downside would be less
> convenience, but if it's the only way...
Remember that you need to pass a #declare'd (or #local) object to
trace(). Note that trace() only probes this single object, and that this
object isn't visible in the scene unless you also instantiate it with
"object{MyObjectVariable}". You could use this to trace() a height_field
of the image.
trace() is comparatively slow for your purposes though. Instead, a
better alternative is probably to define a "pigment function", which you
can then directly evaluate to retrieve the pigment's color at any given
point. The "functions.inc" macro "eval_pigment" encapsulates this in a
simple macro:
#macro eval_pigment(pigm, vec)
#local fn = function { pigment { pigm } }
#local result = (fn(vec.x, vec.y, vec.z));
result
#end
You pass it the pigment and the point to be evaluated, and will get a
color value. (This is one of the few exceptions where functions may
return colors rather than scalars.)
Post a reply to this message
|
![](/i/fill.gif) |