Skip to content

Unity Shader Code with “BASIC×SHADER”

Notifications You must be signed in to change notification settings

whichow/BASICxSHADER

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BASIC×SHADER

Unity Shader Code with “BASIC×SHADER

Frames

Getting Started

Unlit Shader

To set a shader to Unity object, assign through a material. Let's create object for display, material for the object, and shader for the material.

Object

Create a sphere object via GameObject > 3D Object > Sphere from the Unity Editor menu.

Object (Wireframe)

Material

Create a material file via Assets > Create > Material from the Unity Editor menu. Assign the material to the object.

Inspector (Object)

Shader

Create a shader file via Assets > Create > Shader > Unlit Shader from the Unity Editor menu. Replace the contents of shader with the code below and assign the shader to the material.

Inspector (Material)

Shader "BASICxSHADER/Unlit" {
  SubShader {
    Pass {
      CGPROGRAM
      #pragma vertex vert
      #pragma fragment frag

      float4 vert(float4 vertex : POSITION) : SV_POSITION {
        return UnityObjectToClipPos(vertex);
      }

      fixed4 frag() : SV_Target {
        return fixed4(1.0, 0, 0, 1.0);
      }
      ENDCG
    }
  }
}

#3 Lighting

#3.1 Ambient

Ambient

#3.2 Diffuse

Diffuse

#3.3 Specular

Specular

#3.4 Phong

Phong

#3.5 Blinn-Phong

Blinn-Phong

#3.6 Rim

Rim

#3.7 Toon

Toon

#3.8 Oren-Nayar

Oren-Nayar

#3.9 Cook-Torrance

Cook-Torrance

#3.10 SH

SH

#3.11 Point/Spot

Point/Spot

#4 Texturing

#4.1 Color

Color

#4.2 Gloss

Gloss

#4.3 Bump

Bump

#4.4 Parallax

Parallax

#4.5 Reflection

Reflection

#4.6 Refraction

Refraction

#5 Shadow

#5.1 Projection

Projection

#5.2 Volume

Volume

#5.3 Map

Map

#6 Fog

#6.1 Depth

Depth

#6.2 Distance

Distance

#6.3 Height

Height

#7 PostEffect

#7.1 Original

Original

#7.2 Negaposi

Negaposi

#7.3 Grayscale

Grayscale

#7.4 Sepia

Sepia

#7.5 Threshold

Threshold

#7.6 Mosaic

Mosaic

#7.7 LED

LED

#7.8 Noise

Noise

#7.9 Scanline

Scanline

#7.10 Twirl

Twirl

#7.11 Fisheye

Fisheye

#7.12 Sobel

Sobel

#7.13 Kuwahara

Kuwahara

#7.14 FXAA

FXAA

#7.15 ZoomBlur

ZoomBlur

#7.16 MotionBlur

MotionBlur

#7.17 GaussianBlur

GaussianBlur

#7.18 Bloom

Bloom

#7.19 DOF

DOF

#7.20 SSAO

SSAO

About

Unity Shader Code with “BASIC×SHADER”

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • ShaderLab 76.3%
  • GLSL 17.9%
  • C# 5.8%