6
2012
Radial Blur Shader
Using the same godrays shader, you get nice radial blur effect for images. This one is also modified to use objectUV, instead of screenUV,
so you can rotate the plane around..
Webplayer:
http://unitycoder.com/upload/demos/Radial_Blur_shader_unity/ *webplayer broken in current unity webplayer version?
Shader source:
// FakeRadialBlur shader for Unity (v1.0) // based on this shader: http://unitycoder.com/blog/2012/10/02/fake-godrays-shader/ // which is converted/based on this webgl shader: http://demo.bkcore.com/threejs/webgl_tron_godrays.html Shader "UnityCoder/FakeRadialBlur" { Properties { tDiffuse ("Base (RGB)", 2D) = "white" {} fX ("fX", Float) = 0.5 fY ("fY", Float) = 0.5 fExposure ("fExposure", Float) = 0.6 fDecay ("fDecay", Float) = 0.93 fDensity ("fDensity", Float) = 0.96 fWeight ("fWeight", Float) = 0.4 fClamp ("fClamp", Float) = 1.0 //iSamples ("iSamples", Int) = 20 } SubShader { Tags { "RenderType"="Opaque" } LOD 200 Cull Off CGPROGRAM #pragma target 3.0 #pragma surface surf Lambert sampler2D tDiffuse; float fX,fY,fExposure,fDecay,fDensity,fWeight,fClamp,iSamples; struct Input { float2 uvtDiffuse; float4 screenPos; }; void surf (Input IN, inout SurfaceOutput o) { int iSamples=100; float2 vUv = IN.uvtDiffuse; //vUv *= float2(1,1); // repeat? float2 deltaTextCoord = float2(vUv - float2(fX,fY)); deltaTextCoord *= 1.0 / float(iSamples) * fDensity; float2 coord = vUv; float illuminationDecay = 1.0; float4 FragColor = float4(0.0); for(int i=0; i < iSamples ; i++) { coord -= deltaTextCoord; float4 texel = tex2D(tDiffuse, coord); texel *= illuminationDecay * fWeight; FragColor += texel; illuminationDecay *= fDecay; } FragColor *= fExposure; FragColor = clamp(FragColor, 0.0, fClamp); float4 c = FragColor; o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
3 Comments + Add Comment
Leave a comment
Recent posts
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
Very nice!!! Wish I had found this site earlier, but from now on I’ll come back always looking for new shaders 🙂
Thank you very much.
^ shader source added
Thanks for this, helped a lot.
I had to make some changes for this to work for WebGL builds.