[Radiance-general] water simulation

Ignacio Munárriz info at aisarquitectura.com
Thu May 11 14:13:43 CEST 2006


Thanks Greg, i think i'm near to get it, but there is something that is not
working, i dont know if Rdot is the DOT product or the -DOT product, i tried
the two but it is still not working, i´ve been trying to do some tests with
calc and it seems to work but something must be wrong because rpict gives
the aiming error, what is the best tool in radiance to test this kind of
things, i say, testing cal files while sending rays

void prism2 water
     9 transm dx dy dz reflect dxx dyy dzz water.cal
     0
     3 1 1 1

####water.cal#####
nrwater=1.3;

cos1=if(Rdot,Rdot,-Rdot);
nratio=if(Rdot,1/nrwater,nrwater);
dnormx=if(Rdot,Nx,-Nx);
dnormy=if(Rdot,Ny,-Ny);
dnormz=if(Rdot,Nz,-Nz);

d3=1.0-(nratio*nratio*(1.0 -(cos1*cos1)));
cos2=sqrt(d3);
d1bis=cos1;
d2bis=nratio*cos2;
d1t=(d1bis-d2bis)/(d1bis+d2bis);
reflpp=d1t*d1t;
d1p=1.0/cos1;
d2=nratio/cos2;
d1=(d1p-d2)/(d1p+d2);
reflp=reflpp+(d1*d1);
refl=reflp*.5;
transp=1.0 -refl;
trans=transp*nratio*nratio;


reflect=if(d3,refl,1.0);
transm=if(d3,trans,0.0);

dm=nratio*cos1 - cos2;

dx=nratio*Dx+dm*dnormx;
dy=nratio*Dy+dm*dnormy;
dz=nratio*Dz+dm*dnormz;

dxx=Dx+2.0*cos1*dnormx;
dyy=Dy+2.0*cos1*dnormy;
dzz=Dz+2.0*cos1*dnormz;




----- Original Message ----- 
From: "Gregory J. Ward" <gregoryjward at gmail.com>
To: "Radiance general discussion" <radiance-general at radiance-online.org>
Sent: Wednesday, May 10, 2006 10:02 PM
Subject: Re: [Radiance-general] water simulation


Hi Ignacio,

Your problem stems from the fact that your modified angles do not
obey reciprocity, which says that if you reverse the ray (light)
direction, then the angles remain the same on either side.  Both
prisma and prism2 require this property to function.  Implementing
Snell's law correctly, you should get a working material.

The vector version of Snell's law may be found in ray/src/
dielectric.c, or in an easier-to-read form on Wikipedia:

http://en.wikipedia.org/wiki/Snell's_law

Note that the roles of the inside and outside indices of refraction,
n1 and n2, reverse when you come from one side of the water verses
the other.  The n of water is about 1.3, and air is of course 1.0.
(OK, quibblers, air is really 1.0003)

-Greg

> From: Ignacio Munárriz <info at aisarquitectura.com>
> Date: May 10, 2006 5:04:50 AM PDT
>
> I'm trying tom model water with the prism1 & prism2 primitives.
> I`ve been
> able to propagate the rays from sources using
>
>     ...

_______________________________________________
Radiance-general mailing list
Radiance-general at radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-general




More information about the Radiance-general mailing list