[Radiance-general] Re: an invisible glow

Greg Ward [email protected]
Fri, 25 Oct 2002 16:05:37 -0700


Hi Alex,

I'm a bit afraid to even dip into this conversation, as there are so  
many tricks and hacks you can play with Radiance before even delving  
into the source code, but I thought I'd offer at least one modest  
suggestion...

If you just want to substitute a material in the case of eye rays, you  
can use a mixfunc and pass it the world coordinates of the viewpoint  
(-vp Vx Vy Vz) in the real arguments like so:

void mixfunc view_switch_mat
4 view_mat normal_mat
	if(and(FTINY-abs(A1-Px+T*Dx),and(FTINY-abs(A2-Py+T*Dy),FTINY-abs(A3- 
Pz+T*Dz))),1,0)
	.
3 {Vx} {Vy} {Vz}

where of course {Vx} {Vy} and {Vz} are replaced by the appropriate real  
values.  The above works by testing to see if the ray that hit the  
surface originated at the viewpoint without being reflected or  
refracted along the way.  The FTINY values (equal to 1e-7) are  
necessary to avoid floating point roundoff errors in the equality  
tests.  I haven't tested this, but I believe it would work, and you  
wouldn't have to hack the source code.

-Greg

> From: alex summerfield <[email protected]>

> Is there a way to do this in general (with mixfunc?) so that a surface
> appears from the viewpoint as one material, but as far as the lighting
> calculation is concerned is another? Or more to the point how can i  
> test if
> the ray being traced is a view ray or not?
>
> To explain an example situation - suppose there is a complicated  
> existing
> building that is simplest to represent with an image mapped onto its  
> facade
> (and that only appears correct when viewed from the viewpoint), but in  
> terms
> of its lighting contribution on the site in general is more accurately
> described in some other way.