PP2014: Odd refraction in material for drinking glass.



  • PP2014 (10.0.5.28925)

    I've been having refraction problems with a drinking glass half filled with water. I used separate objects for glass and water. I used the glass material from bagginsbill's Glass Of Beer prop with refractive index 1.54 for the glass and1.33 for the water.

    • The water object alone seemed to behave correctly.
    • The glass object alone seemed to behave oddly.

    Trying to work out what was happening with the glass I created a simple prop with three sections: the top section only has the back (concave) half of the glass; the middle section only has the front (convex) half of the glass; the bottom section has both back and front. 0.04 PNU external radius,internal radius 95% of this. I used the same BB glass shader. PP2014 default lights, Poser one sided square with all the asymmetric capital letters as a backdrop (I waschecking that the water-filled glass mirrors them), and Andy's feet appear in the render.

    Test 1: Here's the test - the top (concave) third of my prop seems okay, but the middle (convex) third seems wrong, as does the bottom third.

    0_1475296500066_refractglasstest.jpg

    Test 2: I then tried setting the refraction index of the glass to 1.0 (in both refract and fresnelblend nodes) which I would expect to make it render as if the glass wasn't there. Here's what I got - something's not right.

    0_1475298440704_Ior1.jpg

    So... what's going on ?
    Am I missing something ?



  • And just to be sure of what it should look like with a real drinking glass, empty...

    0_1475299342992_real.jpg



  • And real life, half full,which is what I was originally checking for...

    0_1475299729600_halffull.jpg



  • And just out of interest I did a new half-filled glass test. I created new glass and water props and rendered them in the same setup as my other tests. Top left is just the glass, top right is just the water, and bottom centre is glass and water together. My materials are the BB glass one again with ior of 1.54 and 1.33 (glass/water). It's odd, because every time I do this (create a new prop and test it) I get different results.Last time I'm 99% certain that the lettering was more-or-less correctly mirrored when viewed through the water-only prop. But not this time.

    0_1475302889684_Render 1.jpg



  • Just tried using the PP2014 Cylinder and Open Cylinder props, scaled down to 25% and with the BB glass shader (ior1.54) applied to both. I set the refract node background colour to bright green (a simple trick to see whether the raytracing is running out of bounces) and set 4 bounces in the render settings.

    The solid cylinder (right) looks as if it's behaving sort of correctly.
    The open cylinder (left) has the same sort frosted glass look as before when you look through the nearer (convex) side. But this timethe green tint stands out...

    0_1475311681705_Untitled.jpg



  • Cheat. Set the transparency node to some value other than zero. The render engine is an approximation to reality, but not physcially accurate, so PP2014 rendering needs a little more tweaking in teh Material Room.



  • @ibr_remote I'm really just trying to understand why I'm seeing what I'm seeing,and is it to be expected given my render settings, etc. And if so, how to fix it.

    I've decided to try playing with individual parameters. First,the number of bounces. 4 doesn't seem to be enough Increasing from 4 to 8 gives a definite change. Increasing from 8 to 12 seems to have no real noticeable effect

    Edit: correction - for this test I used bagginsbill's glass shader, but plugged the Reflect node directly into the Outer_Color of the Fresnel_Blend node without combining with a Blinn first

    0_1475323859023_boncy.jpg



  • Simplifying even more - just a Refract_Node and Poser_Surface in the shader. Same problem. Quality of Refract node increased to 0.5 which doesn'tseem to make any difference.

    0_1475325416169_JustRefract.jpg



  • @3dcheapskate try remove backfacing polygons ?



  • @ibr_remote said in PP2014: Odd refraction in material for drinking glass.:

    @3dcheapskate try remove backfacing polygons ?

    ^--- This. Those look like it's refracting twice, once through each layer of polys. The refracting node does not "know" that the space in between those polys exists - It's going to refract on each layer, not treating those two layers of polys as a "fake solid" object. Either cull the backfaces or re-mat the material to remove the refraction node from the inside layer of polys.



  • I'm this is firefly, right? Try this:

    0_1475338590415_glass cylinder.jpg



  • @ibr_remote /@morkonan - Very odd. I tried removing backfaceing polys (in render settings) and got exactly the same problem (at least I think I did - it was far too late last night!)

    And maybe I'm missing something here - why would I want to prevent refraction from occuring on the back-facing surfaces (a Poser bug* is the only reason I can see)? When you look through a real life drinking glass there is refraction at four surfaces. Surely I want Poser to do refraction at the four surfaces too?

    1. First refraction on the outer surface going from air to glass (front-facing poly with ior 1.54 material)
    2. Second on the inner going from glass to air (back-facing poly with ior 1.54 material)
    3. Third refraction on the opposite inner surface going from air to glass (front-facing poly with ior 1.54 material)
    4. Fourth on the final outer surface going from glass to air (back-facing poly with ior 1.54 material)

    *The only reason I can see for preventing 2 and 4 is if Poser has a problem with refraction on back-facing polys. Bagginsbill did mention that this was the case - a year ago, in a comment on the lower left of his Glass Of Beer prop page. He also stated that it had been fixed, but didn't say at which Poser version. I'm assuming that my PP2014 (10.0.5.28925) has the fix?

    Here's a possible simple test setup with four separate one-sided surfaces. The red ray path at the two back-facing surfaces is drawn assuming that Poser will correctlycalculate refraction based on going from ior 1.54 to ior 1.0:

    0_1475390531696_refract4.png

    Here's the same thing without the refractions on backfacing polys. The orange ray path is drawn assuming that when the raytracing hits the green 'Refract 2' it will refract as if it was going from ior 1.0 to ior 1.54. If the ray-tracing actually keeps track of the ior based on the previous refraction,then it woulddo ior 1.54 to ior 1.54 refraction, i.e. no refraction. Either way the ray path after the final refraction would be in an unrealistic direction. If the four one-sided planes were curved, like in a drinking glass, the error would be worseI think?

    0_1475390829290_refract2.png



  • @ghostship - Yes, PP2014 Firefly. That looks almost identical to the material I'm using, apart from a couple of values (ior 1.4 as opposed to 1.54, Poser_Surface Specular_Value 0 as opposed to 2, etc). I'll give it a try since the precise value settings may be key.
    Also the refracting cylinder in your render seems to be solid.If you use a pipe (e.g. the Poser 'Open Cylinder' primitive) with the same material does it render correctly?



  • @3dcheapskate said in [PP2014: Odd refraction in material for drinking glass.]...

    Here's the same thing without the refractions on backfacing polys. The orange ray path is drawn assuming that when the raytracing hits the green 'Refract 2' it will refract as if it was going from ior 1.0 to ior 1.54. If the ray-tracing actually keeps track of the ior based on the previous refraction,then it woulddo ior 1.54 to ior 1.54 refraction, i.e. no refraction. Either way the ray path after the final refraction would be in an unrealistic direction. If the four one-sided planes were curved, like in a drinking glass, the error would be worseI think?

    Does it keep track for instances of refraction on the same object, though? Obviously, as the ray traced through different material zones, each zone would be given a refractive index, based on settings. But, if it travels through the same material zone twice.... What then? The program "sees" polygons and material zones, but does it also interpret polygons as part of a group of associated polys and does it adjust its effects with that in mind?

    For instance - Take a cube and apply the refraction material to it. Render. Then, increase the distance between the two faces the ray will be traveling through, making it larger along the z axis. (ie: Scale up along the z) Render. Are the results different? If not, then it doesn't care how "thick" the refractive material is. If they are different, then it does care and it treats the object as if it was "made of" whatever physical material has that refractive index indicated in the material settings.

    Ima gonn try dis in a few minutes... for funsies.



  • @morkonan My (subconcious) assumption has been that Poser ray-tracing is all about vectors. When a 'ray' hits a surface that 'ray' would have a direction that you could specify with a unit vector. The point where it 'hits' the surface has a normal, which could also be represented by another unit vector. Apply Snell's law (n1sinθ1 = n2sinθ2) in the plane in which both vectors lie and you'll get a new vector representing the 'ray' after refraction at the surface. For a front facing polygon n2 would be the ior of the material's Refract node, and n1 would be... 1.0? Or whatever the last ior met by this ray was? However, for a back-facing polygon n1 should be the ior of the material's Refract node (if Poser's doing it properly - the incident ray is inside the material) - but what would n2 be?

    That's all guesswork of course... of the semi-educated variety. :)

    @morkonan said in PP2014: Odd refraction in material for drinking glass.:

    ...Ima gonn try dis in a few minutes... for funsies.

    Nice to see that I'm not the only one with a somewhat twisted sense of 'fun'! ;o)

    (I'm still trying to work out the most useful test, and whether I should be doing it on a Sunday - I should be relaxing! )



  • @3dcheapskate said in PP2014: Odd refraction in material for drinking glass.:

    @morkonan My (subconcious) assumption has been that Poser ray-tracing is all about vectors. When a 'ray' hits a surface that 'ray' would have a direction that you could specify with a unit vector. The point where it 'hits' the surface has a normal, which could also be represented by another unit vector. Apply Snell's law (n1sinθ1 = n2sinθ2) in the plane in which both vectors lie and you'll get a new vector representing the 'ray' after refraction at the surface. For a front facing polygon n2 would be the ior of the material's Refract node, and n1 would be... 1.0? Or whatever the last ior met by this ray was? However, for a back-facing polygon n1 should be the ior of the material's Refract node (if Poser's doing it properly - the incident ray is inside the material) - but what would n2 be?

    My "guesswork" is of the "no formal education in QED" variety, just from a basic curious interest in physics. :)

    Well, the last ior would be one's eyeball... right? :) The light travels from the surface of the object, through the glass, to the camera. (At least the rays you're interested in.)

    Anyway, playing a bit with this, using P11 "measuring" tools to keep the surfaces aligned/separated properly for experimental reasons. (Love those measuring tools!) I'll go grab BB's mug in a little bit, just been testing with prims, may create some cylinders of my own to spec... Again, all for the fun of it. :)

    (Early in the AM, here, so not sure when I'll report back. I'm a terrible insomniac, though. :) )



  • @morkonan - I've got a very simple test setup now:

    0_1475405511677_setup.jpg

    I decided to use an orthographic camera to avoid perspective/FOV issues when measuring (actually it's more like guesstimating) how far sideways the grid gets refracted.
    (I also forgot tonote that the centre of the refracting plane is exctly 0.5PNU in front of the centre of the background grid.



  • First test with IOR set to 1.5

    0_1475406248128_1.5.jpg



  • Second test with IOR set to 1.0

    0_1475406927163_1.0.jpg



  • Third test, IOR = 1.25

    0_1475407498387_1.25.jpg