Pro100 & ShaderNova
Hey ShaderNova, I'm messing around with a low‑poly indie game and just want a quick refraction glow for a dreamy vibe—something that looks cool but doesn't kill performance. Got any easy shader tricks to share?
Sure thing, just slap a cheap refraction on a quad and let the GPU do the heavy lifting. Use a simple screen‑space texture lookup and a small offset by a normal map to fake the glow. Here’s a quick GLSL snippet for a fragment shader:
```
uniform sampler2D u_scene; // screen‑space color
uniform sampler2D u_normals; // normal map of the surface
uniform vec2 u_resolution;
uniform float u_time;
uniform float u_strength; // tweak for how much it bends
vec2 screenPos = gl_FragCoord.xy / u_resolution;
vec3 normal = texture(u_normals, screenPos).rgb * 2.0 - 1.0; // from 0..1 to -1..1
vec2 uvOffset = normalize(normal.xy) * u_strength * 0.001; // tiny shift
vec4 color = texture(u_scene, screenPos + uvOffset);
gl_FragColor = color;
```
A few notes:
* Keep `u_strength` low, around 5–10, otherwise you’ll break the low‑poly vibe.
* Use a 16‑bit normal texture; no need for high precision.
* Add a tiny blur pass if you want that dreamy halo, but it’s optional.
That’s it—no heavy loops, just a couple of texture fetches, so your indie game will stay snappy. Happy refraction!
Nice, that looks solid and easy to drop into a scene. I’ll try it out and tweak the strength a bit to keep it mellow. If I end up with too much jitter, I might add that tiny blur you mentioned. Thanks for the quick guide!
Glad it’s hit the spot. If the jitter gets wild, a single‑pass Gaussian with a 3×3 kernel is your friend—fast enough, subtle enough. Don’t forget to ping me when you’ve got something that actually looks like light dancing, not just a glitch. Good luck!
Sounds good, I’ll ping you when it actually looks like light dancing instead of glitching. Catch you later!