User avatar
By Thomas An.
Hi all,

This is an old topic (from the early Maxwell Alpha days), which appears referenced quite often even to this day. As such, maybe it would be more useful in this section instead of having to dig the archives.


Hi everyone,

(This may have been discussed and conluded previously, but I wanted to do an independent confirmation)

This test involved the use of thin film dielectrics (membranes) to test Maxwell behavior.
  • Incident dielectric membrane= When the surface normals are on the same side that the incident light hits.
  • Non-Incident dielectric membrane= When the surface normals are on the oposite side from where the incident light hits.
  • 1. Maxwell light is history aware (it remembers the dielectrics it has passed through). Think of it as a LIFO type stack (Last In First Out) collecting ND numbers each time it encounters an incident membrane.
  • 2. Maxwell calculates refraction by using the ND numbers of the two previous incident dielectric surfaces as N1 and N2 for the snell law. (www). If there are no "previous" ND numbers then air is used.
  • 3. The ND of the non-incident membranes are absolutely ignored. Non-incident membranes only act as "triggers" for using the previous ND as N1 (or N2 depending on how nested they are) for Snell's law
Image-1a: Two dielectric membranes with normals facing away from each other.
The ray deflection is evident (this image was alowed to render for 5h longer than the others and thats why it looks more well developed)

Image-1b,1c: Changing the ND of the second membrane (B) to see if it will affect the path of the rays.
The answer is NO. Maxwell is using the ND of (the previous) membrane A in all instances.

Image-1d: Does Maxwell use the ND of the previous memebrane regardless of the direction of the normals?
The answer is NO. Maxwell is using the ND of only the previous incident membrane (which is the last membrane whose normals happen to be on the same side as the incident light rays)

Image-2a,2b: Are we sure that the incident membranes are the only ones that contribute to the Snell's equation ?

The answer is Yes. In image 2a the rays are not deflected, but in image 2b they are deflected.

Image-3a,3b,3c Does Maxwell remember the nesting of dielectrics ?
The answer is Yes. In images 3a,b,c all factors are the same as image 1a except a third membrane C is added.
In image3a the ND=1 (air) and the result is the same as image 1a
In image3b the ND=2.4 and now the result has changed correctly as Maxwell exits B from glass to glass therefore straight.
In image 3c the ND=5.0 and now the beams are correctly focused as Maxwell exits from B into a much thicker medium.


Based on the above experiment, then the proper way to draw liquid-in-glass with Maxwell is as shown bellow:
  • Intersection of ray R1 at point A evaluates as step1 Snell's law (in the propagation diagram). This is an incident membrane intersection and Maxwell treats this as an air-to-liquid interface
  • Intersection of ray R1 at point B evaluates as step 2 Snell's law. This is also an incident membrane intersection and Maxwell (correctly) treats it as a glass-to liquid interface
  • Intersection of ray R1 at point X1 evaluates similarly to step 5 Snell's law (of the propagation diagram). This is a non-incident intersection and the ND is irrelevant. Maxwell (correctly) uses the previous NDb and NDa in the stack to treat this as a liquid-to-glass transition
  • Intersection of ray R1 at point X2 evaluates similarly to step 6 Snell's law (of the propagation diagram). This is a non-incident intersection and the ND is irrelevant. Maxwell (correctly) uses the previous NDa and NDo in the stack to treat this as a glass-to-air transition
Similarly the behavior of ray R2 is evaluates to air-->liquid**-->glass-->air (please see diagram for the "key" explanation of liquid**)

I believe this diagram will give the most correct liquid+glass result.

This method was also confirmed with a real-life experiment as illustrated later on here: ... ults#27866 ... cene#27837

Last edited by Thomas An. on Thu Nov 08, 2012 4:39 am, edited 4 times in total.
User avatar
By iker
I remember this thread, one the best in this forum.

Thanks so much Thomas! :D
User avatar
By Xlars
Thank you very much for this re-post !
By Rogurt
Hi all

It´s a pitty that the images of this topic are not accessible any more since the liquid in glass question is a pretty common one and quite important.

Unfortunately pictures cannot be uploaded here in the forum, right?

By numerobis
maybe you can post the full article with newly linked pictures again in this topic - if it is ok for Thomas... :)
By druitres
Maybe it's because there are no images with the first post, but for the life of me I can't distill a conclusion from it as to how a setup with liquid-in-glass should be done in Maxwell. And I would really like to know how to best do it!

At the moment I'm struggling my way through a 218-post-long thread, also without images, and also without getting any nearer to a straight answer.

Is there any way of seeing the first post with images or, even better, getting an answer to 'how to set this up'?

- is the liquid mesh touching the glass mesh
- is there a slight gap in between the two or a slight overlap
- does one have to make adjustments in the materials
- something else

By druitres
Thanks Polynurb.

Quite different than what I expected... can I conclude that the main thing is to keep all neighboring polys facing the same direction? (otherwise rays get trapped in between reflecting surfaces)

For stills this looks feasible, but will create problems when doing animation with liquid sims. The other solutions discussed in the older thread, have they resulted in changes in Maxwell in this regard? (A user-set limit to number of reflective bounces, if I recall correctly)
By hatts
I just tried this method out and wanted to share my results. I found it to be a slightly odd process, because I can't mentally make sense of the logic of the normals.

Test render, SL 20 or so. *EDIT: Changed the example

Diagram of the normals I found to work for me.

I tried many combinations of normal orientations, and this is the one that worked best for me. Also note that I added a gap between the top surface of the liquid and its glass counterpart. I didn't want to do this, but I was getting odd light interactions otherwise.

EDIT: That gap is far too big, it reveals the geometry, but it does still work if you reduce the gap to something imperceptible.
By druitres
Hi Matthew,

that's weird - first I wanted to tell you that I think you have your concept of normals reversed (I'd say it's absurd to have all the glass normals facing away from you)

(glass should be the green lines, liquid the blue lines, to have polynurb's setup)

but just for the sake of it I tried a render with your settings and one with Polynurb's settings.
And guess what... both come out identical... ??


I don't know if I can mentally make sense of that either...
Maxwell Render 5 crach

An image(6000x3600) was rendered 3 times,and maxw[…]

Material Editor Help

Heeey - that is like Hacking :)) like real life h[…]

Thanks Luis, it's great to see progress with MW!

Thanks Fernando!