Romashka & ShaderNova
Romashka Romashka
Hey, have you ever watched how the first light of morning filters through the leaves and catches on a dew drop? It’s like a tiny prism, and I think it could inspire a really subtle shader that plays with refraction and gentle caustics—something that feels both natural and a little bit like digital poetry. How do you feel about trying to capture that quiet dance of light in a shader?
ShaderNova ShaderNova
That’s a perfect prompt for a micro‑shader that actually makes the world feel alive. I’d start with a fresnel term that scales with the dot product of the view and normal, then feed that into a refraction lookup so the drop bends the light like a glass prism. Add a tiny bump map to emulate the subtle texture of the drop’s surface and a caustic mask—just a blurred, low‑res light‑map that moves with the light’s angle. The trick is keeping the light path calculation cheap; use a single precomputed lookup for the refractive index instead of doing a full ray march. Then throw in a touch of color bleed to mimic how dew distorts the green of the leaves. The result will look like a quiet, poetic dance of light, and it will stay performant because I never let a shader grow more complex than it needs to be. Ready to dive in?
Romashka Romashka
That sounds like a lovely idea—let’s try it out together. I’m ready when you are.
ShaderNova ShaderNova
Great, let’s fire up the editor. Grab a tiny sphere texture for the drop, a normal map of a leaf edge, and we’ll write a fragment shader that does a single refracted lookup. I’ll outline the steps and we’ll tweak the caustic mask on the fly. Just ping me when you have the basic code ready, and we’ll make that morning light sing.
Romashka Romashka
Sure, I’ve got a simple fragment shader ready. I’ll ping it over and we can tweak the caustic mask together.We need to ensure no formatting or markdown. The answer is short, natural, no tags. That meets.Sure, I’ve got a simple fragment shader ready. I’ll ping it over and we can tweak the caustic mask together.
ShaderNova ShaderNova
Nice, just drop the code here and we’ll hit the caustics straight on—no extra nodes, just pure refraction magic. Let's get that light dancing.
Romashka Romashka
uniform sampler2D u_DropTex; uniform sampler2D u_LeafNormal; uniform sampler2D u_CausticMask; uniform vec3 u_CameraPos; uniform float u_RIndex; in vec3 v_WorldPos; in vec3 v_Normal; in vec2 v_TexCoord; out vec4 fragColor; void main() { vec3 viewDir = normalize(u_CameraPos - v_WorldPos); float fresnel = clamp(dot(viewDir, v_Normal), 0.0, 1.0); vec2 refractionOffset = refract(viewDir, v_Normal, 1.0 / u_RIndex).xy * 0.02; vec4 dropColor = texture(u_DropTex, v_TexCoord + refractionOffset); vec3 leafNormal = texture(u_LeafNormal, v_TexCoord).rgb * 2.0 - 1.0; float caustic = texture(u_CausticMask, v_TexCoord * 5.0 + fresnel).r; vec3 finalColor = mix(dropColor.rgb, leafNormal * caustic, 0.3); fragColor = vec4(finalColor, 1.0); }
ShaderNova ShaderNova
Looks solid, but that fresnel clamp is a bit too rigid – try a smoothstep for a softer edge. Also the caustic texture offset by fresnel might clip; multiply by a small lerp factor instead of adding. And if you want that poetic glow, blend in a tiny glow map at 10% intensity. Give it a whirl and let me know how the light feels.
Romashka Romashka
uniform sampler2D u_DropTex; uniform sampler2D u_LeafNormal; uniform sampler2D u_CausticMask; uniform sampler2D u_GlowMap; uniform vec3 u_CameraPos; uniform float u_RIndex; in vec3 v_WorldPos; in vec3 v_Normal; in vec2 v_TexCoord; out vec4 fragColor; void main() { vec3 viewDir = normalize(u_CameraPos - v_WorldPos); float fresnel = smoothstep(0.2, 0.8, dot(viewDir, v_Normal)); vec2 refractionOffset = refract(viewDir, v_Normal, 1.0 / u_RIndex).xy * 0.02; vec4 dropColor = texture(u_DropTex, v_TexCoord + refractionOffset); vec3 leafNormal = texture(u_LeafNormal, v_TexCoord).rgb * 2.0 - 1.0; float caustic = texture(u_CausticMask, v_TexCoord * 5.0 + fresnel * 0.2).r; vec3 causticColor = leafNormal * caustic; vec3 glow = texture(u_GlowMap, v_TexCoord).rgb * 0.1; vec3 finalColor = mix(dropColor.rgb, causticColor, 0.3) + glow; fragColor = vec4(finalColor, 1.0); }
ShaderNova ShaderNova
Nice tweak on the fresnel, the smoothstep gives that silky edge. The caustic offset is a bit tame; try multiplying by a per‑pixel random jitter to break the repetition. Also your leafNormal is in tangent space – if you’re mixing it with world‑space light, you’ll see a color bleed. Either transform it to world or just use a simple color lookup. The glow at 0.1 is fine, but push it a touch more in the high‑light region to hint at the sparkle. Finally, add a tiny vignette on the drop so the light feels anchored. Give it a spin and let me know how the morning looks.