I plan to add various shaders in the future.
This is a sample that visualizes the result of image processing using a compute shader in Unity.
Applies specific image processing effects based on user-specified parameters.
- IComputeShaderHandler Interface
- This interface abstracts the execution of any shader.
- ComputeShaderHandler Class
- This class implements the IComputeShaderHandler interface and defines the generic behavior for shader processing.
- ThredSize Struct
- This structure defines the thread size of the shader.
- The thread size is used to specify the dimension of the threads in the grid in a compute shader run.
- This structure specifies the number of threads for the X, Y, and Z directions.
- Visualizer Class
- This class uses an instance of ComputeShaderHandler or its subclasses to perform specific shader processing.
- Open your Unity project.
- Assign the instance of the shader handler you want to use (such as PixelArtHandler) to the _shaderHandler field of the Visualizer.cs script.
- Run your project.
This is a sample of piexlart effect using PixelArtHandler.cs & PixelArt.compute.
This is a sample of rotation effect using ImageRotationHandler.cs & ImageRotationComputeShader.compute.
This is a sample of glitch effect using GlitchEffectHandler.cs & GlitchEffect.compute.
This is a sample of twirl effect using TwirlEffectHandler.cs & TwirlEffect.compute.
This is a sample of radial blur effect using RadialBlurHandler.cs & RadialBlur.compute.
This is a sample of shake effect using ShakeHandler.cs & shake.compute.
This is a sample of shake effect using ShakeHandler.cs & shake2.compute.
lenna_shake2.mp4
This is a sample of shake effect using FisheyeHandler.cs & Fisheye.compute.
lenna_fisheye.mp4
This is a sample project that allows for the visualization and dynamic manipulation of shaders in Unity.
- IMaterialShaderHandler Interface
- This interface serves as a generalized contract for handling different types of shaders.
- MaterialShaderHandler Class
- This class acts as a base class implementing the IMatesialShaderHandler, designed for generic shader manipulations.
- Open your Unity project.
- Navigate to the object where you have attached a script derived from MaterialShaderHandler.
- Assign the material you wish to manipulate to the TargetMaterial field of the script.
- Run your project. You can now dynamically adjust the shader parameters via the script.
This is a sample of the ViewAngleTransparency effect using ViewAngleTransparencyHandler.cs & ViewAngleTransparency.shader.
ViewAngleTransparency.mp4
This is a sample of the Toon effect using ToonWithOutlineyHandler.cs & ToonWithOutline.shader.
ToonWithOutline_256.mp4
This is a sample that uses Linear01DepthHandler.cs and Linear01Depth.shader to visualize a linearized depth buffer.
The screen displays the linearized depth value between 0 and 1 based on the near and far clips on the screen.
You can adjust near and far clips from the inspector.
LinarDepth_256.mp4
This is a sample that uses LinearEyeDepthHandler.cs, LinearEyeDepth.shader, and InvertedDepthColor.compute to visualize a linearized depth buffer.
The screen displays the reciprocal of the actual depth value from the camera to the object.
Clicking on the screen will display the actual depth value at that coordinate on the console.
You can adjust near and far clips from the inspector.