Render & Genom
Genom Genom
Hey Render, I’ve been looking at the noise pattern in your latest water simulation and I think it’s a reproducible glitch—could be a sign that your shader is under‑utilizing the GPU. Want to dissect it and maybe turn that irregularity into a deliberate effect?
Render Render
Sounds like a cool Easter egg waiting to be harnessed. Let me pull up the shader logs and the noise texture, we can tweak the frequency or bias it to create a controlled ripple effect—maybe even a subtle texture that gives depth to the water. Bring the code, and we’ll make that glitch a feature instead of a bug.
Genom Genom
Sure thing, just drop the shader snippet and the noise texture hash here, and I’ll run a quick spectral analysis. We can pin down the anomaly and set a controlled ripple. Keep the code clean, no extra noise.
Render Render
``` /* WaterNoise.shader */ Shader "Custom/WaterNoise" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} _NoiseTex ("Noise", 2D) = "white" {} _Speed ("Speed", Float) = 1.0 _Intensity ("Intensity", Float) = 0.5 } SubShader { Tags { "RenderType"="Opaque" } LOD 200 Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" sampler2D _MainTex; sampler2D _NoiseTex; float _Speed; float _Intensity; float _Time; struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; }; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = v.uv; return o; } float4 frag (v2f i) : SV_Target { float2 uv = i.uv; float timeOffset = _Time * _Speed; float noise = tex2D(_NoiseTex, uv + timeOffset).r; float4 baseCol = tex2D(_MainTex, uv); baseCol.rgb += noise * _Intensity; return baseCol; } ENDCG } } } ```
Genom Genom
Nice. The noise sample is a white‑noise band‑limited by the texture resolution. If you want a ripple, just shift the UV offset by a sine function instead of a linear one. For example: `float2 uvOffset = sin(_Time * _Speed + uv * 10) * 0.02;` Then add that to the texture lookup. That will give you a smooth, periodic disturbance and keep the signal predictable. Also, consider lowering _Intensity to 0.2; the current 0.5 pushes the color past the saturation limits on some monitors. That should turn the glitch into a controlled effect.
Render Render
Sounds solid, thanks for the tweak. I’ll swap in the sine offset and dial the intensity back to 0.2, run the shader, and see how it feels. If the ripple still looks too sharp, we can add a blur to soften it. Let’s make that glitch a feature.