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 Lab 09 Report.docx
Binary file not shown.
20 changes: 20 additions & 0 deletions New Unity Project/Assets/NewBehaviourScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using UnityEngine;
using System.Collections;

/// <summary>
/// Author: Matt Gipson
/// Contact: Deadwynn@gmail.com
/// Domain: www.livingvalkyrie.com
///
/// Description: NewBehaviourScript
/// </summary>
public class NewBehaviourScript : MonoBehaviour {
#region Fields

#endregion

void Start() { }

void Update() { }

}
12 changes: 12 additions & 0 deletions New Unity Project/Assets/NewBehaviourScript.cs.meta

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

Binary file added New Unity Project/Assets/Texture Material.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions New Unity Project/Assets/Texture Material.mat.meta

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

90 changes: 90 additions & 0 deletions New Unity Project/Assets/Texture.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Shader "Lab09/texture" {
Properties {
_Color("Color Tint", Color) = (1,1,1,1)
_MainTex("Diffuse texture", 2D) = "white"{}
_Attenuation("fall off", Range(0,5)) = 0
}
SubShader {
Tags{"LightMode" = "ForwardBase" }
Pass{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag

//user -color
uniform float4 _Color;

//user -texture
uniform sampler2D _MainTex;
uniform float4 _MainTex_ST;

//user -lambert
uniform float _Attenuation;

//unity variables
uniform float3 _LightColor0;

struct input{
float4 vertexPos : POSITION;
float4 textureCoord : TEXCOORD0;
float3 vertexNormal : NORMAL;
};

struct v2f{
float4 pixelPos : SV_POSITION;
float4 tex : TEXCOORD0;
float4 color : COLOR;
};

v2f vert(input i){
v2f toReturn;

//texture
//get pixel position
toReturn.pixelPos = mul(UNITY_MATRIX_MVP, i.vertexPos);
//get texture coords
toReturn.tex = i.textureCoord;

//lighting
float3 lightDirection;

//get ambient light color
float3 ambientLight = UNITY_LIGHTMODEL_AMBIENT.rgb;

//get ight direction
lightDirection = normalize(_WorldSpaceLightPos0.xyz);

//get normal
float3 tempNorm = i.vertexNormal;

//convert to objSpace
float4 objNorm = mul(float4(tempNorm, 1.0), _World2Object);

//normalize
float3 normalizedNormal = normalize(objNorm).xyz;

//dot product of light color normals and light direction aswell as falloff
float3 diffuseReflection = _Attenuation * _LightColor0.xyz * max(0.0, dot(normalizedNormal, lightDirection));

//ambient light added
float3 final = diffuseReflection + ambientLight;

//float4(xyz, w) float4(x,y,z,w)
toReturn.color = float4(final,1.0);
//toReturn.color = objNorm;

return toReturn;
}

float4 frag(v2f i) : COLOR {
float4 tex = tex2D(_MainTex, _MainTex_ST.xy * i.tex.xy + _MainTex_ST.zw);

return i.color * _Color * tex;

}

ENDCG
}
}
//FallBack "Diffuse"
}
9 changes: 9 additions & 0 deletions New Unity Project/Assets/Texture.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 New Unity Project/Assets/UnityVS.meta

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

9 changes: 9 additions & 0 deletions New Unity Project/Assets/UnityVS/Editor.meta

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

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
guid: 38d405c119fcc7c4e83d4a478a40ff2f
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
guid: 4ad02dc83da735c4e8d945332b9202f6
Binary file not shown.

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

Binary file added New Unity Project/Assets/lab-09 uv.iff
Binary file not shown.
55 changes: 55 additions & 0 deletions New Unity Project/Assets/lab-09 uv.iff.meta

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

Binary file added New Unity Project/Assets/lab-09 uv.psd
Binary file not shown.
55 changes: 55 additions & 0 deletions New Unity Project/Assets/lab-09 uv.psd.meta

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

Binary file added New Unity Project/Assets/marble.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 New Unity Project/Assets/marble.jpg.meta

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

Binary file added New Unity Project/Assets/scene0.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions New Unity Project/Assets/scene0.unity.meta

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

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions New Unity Project/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 not shown.
Binary file not shown.
Binary file not shown.
Binary file added lab-09-uv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.