diff options
Diffstat (limited to 'tools/ArtistTools/source/Shaders')
| -rw-r--r-- | tools/ArtistTools/source/Shaders/BodyShader.hlsl | 370 | ||||
| -rw-r--r-- | tools/ArtistTools/source/Shaders/BodyShaderCommon.hlsl | 204 | ||||
| -rw-r--r-- | tools/ArtistTools/source/Shaders/BodyShadow.hlsl | 109 | ||||
| -rw-r--r-- | tools/ArtistTools/source/Shaders/Light.hlsl | 69 | ||||
| -rw-r--r-- | tools/ArtistTools/source/Shaders/ScreenQuad.hlsl | 66 | ||||
| -rw-r--r-- | tools/ArtistTools/source/Shaders/ScreenQuadColor.hlsl | 71 | ||||
| -rw-r--r-- | tools/ArtistTools/source/Shaders/VisualizeShadow.hlsl | 81 | ||||
| -rw-r--r-- | tools/ArtistTools/source/Shaders/color.hlsl | 67 |
8 files changed, 0 insertions, 1037 deletions
diff --git a/tools/ArtistTools/source/Shaders/BodyShader.hlsl b/tools/ArtistTools/source/Shaders/BodyShader.hlsl deleted file mode 100644 index 3f9b60f..0000000 --- a/tools/ArtistTools/source/Shaders/BodyShader.hlsl +++ /dev/null @@ -1,370 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed -// under the Mutual Non-Disclosure Agreement. -// -// Notice -// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES -// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. -// -// NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless -// expressly authorized by NVIDIA. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -// -// NVIDIA Corporation and its licensors retain all intellectual property and proprietary -// rights in and to this software and related documentation and any modifications thereto. -// Any use, reproduction, disclosure or distribution of this software and related -// documentation without an express license agreement from NVIDIA Corporation is -// strictly prohibited. -// - -//#define USE_GFSDK_SHADOWLIB - -/////////////////////////////////////////////////////////////////////////////////// -// Textures -/////////////////////////////////////////////////////////////////////////////////// -Buffer<float4> g_BoneIndices : register(t0); -Buffer<float4> g_BoneWeights : register(t1); - -Texture2D g_DiffuseTexture : register(t2); -Texture2D g_SpecularTexture : register(t3); -Texture2D g_NormalTexture : register(t4); -Texture2D g_EnvTexture : register(t5); - -Texture2D g_ShadowTexture0 : register(t6); -Texture2D g_ShadowTexture1 : register(t7); -Texture2D g_ShadowTexture2 : register(t8); -Texture2D g_ShadowTexture3 : register(t9); - -#include "Light.hlsl" -#include "BodyShaderCommon.hlsl" - -/////////////////////////////////////////////////////////////////////////////////// -// constant buffer -/////////////////////////////////////////////////////////////////////////////////// -cbuffer cbPerFrame : register(b0) -{ - row_major float4x4 g_ViewProjection; - row_major float4x4 g_BodyTransformation; - -////////////////////////////////////////////////// - Light g_Light[4]; - -////////////////////////////////////////////////// - float3 g_eyePosition; - float g_specularShininess; - - int g_useDiffuseTextures; - int g_useSpecularTextures; - int g_useNormalTextures; - int g_useTextures; - - - float4 g_ambientColor; - float4 g_diffuseColor; - float4 g_specularColor; - - int g_wireFrame; - int g_useLighting; - int g_wireFrameOver; - float g_unitScale; - - int g_useDQs; - int g_diffuseChannel; - int g_flatNormal; - int g_usePinPos; - - row_major float4x4 g_boneMatrices[MAX_BONE_MATRICES]; - DQ g_boneDQs[MAX_BONE_MATRICES]; -} - -#define FLT_EPSILON 1e-7 - -SamplerState samLinear : register(s0); -SamplerState samPointClamp : register(s1); - -////////////////////////////////////////////////////////////////////////////// -// shadow sampling functions -////////////////////////////////////////////////////////////////////////////// -float softDepthCmp(float sampledDepth, float calcDepth, float bias, float gain) -{ - float delta = gain * (sampledDepth - (calcDepth + bias)); - - float s = clamp(1.0 - delta / abs(bias), 0.0f, 1.0f); - return s; -} - -float softDepthCmpRHS(float sampledDepth, float calcDepth) -{ - float bias = g_unitScale; - - float delta = sampledDepth - (calcDepth + bias); - - float s = clamp(1.0 - delta / bias, 0.0f, 1.0f); - return s; -} - -float softDepthCmpLHS(float sampledDepth, float calcDepth) -{ - float bias = g_unitScale; - - float delta = (calcDepth - bias) - sampledDepth; - - float s = clamp(1.0 - delta / bias, 0.0f, 1.0f); - return s; -} - -float ShadowPCF(float2 texcoord, float calcDepth, float bias, float gain, Texture2D shadowTexture) -{ - float shadow = 0; - float n = 0; - - [unroll] - for (int dx = - 3; dx <= 3; dx += 2) { - for (int dy = -3; dy <= 3; dy += 2) { - float4 S = shadowTexture.Gather(samPointClamp, texcoord, int2(dx, dy)); - shadow += softDepthCmp(S.x, calcDepth, bias, gain); - shadow += softDepthCmp(S.y, calcDepth, bias, gain); - shadow += softDepthCmp(S.z, calcDepth, bias, gain); - shadow += softDepthCmp(S.w, calcDepth, bias, gain); - n += 4; - } - } - - return shadow / n; -} - -float getShadow(float3 wPos, Light L, Texture2D stex) -{ - float2 texcoords = mul(float4(wPos, 1), L.m_lightMatrix).xy; - float z = mul(float4(wPos, 1), L.m_viewMatrix).z; - - float bias = L.m_depthBias; - float gain = L.m_depthGain; - float shadow = ShadowPCF(texcoords, z, bias, gain, stex); - - return shadow; -} - -////////////////////////////////////////////////////////////////////////////// -inline float getIllumination(Light L, float3 wPos, Texture2D stex) -{ - float lit = 1.0f; - - if (L.m_useShadows) - { - float2 texcoords = mul(float4(wPos, 1), L.m_lightMatrix).xy; - float z = mul(float4(wPos, 1), L.m_viewMatrix).z; - lit = getShadow(wPos, L, stex); - } - - return lit; -} - - -///////////////////////////////////////////////////////////////////////////////////// -inline float3 computeDiffuseLighting( - float3 I, - float3 L, // light direction - float3 N // surface normal - ) -{ - float diffuse = max(0, dot(N, L)); - - return diffuse * I; -} - -///////////////////////////////////////////////////////////////////////////////////// -inline float3 computeSpecularLighting( - float3 I, // light color - float3 L, // light direction - float3 N, // surface normal - float3 E, // view vector - float3 Ms, // specularity - - float shininess) -{ - float3 H = normalize(E+N); - float NdotH = max(0, dot(H, N)); - float specular = pow(NdotH, shininess); - - float3 output = specular * I * Ms; - - return output; -} - -///////////////////////////////////////////////////////////////////////////////////// -struct BodyRenderVSIn -{ - float3 Position : POSITION; - float3 vertexNormal : VERTEX_NORMAL; - float3 faceNormal : FACE_NORMAL; - float3 Tangent : TANGENT; - float2 texCoord : TEXCOORD; - float vid : VERTEX_ID; -}; - -struct BodyRenderVSOut -{ - float4 Position : SV_Position; - float3 Normal : Normal; - float3 Tangent : TANGENT; - float3 wpos : WPOS; - float2 texCoord : TEXCOORD; -}; - -///////////////////////////////////////////////////////////////////////////////////// -// vertex shader -///////////////////////////////////////////////////////////////////////////////////// -BodyRenderVSOut vs_main(BodyRenderVSIn vertexIn) -{ - BodyRenderVSOut vertex; - - float3 pos = vertexIn.Position.xyz; - - float3 normal = g_flatNormal ? normalize(vertexIn.faceNormal) : normalize(vertexIn.vertexNormal); - float3 tangent = normalize(vertexIn.Tangent); - - float3 skinnedPos, skinnedNormal, skinnedTangent; - - float4 boneIndex = g_BoneIndices.Load(vertexIn.vid); - float4 boneWeight = g_BoneWeights.Load(vertexIn.vid); - - if (g_useDQs) - computeSkinningDQ(boneIndex, boneWeight, g_boneDQs, skinnedPos, skinnedNormal, skinnedTangent, pos, normal, tangent); - else - computeSkinningLinear(boneIndex, boneWeight, g_boneMatrices, skinnedPos, skinnedNormal, skinnedTangent, pos, normal, tangent); - - if (!g_usePinPos) - pos = skinnedPos; - pos = mul(float4(pos, 1), g_BodyTransformation); - vertex.wpos = pos; - - vertex.Position = mul(float4(pos, 1), g_ViewProjection); - - vertex.Normal = normalize(skinnedNormal); - vertex.Tangent = normalize(skinnedTangent); - vertex.texCoord = vertexIn.texCoord; - - return vertex; -} - -///////////////////////////////////////////////////////////////////////////////////// -// pixel shader -///////////////////////////////////////////////////////////////////////////////////// - -float4 ps_main(BodyRenderVSOut vertex) : SV_Target -{ - float4 output = float4(0,0,0,1); - - if (g_wireFrameOver) - return output; - - float3 diffuseColor = g_diffuseColor.xyz; - if (g_useDiffuseTextures) - { - if (g_diffuseChannel == 0) - diffuseColor.xyz = g_DiffuseTexture.SampleLevel(samLinear,vertex.texCoord, 0).xyz; - else if (g_diffuseChannel == 1) - diffuseColor.xyz = g_DiffuseTexture.SampleLevel(samLinear,vertex.texCoord, 0).rrr; - else if (g_diffuseChannel == 2) - diffuseColor.xyz = g_DiffuseTexture.SampleLevel(samLinear,vertex.texCoord, 0).ggg; - else if (g_diffuseChannel == 3) - diffuseColor.xyz = g_DiffuseTexture.SampleLevel(samLinear,vertex.texCoord, 0).bbb; - else if (g_diffuseChannel == 4) - diffuseColor.xyz = g_DiffuseTexture.SampleLevel(samLinear,vertex.texCoord, 0).aaa; - } - - float3 specularColor = g_specularColor.xyz; - if (g_useSpecularTextures) - specularColor.xyz = g_SpecularTexture.SampleLevel(samLinear,vertex.texCoord, 0).xyz; - - if (!g_useLighting) - return float4(diffuseColor, 1.0f); - - float3 N = normalize(vertex.Normal.xyz); - - if (g_useNormalTextures) - { - float3 normalColor = g_NormalTexture.SampleLevel(samLinear,vertex.texCoord, 0).xyz; - normalColor = (normalColor - 0.5) * 2.0f; - - float3 T = normalize(vertex.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); - } - - float3 P = vertex.wpos.xyz; - float3 E = normalize(g_eyePosition.xyz - P); - float shininess = g_specularShininess; - - // sum all lights - Texture2D stex[4] = - { - g_ShadowTexture0, - g_ShadowTexture1, - g_ShadowTexture2, - g_ShadowTexture3 - }; - - 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; - - bool zup = true; - float2 texcoords = GetLightTexCoord(Ldir, zup); - float3 Lcolor = (L.m_useEnvMap) ? g_EnvTexture.SampleLevel(samLinear,texcoords.xy,0).rgb : L.m_color; - Lcolor *= L.m_intensity; - Ldiffuse = Lspecular = Lcolor; - } - else - { - float I = getIllumination(L, P, stex[i]); - Ldiffuse = Lspecular = I * L.m_intensity * L.m_color; - Ldir = 1.0f * L.m_dir; - } - - diffuse += computeDiffuseLighting( Ldiffuse, Ldir, N); - specular += computeSpecularLighting( Lspecular, Ldir, N, E, specularity, shininess); - - ambient += L.m_ambientColor; - } - } - - output.rgb = (ambient + diffuse) * albedo + specular; - - return output; -} diff --git a/tools/ArtistTools/source/Shaders/BodyShaderCommon.hlsl b/tools/ArtistTools/source/Shaders/BodyShaderCommon.hlsl deleted file mode 100644 index e113881..0000000 --- a/tools/ArtistTools/source/Shaders/BodyShaderCommon.hlsl +++ /dev/null @@ -1,204 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed -// under the Mutual Non-Disclosure Agreement. -// -// Notice -// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES -// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. -// -// NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless -// expressly authorized by NVIDIA. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -// -// NVIDIA Corporation and its licensors retain all intellectual property and proprietary -// rights in and to this software and related documentation and any modifications thereto. -// Any use, reproduction, disclosure or distribution of this software and related -// documentation without an express license agreement from NVIDIA Corporation is -// strictly prohibited. -// - -struct DQ -{ - float4 q0; - float4 q1; -}; - -#define MAX_BONE_MATRICES 512 -#define FLT_EPSILON 1e-7 - -/////////////////////////////////////////////////////////////////////////////////////////////////////////// -// apply linear blending based skinning -void computeSkinningLinear( - float4 boneIndex, - float4 boneWeight, - row_major float4x4 boneMatrices[MAX_BONE_MATRICES], - out float3 skinnedPosition, - out float3 skinnedNormal, - out float3 skinnedTangent, - float3 restPosition, float3 restNormal, float3 restTangent) -{ - - float weightSum = boneWeight.x + boneWeight.y + boneWeight.z + boneWeight.w ; - float invWeightSum = 1.0f / (weightSum + FLT_EPSILON); - - skinnedPosition = float3(0, 0, 0); - skinnedNormal = float3(0, 0, 0); - skinnedTangent = float3(0, 0, 0); - - [unroll(4)] - for (int b = 0; b < 4; b++) - { - row_major float4x4 bone = boneMatrices[boneIndex[b]]; - float w = boneWeight[b]; - - float3 p = (mul(float4(restPosition.xyz,1), bone)).xyz; - skinnedPosition.xyz += w * p; - float3 n = (mul(float4(restNormal.xyz,0), bone)).xyz; - skinnedNormal.xyz += w * n; - float3 t = (mul(float4(restTangent.xyz,0), bone)).xyz; - skinnedTangent.xyz += w * t; - } - - skinnedPosition.xyz *= invWeightSum; - skinnedNormal.xyz *= invWeightSum; - skinnedTangent.xyz *= invWeightSum; - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////// -// apply linear blending based skinning -void computeSkinningLinear( - float4 boneIndex, - float4 boneWeight, - row_major float4x4 boneMatrices[MAX_BONE_MATRICES], - out float3 skinnedPosition, - float3 restPosition) -{ - - float weightSum = boneWeight.x + boneWeight.y + boneWeight.z + boneWeight.w ; - float invWeightSum = 1.0f / (weightSum + FLT_EPSILON); - - skinnedPosition = float3(0, 0, 0); - - [unroll(4)] - for (int b = 0; b < 4; b++) - { - row_major float4x4 bone = boneMatrices[boneIndex[b]]; - - float3 p = boneWeight[b] * invWeightSum * (mul(float4(restPosition.xyz,1), bone)).xyz; - skinnedPosition.xyz += p; - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////// -// apply dual quaternion skinning -void computeSkinningDQ( - float4 boneIndex, - float4 boneWeight, - DQ boneDQs[MAX_BONE_MATRICES], - inout float3 skinnedPosition, - inout float3 skinnedNormal, - inout float3 skinnedTangent, - float3 restPosition, - float3 restNormal, - float3 restTangent) -{ - DQ dq; - dq.q0 = float4(0,0,0,0); - dq.q1 = float4(0,0,0,0); - - [unroll(4)] - for (int b = 0; b < 4; b++) - { - float w = boneWeight[b]; - DQ boneDQ = boneDQs[boneIndex[b]]; - - boneDQ.q0 *= w; - boneDQ.q1 *= w; - - // hemispherization - float sign = (dot(dq.q0, boneDQ.q0) < -FLT_EPSILON) ? -1.0f: 1.0f; - - dq.q0 += sign * boneDQ.q0; - dq.q1 += sign * boneDQ.q1; - } - - // normalize - float mag = dot(dq.q0, dq.q0); - float deLen = 1.0f / sqrt(mag+FLT_EPSILON); - dq.q0 *= deLen; - dq.q1 *= deLen; - - // transform - float3 d0 = dq.q0.xyz; - float3 de = dq.q1.xyz; - float a0 = dq.q0.w; - float ae = dq.q1.w; - - float3 tempPos = cross(d0, restPosition.xyz) + a0 * restPosition.xyz; - float3 tempPos2 = 2.0f * (de * a0 - d0 * ae + cross(d0, de)); - float3 tempNormal = cross(d0, restNormal.xyz) + a0 * restNormal.xyz; - float3 tempTangent = cross(d0, restTangent.xyz) + a0 * restTangent.xyz; - - skinnedPosition.xyz = restPosition.xyz + tempPos2 + cross(2.0f * d0, tempPos); - skinnedNormal.xyz = restNormal.xyz + 2.0 * cross( d0, tempNormal); - skinnedTangent.xyz = restTangent.xyz + 2.0 * cross( d0, tempTangent); -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////// -// apply dual quaternion skinning -void computeSkinningDQ( - float4 boneIndex, - float4 boneWeight, - DQ boneDQs[MAX_BONE_MATRICES], - inout float3 skinnedPosition, - float3 restPosition) -{ - DQ dq; - dq.q0 = float4(0,0,0,0); - dq.q1 = float4(0,0,0,0); - - [unroll(4)] - for (int b = 0; b < 4; b++) - { - float w = boneWeight[b]; - DQ boneDQ = boneDQs[boneIndex[b]]; - - boneDQ.q0 *= w; - boneDQ.q1 *= w; - - // hemispherization - float sign = (dot(dq.q0, boneDQ.q0) < -FLT_EPSILON) ? -1.0f: 1.0f; - - dq.q0 += sign * boneDQ.q0; - dq.q1 += sign * boneDQ.q1; - } - - // normalize - float mag = dot(dq.q0, dq.q0); - float deLen = 1.0f / sqrt(mag+FLT_EPSILON); - dq.q0 *= deLen; - dq.q1 *= deLen; - - // transform - float3 d0 = dq.q0.xyz; - float3 de = dq.q1.xyz; - float a0 = dq.q0.w; - float ae = dq.q1.w; - - float3 tempPos = cross(d0, restPosition.xyz) + a0 * restPosition.xyz; - float3 tempPos2 = 2.0f * (de * a0 - d0 * ae + cross(d0, de)); - skinnedPosition.xyz = restPosition.xyz + tempPos2 + cross(2.0f * d0, tempPos); -} - - - diff --git a/tools/ArtistTools/source/Shaders/BodyShadow.hlsl b/tools/ArtistTools/source/Shaders/BodyShadow.hlsl deleted file mode 100644 index 4d7629e..0000000 --- a/tools/ArtistTools/source/Shaders/BodyShadow.hlsl +++ /dev/null @@ -1,109 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed -// under the Mutual Non-Disclosure Agreement. -// -// Notice -// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES -// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. -// -// NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless -// expressly authorized by NVIDIA. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -// -// NVIDIA Corporation and its licensors retain all intellectual property and proprietary -// rights in and to this software and related documentation and any modifications thereto. -// Any use, reproduction, disclosure or distribution of this software and related -// documentation without an express license agreement from NVIDIA Corporation is -// strictly prohibited. -// - -Buffer<float4> g_BoneIndices : register(t0); -Buffer<float4> g_BoneWeights : register(t1); - -#include "BodyShaderCommon.hlsl" - -/////////////////////////////////////////////////////////////////////////////////// -// constant buffer -/////////////////////////////////////////////////////////////////////////////////// -cbuffer cbPerFrame : register(b0) -{ - row_major float4x4 g_ViewProjection; - row_major float4x4 g_ViewMatrix; - row_major float4x4 g_BodyTransformation; - - int g_useDQs; - int g_usePinPos; - float _reserved2; - float _reserved3; - - row_major float4x4 g_boneMatrices[MAX_BONE_MATRICES]; - DQ g_boneDQs[MAX_BONE_MATRICES]; -} - -struct VSIn -{ - float3 Position : POSITION; - float3 vertexNormal : VERTEX_NORMAL; - float3 faceNormal : FACE_NORMAL; - float3 Tangent : TANGENT; - float2 texCoord : TEXCOORD; - float vid : VERTEX_ID; -}; - -struct VSOut -{ - float4 Position : SV_Position; - float Depth : texcoord; -}; - -struct PSOut -{ - float Z: SV_Target0; -}; - -float WorldToDepth(float3 wPos) -{ - float z = mul(float4(wPos, 1), g_ViewMatrix).z; - return z; - -} - -VSOut vs_main(VSIn vertexIn) -{ - VSOut vertex; - - float4 boneIndex = g_BoneIndices.Load(vertexIn.vid); - float4 boneWeight = g_BoneWeights.Load(vertexIn.vid); - - float3 pos = vertexIn.Position.xyz; - float3 skinnedPos; - - if (g_useDQs) - computeSkinningDQ(boneIndex, boneWeight, g_boneDQs, skinnedPos, pos); - else - computeSkinningLinear(boneIndex, boneWeight, g_boneMatrices, skinnedPos, pos); - - if (g_usePinPos) - skinnedPos = pos; - - float3 wPos = mul(float4(skinnedPos, 1), g_BodyTransformation).xyz; - vertex.Position = mul(float4(wPos, 1), g_ViewProjection); - vertex.Depth = WorldToDepth(wPos); - return vertex; -} - -PSOut ps_main(VSOut vertex) -{ - PSOut output; - output.Z = vertex.Depth; - return output; -} diff --git a/tools/ArtistTools/source/Shaders/Light.hlsl b/tools/ArtistTools/source/Shaders/Light.hlsl deleted file mode 100644 index 85c71f0..0000000 --- a/tools/ArtistTools/source/Shaders/Light.hlsl +++ /dev/null @@ -1,69 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed -// under the Mutual Non-Disclosure Agreement. -// -// Notice -// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES -// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. -// -// NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless -// expressly authorized by NVIDIA. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -// -// NVIDIA Corporation and its licensors retain all intellectual property and proprietary -// rights in and to this software and related documentation and any modifications thereto. -// Any use, reproduction, disclosure or distribution of this software and related -// documentation without an express license agreement from NVIDIA Corporation is -// strictly prohibited. -// - -/////////////////////////////////////////////////////////////////////////////////// -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; -}; - -float2 GetLightTexCoord(float3 Ldir, bool zup = true) -{ - const float M_PI = 3.1415923; - - float coord0 = zup ? Ldir.x : Ldir.x; - float coord1 = zup ? Ldir.y : Ldir.z; - float coord2 = zup ? Ldir.z : Ldir.y; - - float u = 0.5f + 0.5f * atan2(coord1, coord0) / M_PI; - float v = 0.5f - 0.5f * coord2; - - return float2(u,v); -} - - diff --git a/tools/ArtistTools/source/Shaders/ScreenQuad.hlsl b/tools/ArtistTools/source/Shaders/ScreenQuad.hlsl deleted file mode 100644 index e1ab62f..0000000 --- a/tools/ArtistTools/source/Shaders/ScreenQuad.hlsl +++ /dev/null @@ -1,66 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed -// under the Mutual Non-Disclosure Agreement. -// -// Notice -// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES -// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. -// -// NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless -// expressly authorized by NVIDIA. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -// -// NVIDIA Corporation and its licensors retain all intellectual property and proprietary -// rights in and to this software and related documentation and any modifications thereto. -// Any use, reproduction, disclosure or distribution of this software and related -// documentation without an express license agreement from NVIDIA Corporation is -// strictly prohibited. -// - -/////////////////////////////////////////////////////////////////////////////////// -// Textures -/////////////////////////////////////////////////////////////////////////////////// -Texture2D g_ColorTexture : register(t0); - -struct VSOut -{ - float4 pos : SV_Position; - float2 tex : TEXCOORD; -}; - -///////////////////////////////////////////////////////////////////////////////////// -// vertex shader -///////////////////////////////////////////////////////////////////////////////////// -VSOut vs_main( uint id : SV_VertexID ) -{ - VSOut output; - output.tex = float2( (id << 1) & 2, id & 2 ); - output.pos = float4( output.tex * float2( 2.0f, -2.0f ) + float2( -1.0f, 1.0f), 0.0f, 1.0f ); - - return output; -} - -///////////////////////////////////////////////////////////////////////////////////// -// pixel shader -///////////////////////////////////////////////////////////////////////////////////// -//SamplerState samLinear; -SamplerState samPointClamp; - -float4 ps_main(VSOut input) : SV_Target -{ - float4 color; - - color.rgb = g_ColorTexture.Sample(samPointClamp,input.tex).rgb; - color.a = 1.0f; - - return color; -} diff --git a/tools/ArtistTools/source/Shaders/ScreenQuadColor.hlsl b/tools/ArtistTools/source/Shaders/ScreenQuadColor.hlsl deleted file mode 100644 index e019b65..0000000 --- a/tools/ArtistTools/source/Shaders/ScreenQuadColor.hlsl +++ /dev/null @@ -1,71 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed -// under the Mutual Non-Disclosure Agreement. -// -// Notice -// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES -// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. -// -// NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless -// expressly authorized by NVIDIA. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -// -// NVIDIA Corporation and its licensors retain all intellectual property and proprietary -// rights in and to this software and related documentation and any modifications thereto. -// Any use, reproduction, disclosure or distribution of this software and related -// documentation without an express license agreement from NVIDIA Corporation is -// strictly prohibited. -// - -/////////////////////////////////////////////////////////////////////////////////// -// Textures -/////////////////////////////////////////////////////////////////////////////////// -Texture2D g_ColorTexture : register(t0); - -struct VSOut -{ - float4 pos : SV_Position; - float2 tex : TEXCOORD; -}; - -///////////////////////////////////////////////////////////////////////////////////// -// vertex shader -///////////////////////////////////////////////////////////////////////////////////// -VSOut vs_main( uint id : SV_VertexID ) -{ - VSOut output; - output.tex = float2( (id << 1) & 2, id & 2 ); - output.pos = float4( output.tex * float2( 2.0f, -2.0f ) + float2( -1.0f, 1.0f), 0.0f, 1.0f ); - - return output; -} - -///////////////////////////////////////////////////////////////////////////////////// -// pixel shader -///////////////////////////////////////////////////////////////////////////////////// -//SamplerState samLinear; -SamplerState samPointClamp; - -float4 ps_main(VSOut input) : SV_Target -{ - float4 color; - - float3 top = float3(0.49f, 0.569f, 0.700f); - float3 btm = float3(0.098f, 0.098f, 0.098f); - - float height = input.tex.y; - color.rgb = lerp(top, btm, height); - - color.a = 1.0f; - - return color; -}
\ No newline at end of file diff --git a/tools/ArtistTools/source/Shaders/VisualizeShadow.hlsl b/tools/ArtistTools/source/Shaders/VisualizeShadow.hlsl deleted file mode 100644 index 04bf9f9..0000000 --- a/tools/ArtistTools/source/Shaders/VisualizeShadow.hlsl +++ /dev/null @@ -1,81 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed -// under the Mutual Non-Disclosure Agreement. -// -// Notice -// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES -// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. -// -// NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless -// expressly authorized by NVIDIA. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -// -// NVIDIA Corporation and its licensors retain all intellectual property and proprietary -// rights in and to this software and related documentation and any modifications thereto. -// Any use, reproduction, disclosure or distribution of this software and related -// documentation without an express license agreement from NVIDIA Corporation is -// strictly prohibited. -// -/////////////////////////////////////////////////////////////////////////////////// -// constant buffer -/////////////////////////////////////////////////////////////////////////////////// -cbuffer cbPerFrame : register(b0) -{ - float g_zNear; - float g_zFar; - float g_unitScale; - float g_dummy; -} - -/////////////////////////////////////////////////////////////////////////////////// -// Textures -/////////////////////////////////////////////////////////////////////////////////// -Texture2D g_ColorTexture : register(t0); - -struct VSOut -{ - float4 pos : SV_Position; - float2 tex : TEXCOORD; -}; - -///////////////////////////////////////////////////////////////////////////////////// -// vertex shader -///////////////////////////////////////////////////////////////////////////////////// -VSOut vs_main( uint id : SV_VertexID ) -{ - VSOut output; - output.tex = float2( (id << 1) & 2, id & 2 ); - output.pos = float4( output.tex * float2( 2.0f, -2.0f ) + float2( -1.0f, 1.0f), 0.0f, 1.0f ); - - return output; -} - -///////////////////////////////////////////////////////////////////////////////////// -// pixel shader -///////////////////////////////////////////////////////////////////////////////////// -//SamplerState samLinear; -SamplerState samPointClamp; - -float4 ps_main(VSOut input) : SV_Target -{ - float4 color; - - color.rgb = g_ColorTexture.Sample(samPointClamp,input.tex).rgb; - - float depth = color.r; - float near = g_zNear; - float far = g_zFar; - - color.rgb = (depth - near) / (far - near); - color.a = 1.0f; - return color; -} diff --git a/tools/ArtistTools/source/Shaders/color.hlsl b/tools/ArtistTools/source/Shaders/color.hlsl deleted file mode 100644 index b1fa057..0000000 --- a/tools/ArtistTools/source/Shaders/color.hlsl +++ /dev/null @@ -1,67 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Filename: color.vs -//////////////////////////////////////////////////////////////////////////////// - - -///////////// -// GLOBALS // -///////////// -cbuffer MatrixBuffer -{ - row_major matrix worldMatrix; - row_major matrix viewMatrix; - row_major matrix projectionMatrix; - float4 g_color; - - int g_useVertexColor; - int g_dummy2; - int g_dummy3; - int g_dummy4; -}; - - -////////////// -// TYPEDEFS // -////////////// -struct VertexInputType -{ - float3 position : POSITION; - float4 color : COLOR; -}; - -struct PixelInputType -{ - float4 position : SV_POSITION; - float4 color : COLOR; -}; - - -//////////////////////////////////////////////////////////////////////////////// -// Vertex Shader -//////////////////////////////////////////////////////////////////////////////// -PixelInputType vs_main(VertexInputType input) -{ - PixelInputType output; - - // Calculate the position of the vertex against the world, view, and projection matrices. - output.position = mul(float4(input.position,1.0), worldMatrix); - output.position = mul(float4(output.position.xyz,1.0f), viewMatrix); - output.position = mul(float4(output.position.xyz,1.0f), projectionMatrix); - - // Store the input color for the pixel shader to use. - output.color = input.color; - - if (!g_useVertexColor) - output.color = g_color; - - return output; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Pixel Shader -//////////////////////////////////////////////////////////////////////////////// -float4 ps_main(PixelInputType input) : SV_TARGET -{ - return input.color; -} |