PDA

View Full Version : mr Light Dispersion, help please.


AnimG
12-10-2006, 11:54 AM
Hi all

I have been following some of the mental ray threads on this forum for creating diamonds etc and the results are excellent. I have since been researching glass crystal and its properties and the one thing that is causing me trouble is light dispersion.

I have a glass crystal (a real life one) It has 25 facets and is about 8 inches in diameter and 5" in height.

I need to show what this crystal would look like under different lighting conditions but for this test a generic targeted mr light will do.

So we have the following main properties.

Light
====
Intensity
Angle, position, shape
Colour
Photons
Falloff
Auto photon count

Crystal
=====
IoR
Reflection
Transmission and decay factor
Caustics
Dispersion
Internal Reflection, refraction and dispersion

Renderer
=======
Photon count
Caustics
Trace depth
No GI or FG

I can reproduce all the effects in varying degrees of quality but not the light dispersion.

When sunlight comes in through my window the actual crystal creates small gradients of light (several) around the room walls which move as the sun passes the window. Internal reflected dispersion also occurs in the crystal and kind of warps into itself with slight movements of my position but I will attempt that later.

I understand the theory that white (or near white) light is being slowed down by the crystal and as a result the white light is being spread out into our visible spectrum.

I have the theory, i have the tools but I don't understand how I can access the light after it leaves the crystal (is this the photon map channel?). I understand this is shader territory and found a Maya port here:

http://www.maxplugins.de/mentalray.php?range=Photon&sort=Author

I added this map into the photon map of a basic mental ray material (also tried photon volume). In surface I used l_glass_beta 2 but can't get it to produce a dispersion effect. I thought that it might need to be applied as a light shader too but it won't accept it. I also tried other (non beta) material types without success.

I find this a little confusing because its the light I want access to, the crystal material breaks up the light and some other surface or volumetrics shows the resulting light colour.

So, is there anybody out there that can help me either get this ported shader working or can see another way to fake dispersion? Keeping in mind it needs to be accurate and part of the actual light tracing system as im running out of ideas.

Cheers
Anim
PS. I can't use VRay/Brazil etc it has to be done in mental ray 3.5.

AnimG
12-10-2006, 06:52 PM
Just to let you know Ive had some success with the photon shader and now can get a dispersion effect. I just wish I had some webspace to show you the effect.

Anim

AnimG
12-10-2006, 07:22 PM
http://homepage.ntlworld.com/geoff.coope1/dispersion.jpg

This is a no frills scene, consisting of the crystal, one mr light and Ralf Habels Photon Shader (include file from Max plugins.de). No GI or FG and the crystal is walled in.

Heres an extreme version with the midtones boosted to bring out hidden effects.

http://homepage.ntlworld.com/geoff.coope1/dispersion2.jpg

This one has 500,000 photons.

Anim

mustan9
12-11-2006, 02:00 PM
Have you looked at Jeff's diamond example?

http://www.jeffpatton.net/index.html

I would normally attack this problem from a different angle. Using reference images I'd pick out the colors I'd want the crystal to cast, and then texture them into the photon shader. So those colors are casted by the material.

AnimG
12-11-2006, 03:59 PM
Have you looked at Jeff's diamond example?

http://www.jeffpatton.net/index.html

I would normally attack this problem from a different angle. Using reference images I'd pick out the colors I'd want the crystal to cast, and then texture them into the photon shader. So those colors are casted by the material.

Thats an option. But I want it to be as natural as possible so additional faking is a route I can take if all else fails. The daylight system in Max 9 follows the laws of physics, the materials im using must also follow these parameters so it is true to life as possible.

Imagine this is for a court room reconstruction animation so must have credibility.

Cheers
Anim

AnimG
12-11-2006, 04:02 PM
Sorry forgot to mention that Jeff Patton's l_glass beta 2 diamond material is very effective and I have previously looked at it in some depth.

JeffPatton
12-11-2006, 04:10 PM
If physical correctness is your goal, you should probably look into one of the unbiased rendering packages like Maxwell or Fryrender. I'm just not sure how physically accurate you're going to get with a biased photon solution.

mustan9
12-11-2006, 04:16 PM
Ok, I downloaded the photon shader your using and had a look at the source code.

All it is doing is applying a gradient color based upon the IOR. So the output photon is Color = GradientArray[IOR] (just a very simple way of expressing it in coding terms).

So there is no way that shader is realistic, but it's a cool shader. I'd like to play with the source code and see what I can improve on. :)

JeffPatton
12-11-2006, 04:35 PM
My thoughts exactly. If it's scientific physical correctness that he needs, I think he would be better served by one of the unbiased render engines such as Maxwell or Fryrender.

AnimG
12-11-2006, 06:13 PM
I didn't know about Maxwell and Fryrender, thats very useful.

What I am actually doing is a university degree and one of my subjects is to re-produce a
real world property (Glass refraction) using CG. This project has heavy emphasis on realism and accuracy but I am still bound to Max 8/9 (no additional plugins).

If an effect cannot be simulated accurately then I need to clearly define how accurate i can do it compared to real world samples, thats ok, as long as I have researched these alternative methods and the two render engines you mention will still be very helpful in my study.

Many thanks,
Anim

mustan9
12-11-2006, 06:26 PM
If an effect cannot be simulated accurately then I need to clearly define how accurate i can do it compared to real world samples, thats ok, as long as I have researched these alternative methods and the two render engines you mention will still be very helpful in my study.

You picked a hard one, because the photons in MR are just a hack to render an image that "looks like" something that happens in the real-world.

MR projects "cones" out from a light source towards objects in the scene that are marked to receive them. These cones are the "photons". When a cone reaches an object it's radius is calculated, and then additional cones are created. Some are refraction cones, some reflection cones, some specular, and finally a diffuse cone. These secondary cones are intersected when scene objects. Where the cones hit a photon is drawn on the image as a spot. The size and density of spots is controlled by the render parameters and shader. I'm sure a MR master might know more about how it works, but this is what I've been able to figure out.

So you can have a shader that contols cones for refraction, reflection, diffuse, specular, etc. etc. If you want to simulate dispersion it has to be done with a shader that controls the "color" of those cones.

Where as Jeff is telling you that there are render engines that calculate the energy of photons as they pass threw material. How a photon's wave length changes, and how that effects the direction of the photon. Where as in MR the energy of a photon is a "constaint" value link between the photon and the light source. It doesn't change.

Maybe that's the point of your paper. Is to talk about how CG is used by "creative people" to create images that represent things in nature. Hope this helps.

Please, when you done. Can you post a copy of your paper. I'd love to read it! :)

JeffPatton
12-11-2006, 06:46 PM
Where as Jeff is telling you that there are render engines that calculate the energy of photons as they pass threw material. How a photon's wave length changes, and how that effects the direction of the photon. Well actually I meant he should look into using a non-photon solution period because I'm fairly certain he could get more accurate results with those type renderers than with using photons.

I'd personally consider Maxwell & Fryrender to be more similar to a metropolis bidirectional (or even QMC) solution. Now, I know there's more to both Maxwell and Fryrender than that, but I'm just speaking as if I had to place them in an algorythm category.

mustan9
12-11-2006, 06:54 PM
I'd personally consider Maxwell & Fryrender to be more similar to a metropolis bidirectional (or even QMC) solution.

That's so cool. I have no idea what you just said, but I'm going to go try the demos now just to check out those features. :)

CGTalk Moderation
12-11-2006, 06:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.