Psyop / jf-nested-dielectric

Efficient, Physically-Plausible Rendering of Nested Dielectric Surfaces in Production.
http://www.psyop.tv
BSD 3-Clause "New" or "Revised" License
66 stars 29 forks source link

Toggle to ignore refraction roughness #7

Open glowtape opened 8 years ago

glowtape commented 8 years ago

Would be interesting to have a way to ignore refraction roughness upon intersection of two dielectrics, allowing to make it easier to emulate condensation on objects, when using particles for the macroscopic features while using roughness for the microscopic ones. Right now it attempting it that way results in a frozen object instead of one with water condensation, because the roughness still persists behind the droplet.

The alternative would be using a displacement map for the macroscopic drops, like that you can also use it for controlling the refraction roughness, but using displacement instead of particles blows up the memory usage.

Thanks for considering.

jonahfriedman commented 8 years ago

Hi Mario,

Your observation is astute, I'm not sure jfnd handles this case well right now, although it does attempt to handle it. Here's the current formula I'm using for refractive roughness between two media: https://github.com/Psyop/jf-nested-dielectric/blob/master/source/jf_nested_dielectric.h#L294. The difference between the IORs is used to multiply the average roughness between the two media.

I'm not sure this formula is the right one. I think perhaps some scaling of the prioritized medias roughness might make more sense, and scaling linearly be the difference in IORs may not make sense either.

Let me think a little about this.

glowtape commented 8 years ago

Thanks for considering. Meanwhile I've changed the way I've done droplets. I'm back to using displacement instead of particles. Allows for more irregularity. The displacement map also acts as map for roughness, so it all works out fine.