Refractive material for water and glass #1011
ykafia
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone !
This is just going to be a short tutorial on how to make a refractive material with Stride.
General idea
The general idea is to render everything but the refractive objects on a separate render target/texture (that we will call
BackgroundTexture
while the main camera will render everything. We will slap theBackgroundTexture
on the reflective object's emissive map and using normals we will bend the UVs so it looks reflected.Limitations
BackgroundTexture
will not be refracted : it won't be physically correct and if the refraction goes beyond the texture, you'll see it repeat itself.BackgroundTexture
will be refracted : Everything that's in front of the reflective material will also be refracted (which is really not how real world refraction works). But i think this might be corrected with a more complex technique involving a depthmap.First step, setting up the scene :
Le Shader
Here's the SDSL code for the refraction shader
Setting up the graphics compositor
Result
Beta Was this translation helpful? Give feedback.
All reactions