aboutsummaryrefslogtreecommitdiff
path: root/tools/ArtistTools/source/BlastPlugin/Shaders
diff options
context:
space:
mode:
authorBryan Galdrikian <[email protected]>2017-08-23 11:24:32 -0700
committerBryan Galdrikian <[email protected]>2017-08-23 11:24:32 -0700
commitf1e539cadfb085cedc32f9773cfb9d14bfcdf138 (patch)
tree7ca74e06a4386dd22fd850a8417a31a85d282a30 /tools/ArtistTools/source/BlastPlugin/Shaders
parentUpdated to CL 22661993: (diff)
downloadblast-f1e539cadfb085cedc32f9773cfb9d14bfcdf138.tar.xz
blast-f1e539cadfb085cedc32f9773cfb9d14bfcdf138.zip
Removing ArtistTools and CurveEditor projects
Diffstat (limited to 'tools/ArtistTools/source/BlastPlugin/Shaders')
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl63
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/lighting_ex.hlsl51
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_ex.hlsl56
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_id_ex.hlsl36
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl184
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/screen_primitive_ex.hlsl26
6 files changed, 0 insertions, 416 deletions
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl
deleted file mode 100644
index d6a37b0..0000000
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef COMMON_BUFFERS_HLSL
-#define COMMON_BUFFERS_HLSL
-
-cbuffer Camera : register(b0)
-{
- row_major matrix viewProjection;
- row_major matrix projectionInv;
- float3 viewPos;
-};
-
-struct Light
-{
- int m_enable;
- float3 m_dir;
-
- int m_useShadows;
- float3 m_color;
-
- float3 m_ambientColor;
- int m_isEnvLight;
-
- int m_lhs;
- int _reserved1;
- int _reserved2;
- int _reserved3;
-
- float m_depthBias;
- float m_depthGain;
- int m_useEnvMap;
- float m_intensity;
-
- row_major float4x4 m_viewMatrix;
- row_major float4x4 m_lightMatrix;
-};
-
-cbuffer World : register(b1)
-{
- float3 ambientColor;
- float3 pointLightPos;
- float3 pointLightColor;
- float3 dirLightDir;
- float specularPower;
- float3 dirLightColor;
- float specularIntensity;
- float g_flatNormal;
- float g_wireFrameOver;
- float g_useLighting;
- Light g_Light[4];
-};
-
-cbuffer Object : register(b2)
-{
- row_major matrix worldMatrix;
- float4 m_diffuseColor;
- float4 m_specularColor;
- float m_useDiffuseTexture;
- float m_useSpecularTexture;
- float m_useNormalTexture;
- float m_specularShininess;
- float selected;
-};
-
-#endif \ No newline at end of file
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/lighting_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/lighting_ex.hlsl
deleted file mode 100644
index 6878e23..0000000
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/lighting_ex.hlsl
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "common_buffers_ex.hlsl"
-
-static const float att_c = 1.0f;
-static const float att_l = 0.014f;
-static const float att_q = 0.0007f;
-
-
-float CalcAttenuation(float distance)
-{
- return 1 / (att_c + att_l * distance + att_q * distance * distance);
-};
-
-
-float3 CalcLight(float3 textureColor, float3 lightDir, float3 viewDir, float3 normal, float3 lightColor, float specPower, float specIntensity, float attenuation)
-{
- normal = normalize(normal);
-
- // diffuse
- float3 dirToLight = normalize(-lightDir);
- float diffuseFactor = max(dot(normal, dirToLight), 0.0);
- float3 diffuse = lightColor * textureColor * diffuseFactor * attenuation;
-
- // specular (Blinn-Phong)
- float3 halfwayDir = normalize(dirToLight + viewDir);
- float specFactor = pow(max(dot(viewDir, halfwayDir), 0.0), specPower);
- float3 spec = lightColor * specFactor * attenuation * specIntensity;
-
- return diffuse + spec;
-};
-
-float3 CalcPixelLight(float3 diffuseColor, float3 worldPos, float3 normal)
-{
- float3 viewDir = normalize(viewPos - worldPos);
-
- // ambient
- float3 ambient = ambientColor * diffuseColor;
-
- // dir light
- float3 dirLight = CalcLight(diffuseColor, dirLightDir, viewDir, normal, dirLightColor, specularPower, specularIntensity, 1);
-
- // point light
- float3 pointLightDir = worldPos - pointLightPos;
- float distance = length(pointLightDir);
- float attenuation = CalcAttenuation(distance);
- float3 pointLight = CalcLight(diffuseColor, pointLightDir, viewDir, normal, pointLightColor, specularPower, specularIntensity, attenuation);
-
- // hacky hack: ambient attenuates within point light distance
- ambient *= attenuation;
-
- return ambient + dirLight + pointLight;
-}; \ No newline at end of file
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_ex.hlsl
deleted file mode 100644
index 409054c..0000000
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_ex.hlsl
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "common_buffers_ex.hlsl"
-#include "lighting.hlsl"
-
-struct VS_INPUT
-{
- float3 position : POSITION0;
- float3 normal : NORMAL0;
- float health : TEXCOORD1;
-};
-
-struct VS_OUTPUT
-{
- float4 position : SV_POSITION;
- float4 worldPos : POSITION0;
- float3 normal : NORMAL0;
- float health : TEXCOORD1;
-};
-
-VS_OUTPUT VS(VS_INPUT iV)
-{
- VS_OUTPUT oV;
-
- float4 worldSpacePos = mul(float4(iV.position, 1.0f), model);
- oV.position = mul(worldSpacePos, viewProjection);
-
- oV.worldPos = worldSpacePos;
-
- // normals
- float3 worldNormal = mul(iV.normal, (float3x3)model);
- oV.normal = worldNormal;
-
- oV.health = iV.health;
-
- return oV;
-}
-
-float4 PS(VS_OUTPUT iV) : SV_Target0
-{
- float3 lightColor = CalcPixelLight(defaultColor.xyz, iV.worldPos.xyz, iV.normal);
- lightColor.r = 1.0f - iV.health; // hack for health
- float4 color = float4(lightColor, 1);
-
- if(selected > 0)
- {
- if(color.r > 0.5)
- {
- color.r = 0.5;
- }
- else
- {
- color.r += 0.5;
- }
- }
-
- return color;
-} \ No newline at end of file
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_id_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_id_ex.hlsl
deleted file mode 100644
index 2c5ec44..0000000
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_id_ex.hlsl
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "common_buffers_ex.hlsl"
-
-struct VS_INPUT
-{
- float3 position : POSITION0;
- float3 normal : VERTEX_NORMAL;
- float3 faceNormal : FACE_NORMAL;
- float3 tangent : TANGENT;
- float2 uv : TEXCOORD0;
- float health : TEXCOORD1;
-};
-
-struct VS_OUTPUT
-{
- float4 position : SV_POSITION;
-};
-
-struct PSOut
-{
- float vertexid: SV_Target0;
-};
-
-VS_OUTPUT VS(VS_INPUT iV)
-{
- VS_OUTPUT oV;
- float4 worldSpacePos = mul(float4(iV.position, 1.0f), worldMatrix);
- oV.position = mul(worldSpacePos, viewProjection);
- return oV;
-}
-
-PSOut PS(VS_OUTPUT oV) : SV_Target0
-{
- PSOut output;
- output.vertexid = selected;
- return output;
-} \ No newline at end of file
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl
deleted file mode 100644
index 6d8e819..0000000
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl
+++ /dev/null
@@ -1,184 +0,0 @@
-#include "common_buffers_ex.hlsl"
-#include "lighting_ex.hlsl"
-
-SamplerState defaultSampler : register(s0);
-Texture2D diffuseTexture : register(t0);
-Texture2D specularTexture : register(t1);
-Texture2D normalTexture : register(t2);
-Texture2D envTexture : register(t3);
-
-struct VS_INPUT
-{
- float3 position : POSITION0;
- float3 normal : VERTEX_NORMAL;
- float3 faceNormal : FACE_NORMAL;
- float3 tangent : TANGENT;
- float2 uv : TEXCOORD0;
- float health : TEXCOORD1;
-};
-
-struct VS_OUTPUT
-{
- float4 position : SV_POSITION;
- float4 worldPos : POSITION0;
- float3 normal : NORMAL0;
- float3 tangent : TANGENT0;
- float2 uv : TEXCOORD0;
- float health : TEXCOORD1;
-};
-
-VS_OUTPUT VS(VS_INPUT iV)
-{
- VS_OUTPUT oV;
-
- float4 worldSpacePos = mul(float4(iV.position, 1.0f), worldMatrix);
- oV.position = mul(worldSpacePos, viewProjection);
-
- oV.worldPos = worldSpacePos;
-
- // normals
- float3 normal = (g_flatNormal > 0) ? normalize(iV.faceNormal) : normalize(iV.normal);
- normal = mul(float4(normal, 0.0f), worldMatrix);
- oV.normal = normal;
-
- oV.tangent = normalize(iV.tangent);
-
- oV.uv = iV.uv;
- oV.health = iV.health;
-
- return oV;
-}
-
-inline float2 GetLightTexCoord(float3 lightdirection)
-{
- const float M_PI = 3.1415923;
- float u = 0.5f + 0.5f * atan2(lightdirection.y, lightdirection.x) / M_PI;
- float v = 0.5f - 0.5f * lightdirection.z;
- return float2(u,v);
-}
-
-inline float3 computeDiffuseLighting(
- float3 diffuse, float3 lightdirection, float3 surfacenormal )
-{
- float ratio = max(0, dot(surfacenormal, lightdirection));
- return diffuse * ratio;
-}
-
-inline float3 computeSpecularLighting(
- float3 lightcolor, float3 lightdirection, float3 surfacenormal,
- float3 viewvector, float3 specularity, float shininess)
-{
- float3 H = normalize(viewvector + surfacenormal);
- float NdotH = max(0, dot(H, surfacenormal));
- float specular = pow(NdotH, shininess);
- float3 output = specular * lightcolor * specularity;
- return output;
-}
-
-float4 PS(VS_OUTPUT iV) : SV_Target0
-{
- if(g_wireFrameOver > 0)
- return float4(0,0,0,1);
-
- float3 diffuseColor = m_diffuseColor.xyz;
- if(m_useDiffuseTexture > 0)
- {
- diffuseColor = diffuseTexture.Sample(defaultSampler, iV.uv).xyz;
- }
-
- if(selected > 0)
- {
- if(diffuseColor.r > 0.5)
- {
- diffuseColor.r = 0.5;
- }
- else
- {
- diffuseColor.r += 0.5;
- }
- return float4(diffuseColor, 1.0f);
- }
-
- if (g_useLighting < 0)
- {
- if(selected > 0)
- {
- if(diffuseColor.r > 0.5)
- {
- diffuseColor.r = 0.5;
- }
- else
- {
- diffuseColor.r += 0.5;
- }
- }
- return float4(diffuseColor, 1.0f);
- }
-
- float3 specularColor = m_specularColor.xyz;
- if(m_useSpecularTexture > 0)
- {
- specularColor = specularTexture.Sample(defaultSampler, iV.uv).xyz;
- }
- float3 N = normalize(iV.normal.xyz);
- if (m_useNormalTexture > 0)
- {
- float3 normalColor = normalTexture.Sample(defaultSampler, iV.uv).xyz;
- normalColor = (normalColor - 0.5) * 2.0f;
- float3 T = normalize(iV.tangent.xyz);
- float3 B = normalize(cross(T, N));
- float3 PN = N;
- PN += normalColor.x * T;
- PN += normalColor.y * B;
- PN += normalColor.z * N;
- N = normalize(PN);
- }
-
- float4 color = float4(0,0,0,1);
-
- float3 P = iV.worldPos.xyz;
- float3 E = normalize(viewPos.xyz - P);
- float shininess = m_specularShininess;
-
- float3 albedo = diffuseColor.rgb;
- float3 specularity = specularColor.rgb;
-
- float3 diffuse = 0;
- float3 specular = 0;
- float3 ambient = 0;
-
- [unroll]
- for (int i = 0; i < 4; i++)
- {
- Light L = g_Light[i];
-
- if (L.m_enable)
- {
- float3 Ldiffuse = 0;
- float3 Lspecular = 0;
- float3 Ldir = 0;
-
- if (L.m_isEnvLight)
- {
- Ldir = N;
- float2 texcoords = GetLightTexCoord(Ldir);
- float3 Lcolor = (L.m_useEnvMap) ? envTexture.Sample(defaultSampler,texcoords.xy).rgb : L.m_color;
- Lcolor *= L.m_intensity;
- Ldiffuse = Lspecular = Lcolor;
- }
- else
- {
- Ldir = L.m_dir;
- Ldiffuse = Lspecular = L.m_intensity * L.m_color;
- }
-
- diffuse += computeDiffuseLighting( Ldiffuse, Ldir, N);
- specular += computeSpecularLighting( Lspecular, Ldir, N, E, specularity, shininess);
- ambient += L.m_ambientColor;
- }
- }
-
- color.rgb = (ambient + diffuse) * albedo + specular;
-
- return color;
-} \ No newline at end of file
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/screen_primitive_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/screen_primitive_ex.hlsl
deleted file mode 100644
index 3da7007..0000000
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/screen_primitive_ex.hlsl
+++ /dev/null
@@ -1,26 +0,0 @@
-struct VS_INPUT
-{
- float3 position : POSITION0;
- float3 color : COLOR0;
-};
-
-struct VS_OUTPUT
-{
- float4 position : SV_POSITION;
- float3 color : COLOR0;
-};
-
-VS_OUTPUT VS(VS_INPUT iV)
-{
- VS_OUTPUT oV;
-
- oV.position = float4(iV.position.x * 2.0 - 1.0, 1.0 - iV.position.y * 2.0, 0.0, 1.0);
- oV.color = iV.color;
-
- return oV;
-}
-
-float4 PS(VS_OUTPUT iV) : SV_Target0
-{
- return float4(iV.color, 1.0);
-} \ No newline at end of file