Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions SimpleShader/Assets/Materials.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Materials/LambertDark.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/LambertDark.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Materials/SimpleShader.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/SimpleShader.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Materials/TextureMaterial.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/TextureMaterial.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/MetalRusted0001_1_M.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions SimpleShader/Assets/MetalRusted0001_1_M.jpg.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions SimpleShader/Assets/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Scenes/TestScene.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Scenes/TestScene.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions SimpleShader/Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions SimpleShader/Assets/Scripts/DummyScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;

public class DumbyScript : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}
}
12 changes: 12 additions & 0 deletions SimpleShader/Assets/Scripts/DummyScript.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions SimpleShader/Assets/Shaders.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions SimpleShader/Assets/Shaders/LambertDarkShader.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Shader "LambertDarkShader"
{
Properties // Interface between shaders and unity/the inspector
{
//Name ('Display name', Type) = Default()
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
}

Subshader // Start of our shader
{
Pass // Layering effects on top of eachother
{
CGPROGRAM
#pragma vertex vertexFunction
#pragma fragment fragmentFunction

// user defined variables
uniform float4 _Color;

// structs
struct inputInformation // vertInput
{
float4 vertexPos : POSITION;
float3 vertexNormal : NORMAL;

};

struct passToFragment // vertOutput
{
float4 position : SV_POSITION;
float4 color : COLOR;
};

// vertex function
passToFragment vertexFunction(inputInformation input)
{
passToFragment output;

output.color = float4(input.vertexNormal, 1.0);

output.position = mul(UNITY_MATRIX_MVP, input.vertexPos);
return output;
}

// fragment function
float4 fragmentFunction(passToFragment input) : COLOR
{
return input.color;
}

ENDCG
}
}

// Fallback
}
9 changes: 9 additions & 0 deletions SimpleShader/Assets/Shaders/LambertDarkShader.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions SimpleShader/Assets/Shaders/SimpleShader.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Shader "SimpleShader"
{
Properties
{
// Actual name of the property (name that the user will see in the inspector, Type) = Default Value
_Color("Flibberty Ghibbet", Color) = (0.0, 0.0, 0.0, 1.0)
}

Subshader
{
Pass
{
CGPROGRAM
// Pragmas
#pragma vertex vertexFunction
#pragma fragment fragmentFunction

// User defined var
uniform float4 _Color;


// Structs for passing data
struct vertexInput
{
float4 vertexPosition : POSITION; // Get the vertex position

};

struct vertexOutput
{
float4 position : SV_POSITION; // Output the vertex position
};


// Semantics
// COLOR - the color of the vertex
// POSITION - the position of the vertex
// SV_POSITION - output position of vertex, dx11, output ONLY
// NORMAL - normal of the vertex
// TANGENT - tangent direction
// TEXCOORD0 - the first UV map
// TEXCOORD1 - the second UV map
// TEXCOORD2-??? - Empty semantics for data transfer


// Vertex function
vertexOutput vertexFunction(vertexInput input)
{
vertexOutput returnVertex;

returnVertex.position = mul(UNITY_MATRIX_MVP, input.vertexPosition);

return returnVertex;
}

// Fragment function aka pixel shader
float4 fragmentFunction(vertexOutput output) : COLOR
{

return _Color;
}

ENDCG
}
}

// Fallback
//Fallback "Diffuse"
}
9 changes: 9 additions & 0 deletions SimpleShader/Assets/Shaders/SimpleShader.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions SimpleShader/Assets/Shaders/TextureShader.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Shader "TextureShader"
{
Properties
{
// Actual name of the property (name that the user will see in the inspector, Type) = Default Value
_Color("Color Tint", Color) = (1.0, 1.0, 1.0, 1.0)
_MainText("Diffuse Texture", 2D) = "white" {}
}

Subshader
{
Pass
{
CGPROGRAM

// Pragmas
#pragma vertex vertexFunction
#pragma fragment fragmentFunction

// User defined var
uniform float4 _Color;
uniform sampler2D _MainText;
uniform float4 _MainText_ST;

// Structs for passing data
struct vertexInput
{
float4 vertexPosition : POSITION; // Get the vertex position
float4 textureCoord : TEXCOORD0;

};

struct vertexOutput
{
float4 position : SV_POSITION; // Output the vertex position
float4 tex : TEXCOORD0;
};


// Vertex function
vertexOutput vertexFunction(vertexInput input)
{
vertexOutput returnVertex;

returnVertex.position = mul(UNITY_MATRIX_MVP, input.vertexPosition);

returnVertex.tex = input.textureCoord;

return returnVertex;
}

// Fragment function aka pixel shader
float4 fragmentFunction(vertexOutput output) : COLOR
{
float4 tex = tex2D(_MainText, _MainText_ST.xy * output.tex.xy + _MainText_ST.zw);

return float4(tex.rgb,1.0);
}

ENDCG
}
}

// Fallback
//Fallback "Diffuse"
}
9 changes: 9 additions & 0 deletions SimpleShader/Assets/Shaders/TextureShader.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions SimpleShader/Assets/UnityVS.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading