zpelgrims / lentil

Polynomial optics to Arnold. Camera shader with high-order aberrations, including bidirectional filter that adaptively samples out-of-focus highlights (top level repo)
http://www.lentil.xyz
104 stars 11 forks source link

Incorrect redistribution with transmissive objects #228

Open zpelgrims opened 4 years ago

zpelgrims commented 4 years ago

For transmissive objects, the defocus is incorrect. I take the position of the hit on the glass, however, it really should be the hit on the first object. Huge issue! :(

zpelgrims commented 4 years ago

Tried to write a transmitted z-depth. I can retrieve the 'correct' values (total ray path length), however, there isn't a way to associate these depths with the final subpixel samples. Some energy might come from a reflection on top of a transmission event, but I'm only able to assign a singular depth value to it.

So far I also haven't found a good way to deal with the insertion of a passthrough shader into every! shading network. This could be reason enough for studios to not buy the whole thing.

Any heuristic I would introduce would likely fail. Therefore I think it is safer to not redistribute when dealing with transmissive objects.

So, going forward, write an aov shader that determines if the first-hit intersection has a transmission>0.0 parameter. Don't distribute when this is the case. Also don't distribute when the param is linked.

zpelgrims commented 4 years ago

To not redistribute:

zpelgrims commented 4 years ago

Thought:

Can i separate the reflection/transmission through LPE aovs? Maybe by comparing energy of both I could make a somewhat ok heuristic to decide which depth value to use?

zpelgrims commented 4 years ago

Succeeded in prototype where I am able to redistribute the spec, but not the transmission

still a 2x energy loss bug

with this current solution there's no need for a passthrough shader!!

zpelgrims commented 4 years ago
zpelgrims commented 4 years ago

2.0 goal: provide shader to calculate true transmitted depth, write this out to an internal buffer (or aov). The main issue is that this shader needs to be inserted into EVERY shading network!! AOV shaders only get executed for primary rays (insufficient in this case)

zpelgrims commented 3 years ago

Maybe could create an AOV using a volume shader & transmit all aovs? Not sure yet, think mads droschler MIGHT have done it with a volume. Ask.