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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
BackgroundTexturewhile the main camera will render everything. We will slap theBackgroundTextureon the reflective object's emissive map and using normals we will bend the UVs so it looks reflected.Limitations
BackgroundTexturewill not be refracted : it won't be physically correct and if the refraction goes beyond the texture, you'll see it repeat itself.BackgroundTexturewill 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