another water question

Hi All,

I�ve looked through the archives regarding modelling
water, but the posts seem to be concerned with making
something that looks like water, without being
physically accurate.

What I want to do is test for reflections off a
training pool � the coach needs to see a swimmer�s
action in the pool and early morning sunlight may
cause problems. If I use glass with a bumpy function,
it looks really cool but I�m not sure if the amount of
reflection is right. I tried a dielectric, but the
�water� becomes a mirror.

Is there a material to use that gives properties
closer to water than glass? If so, I�d love to hear
about it.

Cheers

Nick L

Send instant messages to your online friends http://uk.messenger.yahoo.com

Nick,

Is there a material to use that gives properties
closer to water than glass? If so, I’d love to hear
about it.

If, as seems likely, it is just the specular component of reflection that's required, and if that is governed more by the refractive index of a transparent material than anything else, then I'd suggest that you try using glass again but set the refractive index to that of water, i.e. 1.33. You have to set the (rarely-used) fourth argument for glass:

             mod glass id
             0
             4 rtn gtn btn ref_indx

This is very much a guess -- suggestions from someone who actually knows what he/she is on about welcome.

-John

···

-----------------------------------------------
Dr. John Mardaljevic
Senior Research Fellow
Institute of Energy and Sustainable Development
De Montfort University
The Gateway
Leicester
LE1 9BH, UK
+44 (0) 116 257 7972
+44 (0) 116 257 7981 (fax)

[email protected]
http://www.iesd.dmu.ac.uk/~jm

Hi Nick,

Technically, the correct thing to do is to model the water's surface as a dielectric with an index of refraction corresponding to water -- around 1.3. The problem, as you noticed, is that you cannot see beneath such a surface, and this is due to the inability of the source calculation in Radiance to find the light source after refraction.

One cheap "solution," so to speak, is to use a BRTDfunc type to get the surface reflection and transmission right, without actually computing refractions. The objects under the water will not be properly distorted, but at least they won't be black(!) The following should work:

  void BRTDfunc water_mat
  10 refl refl refl
    tran tran tran
    0 0 0
    fresnel.cal
  0
  10
    0 0 0
    1.3

And the file "fresnel.cal" contains:

{ Fresnel equation for reflection and transmission }

inside = -Rdot; { > 0 means ray coming from inside }
nratio = if(inside, arg(10), 1/arg(10));

cos1 = if(inside, -Rdot, Rdot);
cos2 = Sqrt(1 - sq(nratio)*(1 - sq(cos1)));
refl = if(FTINY-cos2, 1, (sq((cos1 - nratio*cos2)/(cos1 + nratio*cos2)) +
    sq((1/cos1 - nratio/cos2)/(1/cos1 + nratio/cos2)))/2);
trans = 1 - refl;

···

----------
The problem with John's suggestion is that you will end up with twice as much reflection as you ought, because glass simulates reflection off both the front and back surfaces, whereas you have just one surface. You could lower the index of refraction given to match the reflection of the water's surface at normal incidence, but the computed reflection would still be somewhat off as a function of angle. The above formula gives you the correct reflection amount (even from underwater). It just doesn't do refraction.

You probably want to add a time-dependent wave texture to your water's surface as well, since most of what makes a person difficult to see while underwater is the reflections off the surface, which are constantly in motion. I recommend doing an animation for that reason.

-Greg

From: Nicholas Lander <[email protected]>
Date: May 25, 2006 12:13:50 AM PDT

Hi All,

I’ve looked through the archives regarding modelling
water, but the posts seem to be concerned with making
something that looks like water, without being
physically accurate.

What I want to do is test for reflections off a
training pool – the coach needs to see a swimmer’s
action in the pool and early morning sunlight may
cause problems. If I use glass with a bumpy function,
it looks really cool but I’m not sure if the amount of
reflection is right. I tried a dielectric, but the
“water” becomes a mirror.

Is there a material to use that gives properties
closer to water than glass? If so, I’d love to hear
about it.

Cheers

Nick L

Gregory J. Ward wrote:

You probably want to add a time-dependent wave texture to your water's surface as well, since most of what makes a person difficult to see while underwater is the reflections off the surface, which are constantly in motion. I recommend doing an animation for that reason.

Thanks Greg for the excellent tips on modeling water, but I'm afraid you have opened up another can of worms with the last paragraph, above. You mention a time-dependent wave texture. (!) This sounds rather like some sort of variable texture that modulates the surface normal based on a time input. One could script up a run of images and for each frame that water material would be modified by a random deformation that is keyed to timestep? This sounds like an interesting application, and I was wondering if you had a framework for such a material description. cal files are really something I'm trying to understand more, and each example helps a little bit more.

- Rob

Hi Rob,

I can't say I've done it before, but the usual way to animate things in Radiance is to generate a different model at each time step. There's no reason you can't modify your material descriptions as you do this, changing real arguments on your texfunc primitives, which are then interpreted by the.cal file to modify the origin and other parameters associated with a water texture.

You could also modify the .cal file at each step, but I advise against that approach, as it won't work reliably with ranimate unless you gave the .cal file a unique name for each time step, at which point you will have to modify your material primitive, anyway.

