Blurry refraction quality

Loading a GLTF with a refractive material which additionally has some roughness looks like this:

The result is not very pretty — I’m wondering if it’s possible to increase the quality of the mipmaps on the opaqueSceneTexture which is used for displaying the refraction?

I have tried to increase the renderSize on the TransmissionHelper but this does not improve the quality when the material is rough. I stumpled upon this case study: Lusion - Work | Maxmara Bearing Gifts where they write about Bicubic sampling would look better:

Hello! Would you be able to share your model so we can take a look? In the meantime, I’ll tag @PatrickRyan who might have encountered this before.

I can’t share this specific model, but I quickly created a test in Blender:

Download with .glb, .gltf and .blend files: RefractionTest.zip (115.2 KB)

1 Like

Also @sebavan do you think we could add the bicubic sampling? :thinking:

The main issue is prefiltering the render target in real time would cost a lot, so we would need a similar technique to our realtime filtering technique which unfortunately requires a cube texture (expensive to render) to work accurately.

I guess we could try an hybrid approach filtering in a bicubic way one lod level above. We are not thriving for correctness anyway in this case as it is already not Physically based.

Yeah I was thinking about the one lod above approach too it might already be enough

I do not think so as roughness 1 will still be blocky :slight_smile: we need a smooth filter to workaround it

@sebavan, since we outside the realm of physically accurate, rather than using refraction and needing to do real-time sampling, could we just use a render target texture at a low resolution - so we aren’t dealing with mips - and then apply a bicubic sample on that texture? I know we are doing most of the same steps since we still have an RTT to sample every frame, but we are cutting down on the number of mips we are sampling. It wouldn’t work with PBR parameters, but I think you could simulate different roughness through setting the RTT size and thus controlling the blur and simulating roughness.

not really as the roughness is not necessarily constant :slight_smile: so the best we can do is kind of blur

1 Like

Is there no solution to this problem in the new version?

nope, cc @Evgeni_Popov who might have improved some of the samples a bit/

Here’s a material plugin that uses bicubic sampling to improve refraction:

6 Likes

This looks a lot better, thanks for your work on this! I guess there is a way to push the quality even higher, especially in motion you can still see some blocking. I’m not really fluent with GLSL code, but I’m sure I’ll figure it out, when I play around with it

1 Like