If it's not working for you, make sure you have opaque texture set to on in the camera settings! Also, you'll need to set the IOR value to anything other than 0 to see a difference.
Interesting tutorial, I've tried this in 2020 with URP and does it still get plugged into Emission? Because all that happens is the object goes bright white.
This is great, but I found a few problems. I'm using this for windows with a wavy normal map. But since it's using the screen space render texture, then you can see objects that are in front of your glass through the glass. It could be pretty cool, but not what I'm looking for. This gets even worse when you introduce a normal map, cause then things from the far left or right side of the screen get mixed into the refraction. I'm going to try and use a stencil cut out to fix this
Hey I followed your tutorial, my glass texture is showing up in my editor and game mode but not in my Oculus Quest, it just shows up as grey transparent sphere. Do you happen to know the problem ?
As there been any fix found for this ? I have the exact same problem with Oculus Quest and Unity 2019.4.14f1 (pain in the ass to debug as it only occurs when using the headset)
I tried this, but for some reason the refraction (IOR = positive number) rotates clockwise as i zoom out... (anti clockwise IOR =negative number) ? Any thoughts ? ta :)
How do you prevent objects in front of the shader-textured object from showing up in its refraction? I only want objects behind the object to get refracted. Is this possible with this technique? Or is it possible to set certain layers to not show up in the refraction? That would also work for me...
Good question, as far as I know as long as the object is being rendered before rendering the transparent objects, then it will show up in the Color Texture node (which means in the refraction), so I am not sure if there is a way to dynamically show and hide objects based on if they are in front or at the back of the refractive object, however you can make objects not show either way by playing with their render queue, which might not look right unless you make them transparent (by that I only mean in the drop down, they can still have alpha=1)
Doesn't work for me. It renders a cube as light gray. I change the pbr master node Surface to Transparent. If I change the blend from Alpha to Additive I get a half transparent white color.
idk how i messed up at the first step but my scene color to albedo aint working like yours and other peoples. and i checked a lot of settings to see if they were similar so idk
For the ones that have the error "undeclared identifier refract" for unity 2019.3 Create a shader->PBR Graph->open the graph->in the PBR Master select the settings icon->set Surface to Transparent like in the video at 1:29
@@AETutsVidsI'd need to do this on the shader side since I have a big combined mesh (think window frame with glass). It seems to be really easy with most shaders, but for some reason shader graph seems to be lacking this function. But thank you!
I got your materials from the asset store, but I can't find this glass shader example. Also, I have tried to build the same shader you have have but mine looks completely different (terrible quality). Pretty sure I have all settings mentioned here. Any help is appreciated
He has a second video, where he does the same kind of effect with reflection probes, instead of the render texture. He explains some more things there, since he made that vid first
useful tutorial, very cool, used it for a camera warp effect
If it's not working for you, make sure you have opaque texture set to on in the camera settings! Also, you'll need to set the IOR value to anything other than 0 to see a difference.
@@WolffRahm_ Awesome, I'm glad I was able to help out!!
Got stuck for a few minutes and almost gave up, got it working thanks to this comment. Thank you.
@@kristianthaler6525 awesome!! I'm glad I was able to help!
Lol apparently I had the same reply for someone else, too. 😅
Thank you for the awesome tutorial!
You're very welcome!
Interesting tutorial, I've tried this in 2020 with URP and does it still get plugged into Emission? Because all that happens is the object goes bright white.
I tried this on 2021 urp, and didn't work on Emission,, but still this is a great tutorial
I look trough this material everything is ok,, except some Transparent materail , I't mean i can't see the Glass ball by another glass ball.
did't work at unity 2019.4.9f1 with URP, make just a white transparent sphere =(
Look at the first solution here
answers.unity.com/questions/1692270/scene-color-node-not-working-in-shader-graph.html
@@rafwins2000 That worked for me. Thanks!!!
Thanks! I even figured out how to use this with a normal map to distort the glass even more in a realistic way!
Any way to fill it with color?
Doesnt work for me 😕
This is great, but I found a few problems. I'm using this for windows with a wavy normal map. But since it's using the screen space render texture, then you can see objects that are in front of your glass through the glass. It could be pretty cool, but not what I'm looking for. This gets even worse when you introduce a normal map, cause then things from the far left or right side of the screen get mixed into the refraction. I'm going to try and use a stencil cut out to fix this
yes true, it might be possible to use the depth texture to check if an object is in front then don't do any refraction
@@AETutsVids Yeah I saw some videos using that method, but it makes visibility through the glass bad. And it has some side effects
Hey I followed your tutorial, my glass texture is showing up in my editor and game mode but not in my Oculus Quest, it just shows up as grey transparent sphere. Do you happen to know the problem ?
Not exactly sure, thou usually in VR there are two cameras for each eye, so this might be why
Heywassup
As there been any fix found for this ? I have the exact same problem with Oculus Quest and Unity 2019.4.14f1 (pain in the ass to debug as it only occurs when using the headset)
i did in unity version 2021 and no works, some help?
I tried this, but for some reason the refraction (IOR = positive number) rotates clockwise as i zoom out... (anti clockwise IOR =negative number) ? Any thoughts ? ta :)
How do you prevent objects in front of the shader-textured object from showing up in its refraction? I only want objects behind the object to get refracted. Is this possible with this technique? Or is it possible to set certain layers to not show up in the refraction? That would also work for me...
Good question, as far as I know as long as the object is being rendered before rendering the transparent objects, then it will show up in the Color Texture node (which means in the refraction), so I am not sure if there is a way to dynamically show and hide objects based on if they are in front or at the back of the refractive object, however you can make objects not show either way by playing with their render queue, which might not look right unless you make them transparent (by that I only mean in the drop down, they can still have alpha=1)
Doesn't work for me.
It renders a cube as light gray. I change the pbr master node Surface to Transparent. If I change the blend from Alpha to Additive I get a half transparent white color.
Did you enable opaque texture from the LWRP settings?
i can't believe i went from unity 2018 to 2019 so that hardly any glass shader works for me or they are techniques who uses reflection probes
i'm trying this shader again and my scene is shaking like crazy, why is that? any fix?
idk how i messed up at the first step but my scene color to albedo aint working like yours and other peoples. and i checked a lot of settings to see if they were similar so idk
Its giving me an error in the code for the custom function on the word: refract()
me too
Fixed it. Create a shader->PBR Graph->open the graph->in the PBR Master select the settings icon->set Surface to Transparent like in the video at 1:29
mine is pink brah
For the ones that have the error "undeclared identifier refract" for unity 2019.3
Create a shader->PBR Graph->open the graph->in the PBR Master select the settings icon->set Surface to Transparent like in the video at 1:29
just clear console, its temporary error
Also they're normal brackets ( ) not curly { } i made that mistake , maybe someone else did toooo
... What about URP?
What type of shad are you creating?
I adapted this into Amplify Shader Editor :)
how you did? show me all nodes, please
Can I use it in 2d
OMG THE CUSTOM FUNCTION DIDN'T GIVE ME THAT BUG, AYYYYYY
Awesome thank you!
Nice
Is there a way to make this material not cast shadows?
Casting shadows can be turned off from mesh renderer component
@@AETutsVidsI'd need to do this on the shader side since I have a big combined mesh (think window frame with glass). It seems to be really easy with most shaders, but for some reason shader graph seems to be lacking this function. But thank you!
I followed your tutorial and I can't get it to work. I have a very weird result on one side and other side of the cube is just white :/
Make sure the master node is set to transparent
@@AETutsVids yeah I did. Np just gonna use a transparent material
Also make sure the quality settings you have opaque texture enabled, otherwise I donno what is wrong, have a nice one
How do you add the settings to the project?
if you open Edit > Project Settings and click on the Quality tab
did same not working
What is the result?
I had an issue with the Custom function, so here is what it should be: Out = refract(View, Normal, IOR);
Your function is a same of the video, but I could be wrong.
Alban TIPREZ I just found the function to be hard to read at the videos resolution. I decided to put it here so it could be copied
@@zacksnyder5861 AAH Sorry, I had a problem with my shader, so I misunderstood your comment.
Thank you very much! I'm creating a AR Project.Your last tutorial about using probe is not perfectly suitable,but this is!
Yes, this method is also much better for all types of water objects
Works wierd in 2019.3
Define wierd
I am not even able to open a URP project in 2019.3
@@AETutsVids ua-cam.com/video/t5fUDhuqsnQ/v-deo.html
IOR is "changing" depending on camera distance
Wierd distortion (on top of cube for example)
As for the latter, I'm not sure, maybe it should be so :D
@@yori4434 sorry I missed your comment, make sure to normalize the view direction node
@@AETutsVids But it is normalized :D
I got your materials from the asset store, but I can't find this glass shader example. Also, I have tried to build the same shader you have have but mine looks completely different (terrible quality). Pretty sure I have all settings mentioned here. Any help is appreciated
Hey lets talk in emails or on Facebook, anasainea@gmail.com
He has a second video, where he does the same kind of effect with reflection probes, instead of the render texture. He explains some more things there, since he made that vid first