# Surface normal and Rdot in mix functions

Hi,
Is there anybody (Greg?) who could help in the following problem:

For the mixture material type one has to define a weight coefficient [0...1] for the 'foreground' material. Respectively, this coefficient subtracted from 1 is the weight for the 'background' material.

I have used .cal functions based on cos(theta) of the incoming (eye) ray. For this purpose, there is a special variable available, Rdot, which is the dot product of the eye ray and the surface normal and hence should be equal to cos(theta), if I have understood correctly. I have also supposed Radiance always flips the normal so that Rdot would get only positive values between 0 and 1. However, when I tested this, my functions gave warnings that imply negative values of Rdot. Something seems to be wrong in my reasoning.

Is it ok to treat positive and negative Rdot values symmetrically in mix functions?

I have not used surface textures, but the roughness values for trans material are moderately big.

Regards,
Markku

Markku_Norvasuo
Technical_Research_Centre_of_Finland

... if I recall it right:
dielectric, interface, BRTDfunc, glow and mixfunc don't re-orient
surfaces and Rdot[-1:1]
colorfunc, brightfunc, transfunc (+ their ~data equivalents), trans,
plastic(2), metal(2), glass do flip surface normals and so Rdot[0:1] .

-Peter

···

markku.norvasuo@vtt.fi wrote:

I have used .cal functions based on cos(theta) of the incoming (eye) ray.
For this purpose, there is a special variable available, Rdot, which is the
dot product of the eye ray and the surface normal and hence should be equal
to cos(theta), if I have understood correctly. I have also supposed

--
pab-opto, Freiburg, Germany, www.pab-opto.de

Peter Apian-Bennewitz wrote:

>
> I have used .cal functions based on cos(theta) of the incoming (eye) ray.
> For this purpose, there is a special variable available, Rdot, which is the
> dot product of the eye ray and the surface normal and hence should be equal
> to cos(theta), if I have understood correctly. I have also supposed
> Radiance always flips the normal

... if I recall it right:
dielectric, interface, BRTDfunc, glow and mixfunc don't re-orient
surfaces and Rdot[-1:1]
colorfunc, brightfunc, transfunc (+ their ~data equivalents), trans,
plastic(2), metal(2), glass do flip surface normals and so Rdot[0:1] .

Note that, as far as I am aware of, this "normal flipping" is
NEVER done for non-material modifiers. The original question
was about mixtures, though the wording unintentionally confused
the issue a bit. For the materials, I think the list above is

You can assign different materials/patterns/textures to the front
and back side of a surface simply by using "if(Rdot,1,0)" as the
coefficient for a mixture. In fact, there is a file "diffside.cal"
available in the Rayfront library that does exactly this.

If you don't want to differentiate between the two sides of a
surface in non-material modifiers, then you'll have to look at the
absolute value of Rdot (or the absolute values of Nx/Ny/Nz).
Positive and negative values of Rdot are equivalent to each other
for the respective "other" side of the surface. I'm not sure if
the perturbation caused by the roughness parameter is reflected
in the N# values seen by a function file.

-schorsch

···

markku.norvasuo@vtt.fi wrote:

--
Georg Mischler -- simulations developer -- schorsch at schorsch.com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/

So respectively "if(Rdot,Rdot, -Rdot)" returns cos(theta) if both sides are similar. - By the way, I never realised before that modifiers "foreground" and "background" could refer to the concrete front and back of a surface...

Thanks very much,
Markku N.

···

At 14:02 2002-05-03 -0400, you wrote:

You can assign different materials/patterns/textures to the front
and back side of a surface simply by using "if(Rdot,1,0)" as the
coefficient for a mixture.