#Refraction issue in HDRP
1 messages · Page 1 of 1 (latest)
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
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
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.
Oh. The title seems to be missleading, but good to know.
What i really meant is that inside a single object i get a smaller nonexistent object rendered like in the image
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
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.
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.
Refraction issue in HDRP
Can you show a screenshot of the material inspector ?
And by any chance, isn't this sphere model a hollow sphere (with inside and outside faces) by any chance ? Did you try with a Unity default sphere ?
I will send a screenshot in a bit
I tried the default sphere too, but im getting the same result
selected one is the default sphere from Unity. Right one is a sphere i made in blender of higher quality. The higher the IOR, the more vissible this effect is
I don't remember having seen something like this ever before ...
Could you maybe share the project so I can have a look ?
yes, but how should i share it?
archive sent with wetransfer or something else?
Zip the projet (without library folder) and send over here if not too big, ore use a file sharing service like wetranfer, google drive ....
alr
here it is
it might be a setting i was never aware of, but i had this issue for a few years
It's seems indeed to be something project related ... but I don't know what yet
Or more ... something in the scene itself 🤔
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
this is how it should look. this is from a fresh project with the HDRP demo scene.
IOR is 1.033
Is the above not ray traced refaction?
No, that's regular screen space refraction.
where is that other stuff then, behind the sphere?
Yes
ah my memory of this demo was wrong
@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.
oh. that would exmaplain it
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.
That makes a lot of sense actually, why not use a resource that will create more accurate refraction?