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
Binary file added Lab10/Assets/Banner.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 Lab10/Assets/Banner.jpg.meta

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

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

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

89 changes: 89 additions & 0 deletions Lab10/Assets/CapsuleShader.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
shader "Custom/SpecShader"
{
Properties
{
_Color ("Color Tint", Color) = (1, 1, 1, 1)
_SpecColour("Specular Color", Color) = (1,1,1,1)
_Shininess("Specularity", float) = 10
}
SubShader
{
Pass
{
CGPROGRAM

//Pragmas
#pragma vertex vertexFunction
#pragma fragment fragmentFunction

//User-Defined Variables
uniform float4 _Color;
uniform float4 _SpecColour;
uniform float _Shininess;

//Unity-Defined Variables
uniform float4 _LightColor0;

struct inputStruct
{
//Vertex Setup
float4 vertexPos : POSITION;
float3 vertexNormal : NORMAL;
};

struct outputStruct
{
//Pixel Setup
float4 pixelPos: SV_POSITION;
float4 pixelCol : COLOR;

//Texture
float3 normalDirection : TEXCOORD0;
float4 pixelWorldPos : TEXCOORD1;
};

outputStruct vertexFunction(inputStruct input)
{
outputStruct toReturn;

//Sets up Light
float3 lightDir;
float attenuation = 1.0;
lightDir = normalize(_WorldSpaceLightPos0.xyz);

//Sets up the view
float3 normalDir = normalize(mul(float4(input.vertexNormal, 0.0), _World2Object).xyz);
float3 viewDir = normalize(float3(float4(_WorldSpaceCameraPos.xyz, 1.0) -
mul(_Object2World, input.vertexPos).xyz));

//Sets up Specularity
float3 diffReflect = attenuation * _LightColor0.xyz * max(0.0, dot(normalDir, lightDir));
float3 specReflect = reflect(-lightDir, normalDir);

//More Specularity Setup
specReflect = dot(specReflect, viewDir);
specReflect = max(0.0, specReflect);
specReflect = max(0.0, dot(normalDir, lightDir)) * specReflect;
specReflect = pow(max(0.0, specReflect), _Shininess);

//Final Light Setup
float3 finalLight = specReflect * diffReflect + UNITY_LIGHTMODEL_AMBIENT;

//Return Values
toReturn.pixelCol = float4(finalLight * _Color, 1.0);
toReturn.pixelPos = mul(UNITY_MATRIX_MVP, input.vertexPos);

return toReturn;
}

float4 fragmentFunction(outputStruct input) : COLOR
{
//Return Pixel Color
return input.pixelCol;
}

ENDCG
}
}
//FallBack "Diffuse"
}
9 changes: 9 additions & 0 deletions Lab10/Assets/CapsuleShader.shader.meta

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

Binary file added Lab10/Assets/Shadarz.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions Lab10/Assets/Shadarz.unity.meta

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

Binary file added Lab10/ProjectSettings/AudioManager.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/DynamicsManager.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/EditorSettings.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/InputManager.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/NavMeshAreas.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/NetworkManager.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/Physics2DSettings.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 2 additions & 0 deletions Lab10/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
m_EditorVersion: 5.1.2f1
m_StandardAssetsVersion: 0
Binary file added Lab10/ProjectSettings/QualitySettings.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/TagManager.asset
Binary file not shown.
Binary file added Lab10/ProjectSettings/TimeManager.asset
Binary file not shown.