Skip to content

s4k10503/UnityShaderCollection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnityShaderCollection

I plan to add various shaders in the future.

Visualizer2D.unity

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.

Features

  • 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.

Usage

  1. Open your Unity project.
  2. Assign the instance of the shader handler you want to use (such as PixelArtHandler) to the _shaderHandler field of the Visualizer.cs script.
  3. Run your project.

Examples

Pixelart

This is a sample of piexlart effect using PixelArtHandler.cs & PixelArt.compute.

lenna_pixelart

ImageRotation

This is a sample of rotation effect using ImageRotationHandler.cs & ImageRotationComputeShader.compute.

lenna_rotation

Glitch

This is a sample of glitch effect using GlitchEffectHandler.cs & GlitchEffect.compute.

lenna_glitch

Twirl

This is a sample of twirl effect using TwirlEffectHandler.cs & TwirlEffect.compute.

lenna_twirl

RadialBlur

This is a sample of radial blur effect using RadialBlurHandler.cs & RadialBlur.compute.

lenna_radialblur

Shake

This is a sample of shake effect using ShakeHandler.cs & shake.compute.

lenna_shake

Shake2

This is a sample of shake effect using ShakeHandler.cs & shake2.compute.

lenna_shake2.mp4

Fisheye

This is a sample of shake effect using FisheyeHandler.cs & Fisheye.compute.

lenna_fisheye.mp4

Visualizer3D.unity

This is a sample project that allows for the visualization and dynamic manipulation of shaders in Unity.

Features

  • 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.

Usage

  1. Open your Unity project.
  2. Navigate to the object where you have attached a script derived from MaterialShaderHandler.
  3. Assign the material you wish to manipulate to the TargetMaterial field of the script.
  4. Run your project. You can now dynamically adjust the shader parameters via the script.

Examples

ViewAngleTransparency

This is a sample of the ViewAngleTransparency effect using ViewAngleTransparencyHandler.cs & ViewAngleTransparency.shader.

ViewAngleTransparency.mp4

ToonWithOutline

This is a sample of the Toon effect using ToonWithOutlineyHandler.cs & ToonWithOutline.shader.

ToonWithOutline_256.mp4

Linear01Depth

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

LinearEyeDepth

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.

LinearEyeDepth.mp4

About

This is a sample of various shaders in Unity.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published