#Refraction issue in HDRP

1 messages · Page 1 of 1 (latest)

gritty pelican
#

Hello,

I need help figuring out how to fix the refractive sphere inside of my refractive sphere like in the attached image.
I found out that screen-space refraction might be causing it, but if make the same material in the prebuilt HDRP sample project, I dont have any problems.

How can I fix this?

chrome flax
#

What does it look like n the other scene/project? transparents render ordered by object center so it could be easy for the draw order for these two to flip

gritty pelican
#

In the other project, i had the HDRP demo scene downloaded. It was looking fine there. The thing is. This is the only transparent thing in the scene.. in that project, i had like 4 of them and it was working fine

#

I can give more detail once i get home in 9 hours

silver haven
#

Nested refraction is just something that can't work out of the box in HDRP.
The proper way to do it is with RayTracing + recursive rendering.

A hacky way without RT is to use a "Before Refraction" render pass setting of a transparent object, and use a custom refraction shader in it. But is is still limited to two objects.

gritty pelican
#

I needed a way to fix it

#

I dont even know where to look in the demo scene example to search for a way to fix it. I usually dont really touch graphics stuff.

#

I thought that making a fresh project might fix it, but it didn't

silver haven
#

What needs to be understood is that refraction needs to read from the screen color pyramid.
But by default, only opaque objects are there, and all transparent objects (including refracting ones) are rendered in the same pass, so refracting objects can't "see" other transparent.

To force this, some part of the transparent objects can be forced to render early on by changing the Rendering Pass to "Before Refraction". You can render as many non refractive transparent objects as you want here.

You can further hack it a bit by faking refraction by using Distortion.

So, all in all, without raytracing you can stack up to 3 "layers" of transparent objects : transparent before refraction -> transparent with refraction -> fake refraction with distortion.

And like it was mentioned in the first answer, you also need to take into account the transparent rendering order, which is from the furthest to the closest from the camera, based on the pivot point.

#

If you have a screenshot of your issue and can explain what you ideally want, we can try to figure out how to set things up.

gritty pelican
#

so, I have simple sphere, that i want to have a refractive material on it, so it looks like a glass ball, nothing else in the scene, only 1 single sphere.
when i attach the transparent refractive material, instead of having a nice uniform material that distorts the image around the edges of the sphere, i get something like in the 2nd image. The refraction i want is the one in the 3rd example, with the colored spheres

#

I have no idea what from the HDRP demo project fixed this issue, but i could not figure it out.

gritty pelican
#

Refraction issue in HDRP

silver haven
gritty pelican
#

I will send a screenshot in a bit

#

I tried the default sphere too, but im getting the same result

gritty pelican
silver haven
#

I don't remember having seen something like this ever before ...
Could you maybe share the project so I can have a look ?

gritty pelican
#

archive sent with wetransfer or something else?

silver haven
#

Zip the projet (without library folder) and send over here if not too big, ore use a file sharing service like wetranfer, google drive ....

gritty pelican
#

alr

#

here it is

#

it might be a setting i was never aware of, but i had this issue for a few years

silver haven
#

It's seems indeed to be something project related ... but I don't know what yet

#

Or more ... something in the scene itself 🤔

gritty pelican
#

at some point chat gpt told me it could be because of the screen space refraction, but it was working fine in the HDRP demo scene

gritty pelican
#

this is how it should look. this is from a fresh project with the HDRP demo scene.

#

IOR is 1.033

gritty pelican
chrome flax
#

Is the above not ray traced refaction?

silver haven
#

No, that's regular screen space refraction.

chrome flax
#

where is that other stuff then, behind the sphere?

silver haven
#

Yes

chrome flax
#

ah my memory of this demo was wrong

silver haven
#

@gritty pelican I think I've found what's happening : your scene is missing reflection probes.
In the HDRP sample scene, or even the HDRP outdoor scene template, both have reflection probes set that are also used when rendering screen space refraction.
If I put your orange refractive sphere in the HDRP sample scene, it look ok, but if I remove the reflection probes it breaks.

gritty pelican
#

oh. that would exmaplain it

silver haven
#

Similarly, if I add a reflection probe in you test scene, it looks way better :

#

I didn't remember that refraction was so much different with and without a reflection probe, and am a bit surprised.
I'll poke some colleagues about it on monday.

chrome flax
#

That makes a lot of sense actually, why not use a resource that will create more accurate refraction?