|Context(s)||displace fog light shadow surface|
int scatter(vector ipoint, vector inormal, vector idirection, vector idistribution, float time, float maxdist, vector &opoint, vector &onormal, vector &odirection)
Evaluates a single scattering event through geometry. A return value of 1 means the scattering was successful.
Entry point of scattering.
Surface normal at the entry point (surfaces only). Required to orient the scattering plane.
Primary scattering direction at the entry point. Required to orient the scattering plane.
Initial scatter distribution at the entry point. If a zero-valued vector is passed a random scatter distribution will be used.
Maximum distance to scatter.
Exit point of scattering.
Normal at the scattering exit point (surfaces only).
Outgoing direction at the scattering exit point (surfaces only).
// Trace for intersection with scene vector hitP = 0; vector hitN = 0; int hit = trace(P, I, Time, "P", hitP, "N", hitN); // Scatter a random distance from the intersection vector idistribution = 0; int sid = israytrace ? SID : newsampler(); vector s; nextsample(sid, s.x, s.y, "mode", "nextpixel"); float maxdist = 2.0 * s.x; vector opoint = 0; vector onormal = 0; vector odirection = 0; hit = scatter(hitP, hitN, I, idistribution, Time, maxdist, opoint, onormal, odirection); // Trace again from the exit point of the scattering hit = trace(opoint, odirection, Time, "P", hitP, "N", hitN);