PDA

View Full Version : Dummy photon volume shader



sjannuz
February 5th, 2008, 15:47
Here is a super stupid problem I cannot solve (Xsi 6.0 btw).
I have a light emitting caustic photons, then a cube0 and then cube1, all aligned, not overlapping.
The cubes are both caustic receivers and casters.
To both I assign the photon mat and vol shaders you find below.
The mat does just mi_photon_transparent, the vol returns miTRUE for cube0, and mi_store_photon_volume for cube1.
What happens here is that no photon ever reaches cube1 (not even its photon mat shader).
To be noticed that if I remove the photon vol from cube0, then they do, and get stored into cube1.
Any help is greatly appreciated.
Stefano



DLLEXPORT miBoolean sj_fake_sss_mat(miColor *result, miState *state, MatParameters *oParas)
{
miInteger id = *mi_eval_integer(&oParas->id); //cube id

if (state->type == miRAY_EYE)
{
mi_compute_volume_irradiance(result, state);
result->a = 1.0f;
return miTRUE;
}

if (id == 1)
id = id; //debugger pit stop, never gets here

return mi_photon_transparent(result, state);
}

DLLEXPORT miBoolean sj_fake_sss_vol(miColor *result, miState *state, VolParameters *oParas)
{
miInteger id = *mi_eval_integer(&oParas->id); //cube id

if (id == 0) //do nothing for cube 0, just go through
return miTRUE;

if (state->type == miPHOTON_TRANSPARENT) //cube 1, store the photon
{
//store it 0.1 units below the skin
state->point.x = state->org.x + state->dir.x * 0.1f;
state->point.y = state->org.y + state->dir.y * 0.1f;
state->point.z = state->org.z + state->dir.z * 0.1f;
mi_store_volume_photon(result, state);
}
return miTRUE;
}

bart
February 7th, 2008, 18:48
Hmm, it appears you are storing volume photons.

A caustic photon is when a photon hits a diffuse surface just after reflecting or transmitting through a specular surface.

sjannuz
February 7th, 2008, 21:59
All you say is true, so my problem stands.
By tracing the photon transparent (ie transmitting it ), I "name" him a caustic photon (just because it gets transmitted), although already so defined by the light.
Then, instead of letting him hit a surface, I can decide to store it in the (volume) photon map.
But besides what I do with it (it all works with a single object!), I am really missing why a void vol shader (return miTRUE) can interfere with the photon destiny.
Thanks

(btw, am I the only one frustrated by the photons nomenclature? I know, it's not a mr thing)