ray-tracing-renderer
ray-tracing-renderer copied to clipboard
Adding liquid IOR
Would it be possible to add management of the IOR, or at least add liquids (IOR 1.33)? I saw in the code that there are IOR 1.5 parameters for THICK_GLASS, but I would like to use 1.33 and 1.5 in the same scene. When I put two objects in each other, with the glass property, it works, but it's pretty violent.
Thank you
Great suggestion. The current IOR of 1.5 is hard-coded into the shader, but it would be possible to store per-material IORs in the MaterialBuffer. My plate is full at the moment so this isn't something I can visit in the next few weeks, but might you be interested to add this feature?
thank you so much! I think it's a mandatory feature
I succeeded, but not without difficulty! So thank you to Jaxry for your explanation in my other issue, which you did not answer, where are the buffers ...
Coming back to the subject, it's been several days since I have something that "works", but I had problems ... The biggest was my failure to assign an IOR to all materials ...
So in addition to material.transparent = true; material.solid = true;
you have to add: material.ior = 1.6; // for glass material.ior = 1.33; // for water material.ior = 1.5; // for other
For liquids in glasses, you have to respect an order in the objects, otherwise we have funny results.
Here are the results:
Glass with only envmap
Glass with the same envmap, but with a plan mesh with texture
Not exactly the same render, but with Maxwell 4.2
Here is the build version: Raytracer 0.9.0 with IOR support.zip
Very cool images and nicely done! Is the scene or camera slightly different in Maxwell? Or should the two renders look exactly the same?
In any case, would you like to create a branch and a pull request with this feature?
I have a camera gap, I'm not sure why yet. Maybe because of the vertical / horizontal FOV ... I just made a scale of the image, we see the frame, but all the parameters seem identical. I just have less border in Maxwell.
For the analysis of the differences, it is quite particular for the IOR <1.1, they are very close, if we move from 0.01, everything changes violently. 1.15 is identical, but> 1.15 is quite different.
Surprisingly, with your script, if I remove all ior 0.15, I have no refraction on ior 1.15. On the other hand, if I remove 0.2, the ior 1.2 always has refraction. As if there were a multiplier coefficient centered on 0.15 ???
I just made a funny discovery, when I assigned an IOR of 1.0 to all objects other than dielectric, I sometimes had funny results ... An impression of normal reversed. I thought it was a problem of normal, or order of materials in the scene, or a problem of order of triangle ... In fact by passing all the other objects to an IOR of 1.5, everything returned in order. I don't really understand this 1.5, it was the hard coded one, but why 1.5 ??? In Maxwell, we use an Nd instead of IOR, I don't quite understand the difference, but I know that for metals, we tend to put an Nd> 30, and this allows a better effect. And we stay at 1.6 for precious glass, and 1.33 for water. For the rest by default, we use 3.0
For the fork, I am not comfortable enough with git, to be able to do it, and to tell the truth, it does not interest me too much, I put you in link the files of the directory SRC. I am more of a sharp hacker than a developer.
The sources are based on version 0.9, to which I have deleted certain lines of code, to be identical to version 0.9 compiled. (see my other issue) I put comments // NicoLab28 wherever I added / modified code.
I seem to have found a bug. I'm not sure yet, but I have the impression that when opening glb files, the creation of materials is not done correctly. Ditto, when we clone a material. The result is that the refractive indices are disturbed ??? I found a workaround, by systematically reassigning a new material to each mesh, this seems to be a solution. I'm still on 0.9.0, not yet tested on version 0.9.1
Love to see this outside of the shader. Is this IOR uniform exposed in the material properties in the latest version ? Meanwhile here is what Disney did : https://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_slides.pdf https://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_notes.pdf