PP2014: Odd refraction in material for drinking glass.
morkonan last edited by
@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:
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
Second test with IOR set to 1.0
Third test, IOR = 1.25
@3dcheapskate this is the open cylinder. I did not change anything on it except the material.
@ghostship I'm not seeing any image in that post.
I've just done some quick calculations using Snell's law to see what I'd expect those IOR 1.0, 1.25, 1.5 tests I just did to give me.
For front-facing tests θ1=45, n1=1 so θ2 =asin(0.707/n2)
For back-facing tests θ1=45, n2=1 so θ2 = asin(n1 * 0.707)
IOR 1.0 front-facing - refraction angle = 45 degrees
IOR 1.0 back-facing - refraction angle = 45 degrees
IOR 1.25 front-facing - refraction angle = 34.44 degrees
IOR 1.25 back-facing - refraction angle = 62.1 degrees
IOR 1.5 front-facing - refraction angle = 28.12 degrees
IOR 1.5 back-facing - refraction angle = NaN (incident angle of 45 degrees is above the critical angle, so it's total internal reflection)
Using these values we can determine which part of the background grid we expect to see at any point on the render covered by the refracting plane.
What I see from my tests at the vertical centreline of the refracting plane matches up near-perfectly with what I calculated above, except for the IOR 1.5 back-facing one - the NaN calculated result is because you can't take an asin of a value greater than 1.This is the criteria for total internal reflection, and I recall reading somewhere (can'tfind the URL) at sometime (not sure of the date ofthe comment) that Poser (not sure which version) didn't do this right.
Edit: note to self - this could explain an odd effect I noticed with a refracting half-cylinder with normals pointing inwards, when rendered so you're looking at the back-face...
@morkonan I guess think of it the other way, based on the attached diagram in the previous post with the incident ray on the camera side. I.e. ray-tracing starts with a pixel (or smaller) on the 2D render (which is the point you're trying to determine the colour of) and sends a ray out into the scene, away from the camera. If that ray hits a refractive surface it splits into a refracted ray and a reflected ray, etc. The colour of the rendered point is the result of correctly evaluating and combining the ray and all its spawned rays.
@ghostship there was none. My previous image of a cylinder WAS the open cylinder. I have no idea what you are doing wrong except maybe your render settings are not playing nice with your cylinder. All the crazy math things are taking you in the wrong direction (and making my head hurt LOL) Here are my High quality render settings that I always use in firefly and used on my cylinder image. If you can't get the open cylinder to render correctly with my shader setup and render settings then you might want to consider throwing out your preffs files and Poser will make new ones for you. If that does not help I'd suggest a re-install of Poser. Also make sure you have the latest version. 11.05.32974 is what I'm using.
for that render I used 4 Ray Trace bounces
@ghostship I think the headache may be due to my coloured grids - I think I'm getting one too! Thanks for the clarification - I'll try your settings in my PoserPro 2014 tomorrow.In the morning,after a coupleof cups of coffee. :)
@ghostship - I've been distracted over the past couple of days, but I managed to do a PoserPro 2014 render using Andy, the open cylinder, no lights (just IDL and an environment sphere), and your material/render settings (including the different IORs in Fresnel_Blend and Refract nodes! ;o).
Slightly different camera setup and position of the open cylinder on these two renders (default 75mm main camera for both I think?)
My initial reaction was that this looks correct. But then I noticed that there doesn't seem to be any refracted backdrop (the environment sphere) - look at the area behind Andy's lower spine, it's just white/grey whereas I'd expect greens and browns. Also there's an odd bit around Andy's temple (although this could be correct refraction)
@3dcheapskate how many RT bounces did you use? My regular FF settings use 3 but I had to bump it to 4 for that render I did. I'm Using BB's Envirosphere for my IDL and I have one infinite for sun.
@3dcheapskate I got that odd refraction near his forehead as well.
@3dcheapskate I can see in your render that the background is coming through one layer of glass. You can see the background coming through on the bottom between his pelvis and where you only see the back part of the cylinder. I really think it's a RT bounce problem. Unless your sphere has visible in RT unchecked or something odd like that.
@morkonan - Does the ray-tracing keep track of the IOR the ray is travelling through ?
From the following simple test I'd say NO.
I simply added an extra refracting plane between the front camera and the rotated plane. This extra plane is NOT rotated, so there will be zero refraction when looking through it from the front camera, because the incident angle of all rays striking it will be zero. I set its IOR to 1.5
I then set the IOR of the rotated refracting plane to 1.25
If Poser's raytracing keeps track of the IOR then at the rotated plane we should get refraction of a ray going from IOR 1.5 to IOR 1.25
If Poser's raytracing doesn't keep track then we'll probably get refraction of a ray going from IOR 1.0 to IOR 1.25 (i.e. the render will look the same as if the extra plane wasn't there.
(The simplest check is to look at the render and compare the areas where the two refracting planes overlay each other, and the areas covered by only one refracting plane)
Edit: I then remembered that a higher IOR going to a lower IOR can cause total internal reflection in real life, and caused an odd problem in my earlier test. So I tried with various IOR combinations on the two refracting planes, including 1.25 on the extra plane and 1.5 on the rotated plane. Same results - it appears that Poser always assumes that the incident IOR is 1.0 (proviso: when refraction is at a front-facing polygon)
@ghostship - 4 bounces (as per your comment after the post with the render settings).
Since Andy is showing up behind the open cylinder then the rays have definitely got through the cylinder - the ones that don't hit Andy should continue to the background sphere (or evaluate to black if that's out of range). I just tried applying brightly coloured stripes to the sphere (my own worldball) and I can see them through the cylinder behind Andy, but the colours are really washed out - the effect is almost as if the cylinder's filled with smoke (that's quite similar to what I saw in my very first test, test 1 in the OP)
I only did a couple of small area renders with the bright background since it's so slow, but you should be able to see what I mean.
Edit: I wonder if it's something to do with using ambient only (i.e. diffuse = 0) on my sphere, and on the original backdrop with the asymmetric letters? Edit2: No, it's nothing to do with that - just tried.
@ghostship - I think this proves that the washed-out effect seems to be due to a low Quality setting in the refract node in PP2014. But there's no white at all on the backdrop sphere, so I don't understand why I still see white bits with refract quality = 0.9
Was your Poser 11 render really using quality = 0.2 (as shown on your render settings screenshot)? If so then Poser 11 seems to have a higher standard for refraction quality :D
I think I've just confirmed for myself that PoserPro 2014 (10.0.5.28925) doesn't do total internal reflection. If the criteria for total internal reflection are met (and these criteria seem to be incident angle greater than critical angle when hitting the back face* of a surface with a refraction IOR of greater than 1) then the ray just continues on its original path!