Sorry I don't have any ready examples for you.

-Greg

···

From: Rob Guglielmetti <[email protected]>
Date: May 25, 2006 8:42:36 AM PDT

Gregory J. Ward wrote:

You probably want to add a time-dependent wave texture to your water's surface as well, since most of what makes a person difficult to see while underwater is the reflections off the surface, which are constantly in motion. I recommend doing an animation for that reason.

Thanks Greg for the excellent tips on modeling water, but I'm afraid you have opened up another can of worms with the last paragraph, above. You mention a time-dependent wave texture. (!) This sounds rather like some sort of variable texture that modulates the surface normal based on a time input. One could script up a run of images and for each frame that water material would be modified by a random deformation that is keyed to timestep? This sounds like an interesting application, and I was wondering if you had a framework for such a material description. cal files are really something I'm trying to understand more, and each example helps a little bit more.
- Rob

Gregory J. Ward wrote:

Hi Rob,

I can't say I've done it before, but the usual way to animate things in Radiance is to generate a different model at each time step. There's no reason you can't modify your material descriptions as you do this, changing real arguments on your texfunc primitives, which are then interpreted by the.cal file to modify the origin and other parameters associated with a water texture.

You could also modify the .cal file at each step, but I advise against that approach, as it won't work reliably with ranimate unless you gave the .cal file a unique name for each time step, at which point you will have to modify your material primitive, anyway.

Sorry I don't have any ready examples for you.

OK, that makes sense though. That could be a fun project, sorta like the animated candle that we saw at the first Radiance Workshop. Hmmm...

If you go for frame-by-frame animation, Blender has simple fluid behavior built into its 2.41 release. You can specify a mesh to be fluid (for example a cube of fluid) and bound by another mesh (say a box containing the water). You can specify sources and sinks and objects with which the fluid should interact. set up the scene you want and Blender will generate a new mesh model for each frame of the animation, which you can export as obj and then obj2mesh or obj2rad each model (each frame). This goes for all of the objects/meshes in your scene, so you could do the modeling and simulation in Blender and then render in Radiance. A simple script could insert the water material modifier into each model, etc.

···

------------------------------

Kirk L. Thibault, Ph.D.
[email protected]

p. 215.271.7720
f. 215.271.7740
c. 267.918.6908

skype. kirkthibault

On May 25, 2006, at 12:11 PM, Rob Guglielmetti wrote:

Gregory J. Ward wrote:

Hi Rob,

I can't say I've done it before, but the usual way to animate things in Radiance is to generate a different model at each time step. There's no reason you can't modify your material descriptions as you do this, changing real arguments on your texfunc primitives, which are then interpreted by the.cal file to modify the origin and other parameters associated with a water texture.

You could also modify the .cal file at each step, but I advise against that approach, as it won't work reliably with ranimate unless you gave the .cal file a unique name for each time step, at which point you will have to modify your material primitive, anyway.

Sorry I don't have any ready examples for you.

OK, that makes sense though. That could be a fun project, sorta like the animated candle that we saw at the first Radiance Workshop. Hmmm...

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Hi,

one idea... as this will require generating the octree for every frame, I wonder if it helps to make a frozen octree of the whole scene except the water, scene.oct. Than exporting only the water objects for each frame, lets call them water[FRAME].rtm. Now if you write a script that creates scenes with only two objects, one being an instance of scene.oct, the second a mesh object water[FRAME].rtm. That way you will not have to run octree each time on the whole scene, right?

In fact, I wanted to propose to use the -i option of oconv so that you can type oconv -i scene.oct water[FRAME].rad > scene[FRAME].oct. But who uses obj2rad any more... :wink:

What do you think folks, I cannot try that at the moment to find if the gain from less work in oconv is worth the overhead. Also instance and mesh would overlap completely.

CU Lars.

Hi Lars,

The way I'd recommend creating such a scene is to regenerate the water mesh, then add the little bit of geometry containing the "mesh" primitive that references to an existing octree, a la:

  obj2mesh water.obj > water.rtm
  oconv -f -i scene-water.oct water.rad > scene+water.oct

Where water.rad contains the mesh primitive and maybe a material. The oconv command only takes as long as it takes to read and write back out the octree -- best if it's frozen for that reason.

If you know for certain that your mesh always ends up with the same overall dimensions, you don't even need to rerun oconv, technically.

-Greg

···

From: Lars Grobe <[email protected]>
Date: May 26, 2006 4:03:05 AM PDT

Hi,

one idea... as this will require generating the octree for every frame, I wonder if it helps to make a frozen octree of the whole scene except the water, scene.oct. Than exporting only the water objects for each frame, lets call them water[FRAME].rtm. Now if you write a script that creates scenes with only two objects, one being an instance of scene.oct, the second a mesh object water[FRAME].rtm. That way you will not have to run octree each time on the whole scene, right?

In fact, I wanted to propose to use the -i option of oconv so that you can type oconv -i scene.oct water[FRAME].rad > scene[FRAME].oct. But who uses obj2rad any more... :wink:

What do you think folks, I cannot try that at the moment to find if the gain from less work in oconv is worth the overhead. Also instance and mesh would overlap completely.

CU Lars.