MeshTransmissionMaterial: more realistic glas/epoxy/gelatin

update: vanilla sandbox MeshTransmission vanilla - CodeSandbox

20 Likes

Looks super slick, do you have some references? I saw the code, but I’m struggling to understand the logic behind it :slight_smile:

1 Like

the shader itself is kind of a cobbled together frankenstein made by junni_jp and edited by maxime heckel and me. but it looks :fire::sweat_smile:

as for the logic, each frame it will visible=false its host mesh, render a frame, and use the texture to calculate the refraction and RGB shift. by doing so the host mesh won’t occlude. THREE.MeshPhysicalMaterial for instance wouldn’t be able to “see” the inner walls of the slime cube (the shadow below etc).

@N8Three (if that’s his account here) is now rewriting it from scratch because he didn’t like the shader logic too much either. he’s making it physically accurate.

3 Likes

btw as of today it supports noise roughness


5 Likes

it is finally complete and can act as a full replacement for MPM. it is physically accurate, depth-invariant (visuals don’t change when you zoom), features chroma, noise roughness, distortion, “seeing” transparent and other transmissive materials, and it can even run faster.

3 Likes

This is amazing –

Chapeau!

– Pavel

If this has more options, looks better and runs faster, will it get put into regular three?

Bringing any performance improvements into MeshPhysicalMaterial would be worth considering. There is room to improve there, and with some details of how the MeshPhysicalMaterial rendering deals with roughness, resolution, and other transmissive objects.

But adding options like “rgbShift”, “noise”, “contrast”, and “saturation” would be unlikely I think. I’m not sure these are physically-based parameters, and so they may not really belong on MeshPhysicalMaterial.

this was before n8 took over though, all these settings are out. it’s a full replacement now using transmission, thickness, roughness, ior, attenuationDistance, etc. the new props are just: chromaticAberration, anisotropy. well, and distortion, the only thing that perhaps will make pbr people scratch their heads. :sweat_smile:

according to him (n8) it should be physically accurate, perhaps more so than the original MPM for instance depth-invariance. if you give MPM a roughness and zoom out.


the color difference between the two is merely because MPM can’t “see” the backwalls and the shadowplane, in the original sketchfab model walls are a transparent side=backside extra mesh, the shadow plane is transparent as well. in that regard MTM should be more accurate as well.

1 Like

you can use it in regular three, it’s just a plain old shadermaterial. i do hope that inbuilt materials get better of course but that shouldn’t have to stop you. i think chroma + noise blur could quite easily be ported to MPM. though mrdoob has already said he wouldn’t want a noisy output. w/o noise the chroma will also fall apart and turn into red green blue banding with sharp edges.

1 Like

@bmb here’s a vanilla sandbox

4 Likes

Awesome thing!
But I wondering, if there’s a way to change the grey background color of the scene?
Cause it will always stay this light grey? Is it caused by the ior?

the demo? the background comes from the environment (<Environment ... background blur={1} />). you can use whatever background you like.

this seems to be broken with three r153…

breaking change in three :pensive: can’t access laptop for today but I fixed the react version already, it’s about anisotropy I believe

1 Like

Is a fix for this in the works? This is amazing and I would love to use it in an updated three revision.

fixed it, it’s not anisotropy now but anisotrophicBlur

2 Likes