From 84c0fe722200b2922c882f72e7913cb566b45807 Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 7 Nov 2023 09:49:05 -0800 Subject: [PATCH] Removed stale converted shader headers --- shaders_inc/GLTF_PBR_PrecomputeCommon.fxh.h | 40 --- shaders_inc/GLTF_PBR_Shading.fxh.h | 262 ------------------ shaders_inc/GLTF_PBR_Structures.fxh.h | 169 ------------ shaders_inc/GLTF_PBR_VertexProcessing.fxh.h | 43 --- shaders_inc/PrecomputeGLTF_BRDF.psh.h | 46 ---- shaders_inc/RenderGLTF_PBR.psh.h | 279 -------------------- shaders_inc/RenderGLTF_PBR.vsh.h | 63 ----- shaders_inc/RenderMeshId.psh.h | 20 -- 8 files changed, 922 deletions(-) delete mode 100644 shaders_inc/GLTF_PBR_PrecomputeCommon.fxh.h delete mode 100644 shaders_inc/GLTF_PBR_Shading.fxh.h delete mode 100644 shaders_inc/GLTF_PBR_Structures.fxh.h delete mode 100644 shaders_inc/GLTF_PBR_VertexProcessing.fxh.h delete mode 100644 shaders_inc/PrecomputeGLTF_BRDF.psh.h delete mode 100644 shaders_inc/RenderGLTF_PBR.psh.h delete mode 100644 shaders_inc/RenderGLTF_PBR.vsh.h delete mode 100644 shaders_inc/RenderMeshId.psh.h diff --git a/shaders_inc/GLTF_PBR_PrecomputeCommon.fxh.h b/shaders_inc/GLTF_PBR_PrecomputeCommon.fxh.h deleted file mode 100644 index e53d1a34..00000000 --- a/shaders_inc/GLTF_PBR_PrecomputeCommon.fxh.h +++ /dev/null @@ -1,40 +0,0 @@ -"#ifndef _GLTF_PBR_PRECOMPUTE_COMMON_FXH_\n" -"#define _GLTF_PBR_PRECOMPUTE_COMMON_FXH_\n" -"\n" -"#include \"PBR_Common.fxh\"\n" -"\n" -"#ifndef PI\n" -"# define PI 3.1415926536\n" -"#endif\n" -"\n" -"float2 Hammersley2D(uint i, uint N)\n" -"{\n" -" // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n" -" uint bits = (i << 16u) | (i >> 16u);\n" -" bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n" -" bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n" -" bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n" -" bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n" -" float rdi = float(bits) * 2.3283064365386963e-10;\n" -" return float2(float(i) / float(N), rdi);\n" -"}\n" -"\n" -"// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf\n" -"float3 ImportanceSampleGGX( float2 Xi, float Roughness, float3 N )\n" -"{\n" -" float a = Roughness * Roughness;\n" -" float Phi = 2.0 * PI * Xi.x;\n" -" float CosTheta = sqrt( (1.0 - Xi.y) / ( 1.0 + (a*a - 1.0) * Xi.y ) );\n" -" float SinTheta = sqrt( 1.0 - CosTheta * CosTheta );\n" -" float3 H;\n" -" H.x = SinTheta * cos( Phi );\n" -" H.y = SinTheta * sin( Phi );\n" -" H.z = CosTheta;\n" -" float3 UpVector = abs(N.z) < 0.999 ? float3(0.0, 0.0, 1.0) : float3(1.0, 0.0, 0.0);\n" -" float3 TangentX = normalize( cross( UpVector, N ) );\n" -" float3 TangentY = cross( N, TangentX );\n" -" // Tangent to world space\n" -" return TangentX * H.x + TangentY * H.y + N * H.z;\n" -"}\n" -"\n" -"#endif // _GLTF_PBR_PRECOMPUTE_COMMON_FXH_\n" diff --git a/shaders_inc/GLTF_PBR_Shading.fxh.h b/shaders_inc/GLTF_PBR_Shading.fxh.h deleted file mode 100644 index a7355993..00000000 --- a/shaders_inc/GLTF_PBR_Shading.fxh.h +++ /dev/null @@ -1,262 +0,0 @@ -"#ifndef _GLTF_PBR_SHADING_FXH_\n" -"#define _GLTF_PBR_SHADING_FXH_\n" -"\n" -"#include \"GLTF_PBR_Structures.fxh\"\n" -"#include \"PBR_Common.fxh\"\n" -"#include \"ShaderUtilities.fxh\"\n" -"\n" -"#ifndef GLTF_PBR_MANUAL_SRGB\n" -"# define GLTF_PBR_MANUAL_SRGB 1\n" -"#endif\n" -"\n" -"#ifndef SRGB_FAST_APPROXIMATION\n" -"# define SRGB_FAST_APPROXIMATION 1\n" -"#endif\n" -"\n" -"#define GLTF_PBR_USE_ENV_MAP_LOD\n" -"#define GLTF_PBR_USE_HDR_CUBEMAPS\n" -"\n" -"float GetPerceivedBrightness(float3 rgb)\n" -"{\n" -" return sqrt(0.299 * rgb.r * rgb.r + 0.587 * rgb.g * rgb.g + 0.114 * rgb.b * rgb.b);\n" -"}\n" -"\n" -"// https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows/js/three.pbrUtilities.js#L34\n" -"float GLTF_PBR_SolveMetallic(float3 diffuse,\n" -" float3 specular,\n" -" float oneMinusSpecularStrength)\n" -"{\n" -" const float c_MinReflectance = 0.04;\n" -" float specularBrightness = GetPerceivedBrightness(specular);\n" -" if (specularBrightness < c_MinReflectance)\n" -" {\n" -" return 0.0;\n" -" }\n" -"\n" -" float diffuseBrightness = GetPerceivedBrightness(diffuse);\n" -"\n" -" float a = c_MinReflectance;\n" -" float b = diffuseBrightness * oneMinusSpecularStrength / (1.0 - c_MinReflectance) + specularBrightness - 2.0 * c_MinReflectance;\n" -" float c = c_MinReflectance - specularBrightness;\n" -" float D = b * b - 4.0 * a * c;\n" -"\n" -" return clamp((-b + sqrt(D)) / (2.0 * a), 0.0, 1.0);\n" -"}\n" -"\n" -"\n" -"float3 SRGBtoLINEAR(float3 srgbIn)\n" -"{\n" -"#ifdef GLTF_PBR_MANUAL_SRGB\n" -"# ifdef SRGB_FAST_APPROXIMATION\n" -" float3 linOut = pow(saturate(srgbIn.xyz), float3(2.2, 2.2, 2.2));\n" -"# else\n" -" float3 bLess = step(float3(0.04045, 0.04045, 0.04045), srgbIn.xyz);\n" -" float3 linOut = mix( srgbIn.xyz/12.92, pow(saturate((srgbIn.xyz + float3(0.055, 0.055, 0.055)) / 1.055), float3(2.4, 2.4, 2.4)), bLess );\n" -"# endif\n" -" return linOut;\n" -"#else\n" -" return srgbIn;\n" -"#endif\n" -"}\n" -"\n" -"float4 SRGBtoLINEAR(float4 srgbIn)\n" -"{\n" -" return float4(SRGBtoLINEAR(srgbIn.xyz), srgbIn.w);\n" -"}\n" -"\n" -"\n" -"float3 GLTF_PBR_ApplyDirectionalLight(float3 lightDir, float3 lightColor, SurfaceReflectanceInfo srfInfo, float3 normal, float3 view)\n" -"{\n" -" float3 pointToLight = -lightDir;\n" -" float3 diffuseContrib, specContrib;\n" -" float NdotL;\n" -" SmithGGX_BRDF(pointToLight, normal, view, srfInfo, diffuseContrib, specContrib, NdotL);\n" -" // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n" -" float3 shade = (diffuseContrib + specContrib) * NdotL;\n" -" return lightColor * shade;\n" -"}\n" -"\n" -"\n" -"// Find the normal for this fragment, pulling either from a predefined normal map\n" -"// or from the interpolated mesh normal and tangent attributes.\n" -"float3 GLTF_PBR_PerturbNormal(in float3 dPos_dx,\n" -" in float3 dPos_dy,\n" -" in float2 dUV_dx,\n" -" in float2 dUV_dy,\n" -" in float3 Normal,\n" -" in float3 TSNormal,\n" -" bool HasUV,\n" -" bool IsFrontFace)\n" -"{\n" -" // Retrieve the tangent space matrix\n" -" float NormalLen = length(Normal);\n" -" float3 ng;\n" -" if (NormalLen > 1e-5)\n" -" {\n" -" ng = Normal/NormalLen;\n" -" }\n" -" else\n" -" {\n" -" ng = normalize(cross(dPos_dx, dPos_dy));\n" -"#if (defined(GLSL) || defined(GL_ES)) && !defined(VULKAN)\n" -" // In OpenGL screen is upside-down, so we have to invert the vector\n" -" ng *= -1.0;\n" -"#endif\n" -" }\n" -"\n" -" if (HasUV)\n" -" {\n" -" return TransformTangentSpaceNormalGrad(dPos_dx, dPos_dy, dUV_dx, dUV_dy, ng, TSNormal * (IsFrontFace ? +1.0 : -1.0));\n" -" }\n" -" else\n" -" {\n" -" return ng * (IsFrontFace ? +1.0 : -1.0);\n" -" }\n" -"}\n" -"\n" -"\n" -"struct GLTF_PBR_IBL_Contribution\n" -"{\n" -" float3 f3Diffuse;\n" -" float3 f3Specular;\n" -"};\n" -"\n" -"// Calculation of the lighting contribution from an optional Image Based Light source.\n" -"// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].\n" -"// See our README.md on Environment Maps [3] for additional discussion.\n" -"GLTF_PBR_IBL_Contribution GLTF_PBR_GetIBLContribution(\n" -" in SurfaceReflectanceInfo SrfInfo,\n" -" in float3 n,\n" -" in float3 v,\n" -" in float PrefilteredCubeMipLevels,\n" -" in Texture2D BRDF_LUT,\n" -" in SamplerState BRDF_LUT_sampler,\n" -" in TextureCube IrradianceMap,\n" -" in SamplerState IrradianceMap_sampler,\n" -" in TextureCube PrefilteredEnvMap,\n" -" in SamplerState PrefilteredEnvMap_sampler)\n" -"{\n" -" float NdotV = clamp(dot(n, v), 0.0, 1.0);\n" -"\n" -" float lod = clamp(SrfInfo.PerceptualRoughness * PrefilteredCubeMipLevels, 0.0, PrefilteredCubeMipLevels);\n" -" float3 reflection = normalize(reflect(-v, n));\n" -"\n" -" float2 brdfSamplePoint = clamp(float2(NdotV, SrfInfo.PerceptualRoughness), float2(0.0, 0.0), float2(1.0, 1.0));\n" -" // retrieve a scale and bias to F0. See [1], Figure 3\n" -" float2 brdf = BRDF_LUT.Sample(BRDF_LUT_sampler, brdfSamplePoint).rg;\n" -"\n" -" float4 diffuseSample = IrradianceMap.Sample(IrradianceMap_sampler, n);\n" -"\n" -"#ifdef GLTF_PBR_USE_ENV_MAP_LOD\n" -" float4 specularSample = PrefilteredEnvMap.SampleLevel(PrefilteredEnvMap_sampler, reflection, lod);\n" -"#else\n" -" float4 specularSample = PrefilteredEnvMap.Sample(PrefilteredEnvMap_sampler, reflection);\n" -"#endif\n" -"\n" -"#ifdef GLTF_PBR_USE_HDR_CUBEMAPS\n" -" // Already linear.\n" -" float3 diffuseLight = diffuseSample.rgb;\n" -" float3 specularLight = specularSample.rgb;\n" -"#else\n" -" float3 diffuseLight = SRGBtoLINEAR(diffuseSample).rgb;\n" -" float3 specularLight = SRGBtoLINEAR(specularSample).rgb;\n" -"#endif\n" -"\n" -" GLTF_PBR_IBL_Contribution IBLContrib;\n" -" IBLContrib.f3Diffuse = diffuseLight * SrfInfo.DiffuseColor;\n" -" IBLContrib.f3Specular = specularLight * (SrfInfo.Reflectance0 * brdf.x + SrfInfo.Reflectance90 * brdf.y);\n" -" return IBLContrib;\n" -"}\n" -"\n" -"/// Calculates surface reflectance info\n" -"\n" -"/// \\param [in] Workflow - PBR workflow (PBR_WORKFLOW_SPECULAR_GLOSINESS or PBR_WORKFLOW_METALLIC_ROUGHNESS).\n" -"/// \\param [in] BaseColor - Material base color.\n" -"/// \\param [in] PhysicalDesc - Physical material description. For Metallic-roughness workflow,\n" -"/// \'g\' channel stores roughness, \'b\' channel stores metallic.\n" -"/// \\param [out] Metallic - Metallic value used for shading.\n" -"SurfaceReflectanceInfo GLTF_PBR_GetSurfaceReflectance(int Workflow,\n" -" float4 BaseColor,\n" -" float4 PhysicalDesc,\n" -" out float Metallic)\n" -"{\n" -" SurfaceReflectanceInfo SrfInfo;\n" -"\n" -" float3 SpecularColor;\n" -"\n" -" float3 f0 = float3(0.04, 0.04, 0.04);\n" -"\n" -" // Metallic and Roughness material properties are packed together\n" -" // In glTF, these factors can be specified by fixed scalar values\n" -" // or from a metallic-roughness map\n" -" if (Workflow == PBR_WORKFLOW_SPECULAR_GLOSINESS)\n" -" {\n" -" SrfInfo.PerceptualRoughness = 1.0 - PhysicalDesc.a; // glossiness to roughness\n" -" f0 = PhysicalDesc.rgb;\n" -"\n" -" // f0 = specular\n" -" SpecularColor = f0;\n" -" float oneMinusSpecularStrength = 1.0 - max(max(f0.r, f0.g), f0.b);\n" -" SrfInfo.DiffuseColor = BaseColor.rgb * oneMinusSpecularStrength;\n" -"\n" -" // do conversion between metallic M-R and S-G metallic\n" -" Metallic = GLTF_PBR_SolveMetallic(BaseColor.rgb, SpecularColor, oneMinusSpecularStrength);\n" -" }\n" -" else if (Workflow == PBR_WORKFLOW_METALLIC_ROUGHNESS)\n" -" {\n" -" // Roughness is stored in the \'g\' channel, metallic is stored in the \'b\' channel.\n" -" // This layout intentionally reserves the \'r\' channel for (optional) occlusion map data\n" -" SrfInfo.PerceptualRoughness = PhysicalDesc.g;\n" -" Metallic = PhysicalDesc.b;\n" -"\n" -" SrfInfo.DiffuseColor = BaseColor.rgb * (float3(1.0, 1.0, 1.0) - f0) * (1.0 - Metallic);\n" -" SpecularColor = lerp(f0, BaseColor.rgb, Metallic);\n" -" }\n" -"\n" -"//#ifdef ALPHAMODE_OPAQUE\n" -"// baseColor.a = 1.0;\n" -"//#endif\n" -"//\n" -"//#ifdef MATERIAL_UNLIT\n" -"// gl_FragColor = float4(gammaCorrection(baseColor.rgb), baseColor.a);\n" -"// return;\n" -"//#endif\n" -"\n" -" SrfInfo.PerceptualRoughness = clamp(SrfInfo.PerceptualRoughness, 0.0, 1.0);\n" -"\n" -" // Compute reflectance.\n" -" float3 Reflectance0 = SpecularColor;\n" -" float MaxR0 = max(max(Reflectance0.r, Reflectance0.g), Reflectance0.b);\n" -" // Anything less than 2% is physically impossible and is instead considered to be shadowing. Compare to \"Real-Time-Rendering\" 4th editon on page 325.\n" -" float R90 = clamp(MaxR0 * 50.0, 0.0, 1.0);\n" -"\n" -" SrfInfo.Reflectance0 = Reflectance0;\n" -" SrfInfo.Reflectance90 = float3(R90, R90, R90);\n" -"\n" -" return SrfInfo;\n" -"}\n" -"\n" -"/// Calculates surface reflectance info for Metallic-roughness workflow\n" -"SurfaceReflectanceInfo GLTF_PBR_GetSurfaceReflectanceMR(float3 BaseColor,\n" -" float Metallic,\n" -" float Roughness)\n" -"{\n" -" SurfaceReflectanceInfo SrfInfo;\n" -"\n" -" float f0 = 0.04;\n" -"\n" -" SrfInfo.PerceptualRoughness = Roughness;\n" -" SrfInfo.DiffuseColor = BaseColor * ((1.0 - f0) * (1.0 - Metallic));\n" -"\n" -" float3 Reflectance0 = lerp(float3(f0, f0, f0), BaseColor, Metallic);\n" -" float MaxR0 = max(max(Reflectance0.r, Reflectance0.g), Reflectance0.b);\n" -" // Anything less than 2% is physically impossible and is instead considered to be shadowing. Compare to \"Real-Time-Rendering\" 4th editon on page 325.\n" -" float R90 = min(MaxR0 * 50.0, 1.0);\n" -"\n" -" SrfInfo.Reflectance0 = Reflectance0;\n" -" SrfInfo.Reflectance90 = float3(R90, R90, R90);\n" -"\n" -" return SrfInfo;\n" -"}\n" -"\n" -"#endif // _GLTF_PBR_SHADING_FXH_\n" diff --git a/shaders_inc/GLTF_PBR_Structures.fxh.h b/shaders_inc/GLTF_PBR_Structures.fxh.h deleted file mode 100644 index 03ed909a..00000000 --- a/shaders_inc/GLTF_PBR_Structures.fxh.h +++ /dev/null @@ -1,169 +0,0 @@ -"#ifndef _GLTF_PBR_STRUCTURES_FXH_\n" -"#define _GLTF_PBR_STRUCTURES_FXH_\n" -"\n" -"#ifdef __cplusplus\n" -"\n" -"# ifndef CHECK_STRUCT_ALIGNMENT\n" -" // Note that defining empty macros causes GL shader compilation error on Mac, because\n" -" // it does not allow standalone semicolons outside of main.\n" -" // On the other hand, adding semicolon at the end of the macro definition causes gcc error.\n" -"# define CHECK_STRUCT_ALIGNMENT(s) static_assert( sizeof(s) % 16 == 0, \"sizeof(\" #s \") is not multiple of 16\" )\n" -"# endif\n" -"\n" -"#endif\n" -"\n" -"#ifndef PBR_WORKFLOW_METALLIC_ROUGHNESS\n" -"# define PBR_WORKFLOW_METALLIC_ROUGHNESS 0\n" -"#endif\n" -"\n" -"#ifndef PBR_WORKFLOW_SPECULAR_GLOSINESS\n" -"# define PBR_WORKFLOW_SPECULAR_GLOSINESS 1\n" -"#endif\n" -"\n" -"\n" -"#ifndef GLTF_ALPHA_MODE_OPAQUE\n" -"# define GLTF_ALPHA_MODE_OPAQUE 0\n" -"#endif\n" -"\n" -"#ifndef GLTF_ALPHA_MODE_MASK\n" -"# define GLTF_ALPHA_MODE_MASK 1\n" -"#endif\n" -"\n" -"#ifndef GLTF_ALPHA_MODE_BLEND\n" -"# define GLTF_ALPHA_MODE_BLEND 2\n" -"#endif\n" -"\n" -"\n" -"struct GLTFNodeShaderTransforms\n" -"{\n" -" float4x4 NodeMatrix;\n" -"\n" -" int JointCount;\n" -" float Dummy0;\n" -" float Dummy1;\n" -" float Dummy2;\n" -"};\n" -"#ifdef CHECK_STRUCT_ALIGNMENT\n" -" CHECK_STRUCT_ALIGNMENT(GLTFNodeShaderTransforms);\n" -"#endif\n" -"\n" -"\n" -"struct GLTFRendererShaderParameters\n" -"{\n" -" float AverageLogLum;\n" -" float MiddleGray;\n" -" float WhitePoint;\n" -" float PrefilteredCubeMipLevels;\n" -"\n" -" float IBLScale;\n" -" int DebugViewType;\n" -" float OcclusionStrength;\n" -" float EmissionScale;\n" -"};\n" -"#ifdef CHECK_STRUCT_ALIGNMENT\n" -" CHECK_STRUCT_ALIGNMENT(GLTFRendererShaderParameters);\n" -"#endif\n" -"\n" -"struct GLTFMaterialShaderInfo\n" -"{\n" -" float4 BaseColorFactor;\n" -" float4 EmissiveFactor;\n" -" float4 SpecularFactor;\n" -"\n" -" int Workflow;\n" -" float UVSelector0;\n" -" float UVSelector1;\n" -" float UVSelector2;\n" -"\n" -" float UVSelector3;\n" -" float UVSelector4;\n" -" float TextureSlice0;\n" -" float TextureSlice1;\n" -"\n" -" float TextureSlice2;\n" -" float TextureSlice3;\n" -" float TextureSlice4;\n" -" float MetallicFactor;\n" -"\n" -" float RoughnessFactor;\n" -" int AlphaMode;\n" -" float AlphaMaskCutoff;\n" -" float Dummy0;\n" -"\n" -" // When texture atlas is used, UV scale and bias applied to\n" -" // each texture coordinate set\n" -" float4 UVScaleBias0;\n" -" float4 UVScaleBias1;\n" -" float4 UVScaleBias2;\n" -" float4 UVScaleBias3;\n" -" float4 UVScaleBias4;\n" -"\n" -" float4 CustomData;\n" -"};\n" -"#ifdef CHECK_STRUCT_ALIGNMENT\n" -" CHECK_STRUCT_ALIGNMENT(GLTFMaterialShaderInfo);\n" -"#endif\n" -"\n" -"#ifndef BaseColorTextureUVSelector\n" -"# define BaseColorTextureUVSelector UVSelector0\n" -"#endif\n" -"\n" -"#ifndef PhysicalDescriptorTextureUVSelector\n" -"# define PhysicalDescriptorTextureUVSelector UVSelector1\n" -"#endif\n" -"\n" -"#ifndef NormalTextureUVSelector\n" -"# define NormalTextureUVSelector UVSelector2\n" -"#endif\n" -"\n" -"#ifndef OcclusionTextureUVSelector\n" -"# define OcclusionTextureUVSelector UVSelector3\n" -"#endif\n" -"\n" -"#ifndef EmissiveTextureUVSelector\n" -"# define EmissiveTextureUVSelector UVSelector4\n" -"#endif\n" -"\n" -"\n" -"#ifndef BaseColorSlice\n" -"# define BaseColorSlice TextureSlice0\n" -"#endif\n" -"\n" -"#ifndef PhysicalDescriptorSlice\n" -"# define PhysicalDescriptorSlice TextureSlice1\n" -"#endif\n" -"\n" -"#ifndef NormalSlice\n" -"# define NormalSlice TextureSlice2\n" -"#endif\n" -"\n" -"#ifndef OcclusionSlice\n" -"# define OcclusionSlice TextureSlice3\n" -"#endif\n" -"\n" -"#ifndef EmissiveSlice\n" -"# define EmissiveSlice TextureSlice4\n" -"#endif\n" -"\n" -"\n" -"#ifndef BaseColorUVScaleBias\n" -"# define BaseColorUVScaleBias UVScaleBias0\n" -"#endif\n" -"\n" -"#ifndef PhysicalDescriptorUVScaleBias\n" -"# define PhysicalDescriptorUVScaleBias UVScaleBias1\n" -"#endif\n" -"\n" -"#ifndef NormalMapUVScaleBias\n" -"# define NormalMapUVScaleBias UVScaleBias2\n" -"#endif\n" -"\n" -"#ifndef OcclusionUVScaleBias\n" -"# define OcclusionUVScaleBias UVScaleBias3\n" -"#endif\n" -"\n" -"#ifndef EmissiveUVScaleBias\n" -"# define EmissiveUVScaleBias UVScaleBias4\n" -"#endif\n" -"\n" -"#endif // _GLTF_PBR_STRUCTURES_FXH_\n" diff --git a/shaders_inc/GLTF_PBR_VertexProcessing.fxh.h b/shaders_inc/GLTF_PBR_VertexProcessing.fxh.h deleted file mode 100644 index fa315a68..00000000 --- a/shaders_inc/GLTF_PBR_VertexProcessing.fxh.h +++ /dev/null @@ -1,43 +0,0 @@ -"#ifndef _GLTF_PBR_VERTEX_PROCESSING_FXH_\n" -"#define _GLTF_PBR_VERTEX_PROCESSING_FXH_\n" -"\n" -"#include \"PBR_Structures.fxh\"\n" -"\n" -"struct GLTF_TransformedVertex\n" -"{\n" -" float3 WorldPos;\n" -" float3 Normal;\n" -"};\n" -"\n" -"\n" -"float3x3 InverseTranspose3x3(float3x3 M)\n" -"{\n" -" // Note that in HLSL, M_t[0] is the first row, while in GLSL, it is the\n" -" // first column. Luckily, determinant and inverse matrix can be equally\n" -" // defined through both rows and columns.\n" -" float det = dot(cross(M[0], M[1]), M[2]);\n" -" float3x3 adjugate = float3x3(cross(M[1], M[2]),\n" -" cross(M[2], M[0]),\n" -" cross(M[0], M[1]));\n" -" return adjugate / det;\n" -"}\n" -"\n" -"GLTF_TransformedVertex GLTF_TransformVertex(in float3 Pos,\n" -" in float3 Normal,\n" -" in float4x4 Transform)\n" -"{\n" -" GLTF_TransformedVertex TransformedVert;\n" -"\n" -" float4 locPos = mul(Transform, float4(Pos, 1.0));\n" -" float3x3 NormalTransform = float3x3(Transform[0].xyz, Transform[1].xyz, Transform[2].xyz);\n" -" NormalTransform = InverseTranspose3x3(NormalTransform);\n" -" Normal = mul(NormalTransform, Normal);\n" -" float NormalLen = length(Normal);\n" -" TransformedVert.Normal = Normal / max(NormalLen, 1e-5);\n" -"\n" -" TransformedVert.WorldPos = locPos.xyz / locPos.w;\n" -"\n" -" return TransformedVert;\n" -"}\n" -"\n" -"#endif // _GLTF_PBR_VERTEX_PROCESSING_FXH_\n" diff --git a/shaders_inc/PrecomputeGLTF_BRDF.psh.h b/shaders_inc/PrecomputeGLTF_BRDF.psh.h deleted file mode 100644 index 1c3c1aba..00000000 --- a/shaders_inc/PrecomputeGLTF_BRDF.psh.h +++ /dev/null @@ -1,46 +0,0 @@ -"#include \"FullScreenTriangleVSOutput.fxh\"\n" -"#include \"GLTF_PBR_PrecomputeCommon.fxh\"\n" -"\n" -"#ifndef NUM_SAMPLES\n" -"# define NUM_SAMPLES 512u\n" -"#endif\n" -"\n" -"float2 IntegrateBRDF( float Roughness, float NoV, uint NumSamples )\n" -"{\n" -" float3 V;\n" -" V.x = sqrt( 1.0 - NoV * NoV ); // sin\n" -" V.y = 0.0;\n" -" V.z = NoV; // cos\n" -" const float3 N = float3(0.0, 0.0, 1.0);\n" -" float A = 0.0;\n" -" float B = 0.0;\n" -" for( uint i = 0u; i < NumSamples; i++ )\n" -" {\n" -" float2 Xi = Hammersley2D( i, NumSamples );\n" -" float3 H = ImportanceSampleGGX( Xi, Roughness, N );\n" -" float3 L = 2.0 * dot( V, H ) * H - V;\n" -" float NoL = saturate( L.z );\n" -" float NoH = saturate( H.z );\n" -" float VoH = saturate( dot( V, H ) );\n" -" if( NoL > 0.0 )\n" -" {\n" -" // https://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf\n" -" // Also see eq. 92 in https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights\n" -" // Note that VoH / (NormalDistribution_GGX(H,Roughness) * NoH) term comes from importance sampling\n" -" float G_Vis = 4.0 * SmithGGXVisibilityCorrelated( NoL, NoV, Roughness ) * VoH * NoL / NoH;\n" -" float Fc = pow( 1.0 - VoH, 5.0 );\n" -" A += (1.0 - Fc) * G_Vis;\n" -" B += Fc * G_Vis;\n" -" }\n" -" }\n" -" return float2( A, B ) / float(NumSamples);\n" -"}\n" -"\n" -"void PrecomputeBRDF_PS(FullScreenTriangleVSOutput VSOut,\n" -" out float2 f2BRDF_LUT : SV_Target)\n" -"{\n" -" float2 UV = NormalizedDeviceXYToTexUV(VSOut.f2NormalizedXY);\n" -" float NdotV = UV.x;\n" -" float linearRoughness = UV.y;\n" -" f2BRDF_LUT = IntegrateBRDF(linearRoughness, NdotV, NUM_SAMPLES);\n" -"}\n" diff --git a/shaders_inc/RenderGLTF_PBR.psh.h b/shaders_inc/RenderGLTF_PBR.psh.h deleted file mode 100644 index f48dcfa5..00000000 --- a/shaders_inc/RenderGLTF_PBR.psh.h +++ /dev/null @@ -1,279 +0,0 @@ -"// PBR shader based on the Khronos WebGL PBR implementation\n" -"// See https://github.com/KhronosGroup/glTF-WebGL-PBR\n" -"// Supports both metallic roughness and specular glossiness inputs\n" -"\n" -"#include \"BasicStructures.fxh\"\n" -"#include \"PBR_Shading.fxh\"\n" -"#include \"ToneMapping.fxh\"\n" -"\n" -"#ifndef USE_TEXTURE_ATLAS\n" -"# define USE_TEXTURE_ATLAS 0\n" -"#endif\n" -"\n" -"#ifndef ALLOW_DEBUG_VIEW\n" -"# define ALLOW_DEBUG_VIEW 0\n" -"#endif\n" -"\n" -"#if USE_TEXTURE_ATLAS\n" -"# include \"AtlasSampling.fxh\"\n" -"#endif\n" -"\n" -"cbuffer cbCameraAttribs\n" -"{\n" -" CameraAttribs g_CameraAttribs;\n" -"}\n" -"\n" -"cbuffer cbLightAttribs\n" -"{\n" -" LightAttribs g_LightAttribs;\n" -"}\n" -"\n" -"cbuffer cbPBRAttribs\n" -"{\n" -" PBRRendererShaderParameters g_RenderParameters;\n" -" PBRMaterialShaderInfo g_MaterialInfo;\n" -"}\n" -"\n" -"#if PBR_USE_IBL\n" -"TextureCube g_IrradianceMap;\n" -"SamplerState g_IrradianceMap_sampler;\n" -"\n" -"TextureCube g_PrefilteredEnvMap;\n" -"SamplerState g_PrefilteredEnvMap_sampler;\n" -"\n" -"Texture2D g_BRDF_LUT;\n" -"SamplerState g_BRDF_LUT_sampler;\n" -"#endif\n" -"\n" -"Texture2DArray g_ColorMap;\n" -"SamplerState g_ColorMap_sampler;\n" -"\n" -"Texture2DArray g_PhysicalDescriptorMap;\n" -"SamplerState g_PhysicalDescriptorMap_sampler;\n" -"\n" -"Texture2DArray g_NormalMap;\n" -"SamplerState g_NormalMap_sampler;\n" -"\n" -"#if PBR_USE_AO\n" -"Texture2DArray g_AOMap;\n" -"SamplerState g_AOMap_sampler;\n" -"#endif\n" -"\n" -"#if PBR_USE_EMISSIVE\n" -"Texture2DArray g_EmissiveMap;\n" -"SamplerState g_EmissiveMap_sampler;\n" -"#endif\n" -"\n" -"float4 SampleGLTFTexture(Texture2DArray Tex,\n" -" SamplerState Tex_sampler,\n" -" float2 UV0,\n" -" float2 UV1,\n" -" float Selector,\n" -" float4 ScaleBias,\n" -" float Slice,\n" -" float4 DefaultValue)\n" -"{\n" -" float2 UV = lerp(UV0, UV1, Selector);\n" -"#if USE_TEXTURE_ATLAS\n" -" if (Selector < 0.0)\n" -" {\n" -" return DefaultValue;\n" -" }\n" -" else\n" -" {\n" -" SampleTextureAtlasAttribs SampleAttribs;\n" -" SampleAttribs.f2UV = frac(UV) * ScaleBias.xy + ScaleBias.zw;\n" -" SampleAttribs.f2SmoothUV = UV * ScaleBias.xy;\n" -" SampleAttribs.f2dSmoothUV_dx = ddx(UV) * ScaleBias.xy;\n" -" SampleAttribs.f2dSmoothUV_dy = ddy(UV) * ScaleBias.xy;\n" -" SampleAttribs.fSlice = Slice;\n" -" SampleAttribs.f4UVRegion = ScaleBias;\n" -" SampleAttribs.fSmallestValidLevelDim = 4.0;\n" -" SampleAttribs.IsNonFilterable = false;\n" -" return SampleTextureAtlas(Tex, Tex_sampler, SampleAttribs);\n" -" }\n" -"#else\n" -" return Tex.Sample(Tex_sampler, float3(UV, Slice));\n" -"#endif\n" -"}\n" -"\n" -"void main(in float4 ClipPos : SV_Position,\n" -" in float3 WorldPos : WORLD_POS,\n" -" in float3 Normal : NORMAL,\n" -" in float2 UV0 : UV0,\n" -" in float2 UV1 : UV1,\n" -" in bool IsFrontFace : SV_IsFrontFace,\n" -" out float4 OutColor : SV_Target)\n" -"{\n" -" float4 BaseColor = SampleGLTFTexture(g_ColorMap, g_ColorMap_sampler, UV0, UV1, g_MaterialInfo.BaseColorTextureUVSelector,\n" -" g_MaterialInfo.BaseColorUVScaleBias, g_MaterialInfo.BaseColorSlice, float4(1.0, 1.0, 1.0, 1.0));\n" -" BaseColor = SRGBtoLINEAR(BaseColor) * g_MaterialInfo.BaseColorFactor;\n" -" //BaseColor *= getVertexColor();\n" -"\n" -" float2 NormalMapUV = lerp(UV0, UV1, g_MaterialInfo.NormalTextureUVSelector);\n" -"\n" -" // We have to compute gradients in uniform flow control to avoid issues with perturbed normal\n" -" float3 dWorldPos_dx = ddx(WorldPos);\n" -" float3 dWorldPos_dy = ddy(WorldPos);\n" -" float2 dNormalMapUV_dx = ddx(NormalMapUV);\n" -" float2 dNormalMapUV_dy = ddy(NormalMapUV);\n" -"#if USE_TEXTURE_ATLAS\n" -" {\n" -" NormalMapUV = frac(NormalMapUV);\n" -" NormalMapUV = NormalMapUV * g_MaterialInfo.NormalMapUVScaleBias.xy + g_MaterialInfo.NormalMapUVScaleBias.zw;\n" -" dNormalMapUV_dx *= g_MaterialInfo.NormalMapUVScaleBias.xy;\n" -" dNormalMapUV_dy *= g_MaterialInfo.NormalMapUVScaleBias.xy;\n" -" }\n" -"#endif\n" -"\n" -" if (g_MaterialInfo.AlphaMode == PBR_ALPHA_MODE_MASK && BaseColor.a < g_MaterialInfo.AlphaMaskCutoff)\n" -" {\n" -" discard;\n" -" }\n" -"\n" -" float3 TSNormal = float3(0.0, 0.0, 1.0);\n" -" if (g_MaterialInfo.NormalTextureUVSelector >= 0.0)\n" -" {\n" -"#if USE_TEXTURE_ATLAS\n" -" {\n" -" SampleTextureAtlasAttribs SampleAttribs;\n" -" SampleAttribs.f2UV = NormalMapUV;\n" -" SampleAttribs.f2SmoothUV = lerp(UV0, UV1, g_MaterialInfo.NormalTextureUVSelector) * g_MaterialInfo.NormalMapUVScaleBias.xy;\n" -" SampleAttribs.f2dSmoothUV_dx = dNormalMapUV_dx;\n" -" SampleAttribs.f2dSmoothUV_dy = dNormalMapUV_dy;\n" -" SampleAttribs.fSlice = g_MaterialInfo.NormalSlice;\n" -" SampleAttribs.f4UVRegion = g_MaterialInfo.NormalMapUVScaleBias;\n" -" SampleAttribs.fSmallestValidLevelDim = 4.0;\n" -" SampleAttribs.IsNonFilterable = false;\n" -" TSNormal = SampleTextureAtlas(g_NormalMap, g_NormalMap_sampler, SampleAttribs).xyz;\n" -" }\n" -"#else\n" -" {\n" -" TSNormal = g_NormalMap.Sample(g_NormalMap_sampler, float3(NormalMapUV, g_MaterialInfo.NormalSlice)).xyz;\n" -" }\n" -"#endif\n" -" TSNormal = TSNormal * float3(2.0, 2.0, 2.0) - float3(1.0, 1.0, 1.0);\n" -" }\n" -"\n" -" float Occlusion = 1.0;\n" -"#if PBR_USE_AO\n" -" Occlusion = SampleGLTFTexture(g_AOMap, g_AOMap_sampler, UV0, UV1, g_MaterialInfo.OcclusionTextureUVSelector,\n" -" g_MaterialInfo.OcclusionUVScaleBias, g_MaterialInfo.OcclusionSlice, float4(1.0, 1.0, 1.0, 1.0)).r;\n" -"#endif\n" -"\n" -" float3 Emissive = float3(0.0, 0.0, 0.0);\n" -"#if PBR_USE_EMISSIVE\n" -" Emissive = SampleGLTFTexture(g_EmissiveMap, g_EmissiveMap_sampler, UV0, UV1, g_MaterialInfo.EmissiveTextureUVSelector,\n" -" g_MaterialInfo.EmissiveUVScaleBias, g_MaterialInfo.EmissiveSlice, float4(0.0, 0.0, 0.0, 0.0)).rgb;\n" -"#endif\n" -"\n" -" float4 PhysicalDesc = SampleGLTFTexture(g_PhysicalDescriptorMap, g_PhysicalDescriptorMap_sampler,\n" -" UV0, UV1, g_MaterialInfo.PhysicalDescriptorTextureUVSelector,\n" -" g_MaterialInfo.PhysicalDescriptorUVScaleBias, g_MaterialInfo.PhysicalDescriptorSlice,\n" -" float4(0.0, 1.0, 0.0, 0.0));\n" -"\n" -" float metallic;\n" -" if (g_MaterialInfo.Workflow == PBR_WORKFLOW_SPECULAR_GLOSINESS)\n" -" {\n" -" PhysicalDesc.rgb = SRGBtoLINEAR(PhysicalDesc.rgb) * g_MaterialInfo.SpecularFactor.rgb;\n" -" const float u_GlossinessFactor = 1.0;\n" -" PhysicalDesc.a *= u_GlossinessFactor;\n" -" }\n" -" else if(g_MaterialInfo.Workflow == PBR_WORKFLOW_METALLIC_ROUGHNESS)\n" -" {\n" -" PhysicalDesc.g = saturate(PhysicalDesc.g * g_MaterialInfo.RoughnessFactor);\n" -" PhysicalDesc.b = saturate(PhysicalDesc.b * g_MaterialInfo.MetallicFactor);\n" -" }\n" -" SurfaceReflectanceInfo SrfInfo = GetSurfaceReflectance(g_MaterialInfo.Workflow, BaseColor, PhysicalDesc, metallic);\n" -"\n" -" // LIGHTING\n" -" float3 perturbedNormal = PerturbNormal(dWorldPos_dx, dWorldPos_dy, dNormalMapUV_dx, dNormalMapUV_dy,\n" -" Normal, TSNormal, g_MaterialInfo.NormalTextureUVSelector >= 0.0, IsFrontFace);\n" -" float3 view = normalize(g_CameraAttribs.f4Position.xyz - WorldPos.xyz); // Direction from surface point to camera\n" -"\n" -" float3 color = float3(0.0, 0.0, 0.0);\n" -" color += ApplyDirectionalLight(g_LightAttribs.f4Direction.xyz, g_LightAttribs.f4Intensity.rgb, SrfInfo, perturbedNormal, view);\n" -"\n" -"//#ifdef USE_PUNCTUAL\n" -"// for (int i = 0; i < LIGHT_COUNT; ++i)\n" -"// {\n" -"// Light light = u_Lights[i];\n" -"// if (light.type == LightType_Directional)\n" -"// {\n" -"// color += applyDirectionalLight(light, materialInfo, normal, view);\n" -"// }\n" -"// else if (light.type == LightType_Point)\n" -"// {\n" -"// color += applyPointLight(light, materialInfo, normal, view);\n" -"// }\n" -"// else if (light.type == LightType_Spot)\n" -"// {\n" -"// color += applySpotLight(light, materialInfo, normal, view);\n" -"// }\n" -"// }\n" -"//#endif\n" -"//\n" -"\n" -"\n" -" // Calculate lighting contribution from image based lighting source (IBL)\n" -" IBL_Contribution IBLContrib;\n" -" IBLContrib.f3Diffuse = float3(0.0, 0.0, 0.0);\n" -" IBLContrib.f3Specular = float3(0.0, 0.0, 0.0);\n" -"#if PBR_USE_IBL\n" -" IBLContrib =\n" -" GetIBLContribution(SrfInfo, perturbedNormal, view, float(g_RenderParameters.PrefilteredCubeMipLevels),\n" -" g_BRDF_LUT, g_BRDF_LUT_sampler,\n" -" g_IrradianceMap, g_IrradianceMap_sampler,\n" -" g_PrefilteredEnvMap, g_PrefilteredEnvMap_sampler);\n" -" color += (IBLContrib.f3Diffuse + IBLContrib.f3Specular) * g_RenderParameters.IBLScale;\n" -"#endif\n" -"\n" -"#if PBR_USE_AO\n" -" color = lerp(color, color * Occlusion, g_RenderParameters.OcclusionStrength);\n" -"#endif\n" -"\n" -"#if PBR_USE_EMISSIVE\n" -" const float u_EmissiveFactor = 1.0;\n" -" Emissive = SRGBtoLINEAR(Emissive);\n" -" color += Emissive.rgb * g_MaterialInfo.EmissiveFactor.rgb * g_RenderParameters.EmissionScale;\n" -"#endif\n" -"\n" -" ToneMappingAttribs TMAttribs;\n" -" TMAttribs.iToneMappingMode = TONE_MAPPING_MODE_UNCHARTED2;\n" -" TMAttribs.bAutoExposure = false;\n" -" TMAttribs.fMiddleGray = g_RenderParameters.MiddleGray;\n" -" TMAttribs.bLightAdaptation = false;\n" -" TMAttribs.fWhitePoint = g_RenderParameters.WhitePoint;\n" -" TMAttribs.fLuminanceSaturation = 1.0;\n" -" color = ToneMap(color, TMAttribs, g_RenderParameters.AverageLogLum);\n" -" OutColor = float4(color, BaseColor.a);\n" -"\n" -"#if ALLOW_DEBUG_VIEW\n" -" // Shader inputs debug visualization\n" -" if (g_RenderParameters.DebugViewType != 0)\n" -" {\n" -" switch (g_RenderParameters.DebugViewType)\n" -" {\n" -" case 1: OutColor.rgba = BaseColor; break;\n" -" case 2: OutColor.rgba = float4(BaseColor.a, BaseColor.a, BaseColor.a, 1.0); break;\n" -" // Apply extra srgb->linear transform to make the maps look better\n" -" case 3: OutColor.rgb = SRGBtoLINEAR(TSNormal.xyz); break;\n" -" case 4: OutColor.rgb = SRGBtoLINEAR(Occlusion * float3(1.0, 1.0, 1.0)); break;\n" -" case 5: OutColor.rgb = SRGBtoLINEAR(Emissive.rgb); break;\n" -" case 6: OutColor.rgb = SRGBtoLINEAR(metallic * float3(1.0, 1.0, 1.0) ); break;\n" -" case 7: OutColor.rgb = SRGBtoLINEAR(SrfInfo.PerceptualRoughness * float3(1.0, 1.0, 1.0)); break;\n" -" case 8: OutColor.rgb = SrfInfo.DiffuseColor; break;\n" -" case 9: OutColor.rgb = SrfInfo.Reflectance0; break;\n" -" case 10: OutColor.rgb = SrfInfo.Reflectance90; break;\n" -" case 11: OutColor.rgb = SRGBtoLINEAR(abs(Normal / max(length(Normal), 1e-3))); break;\n" -" case 12: OutColor.rgb = SRGBtoLINEAR(abs(perturbedNormal)); break;\n" -" case 13: OutColor.rgb = dot(perturbedNormal, view) * float3(1.0, 1.0, 1.0); break;\n" -"#if PBR_USE_IBL\n" -" case 14: OutColor.rgb = IBLContrib.f3Diffuse; break;\n" -" case 15: OutColor.rgb = IBLContrib.f3Specular; break;\n" -"#endif\n" -" }\n" -" }\n" -"#endif\n" -"\n" -"}\n" diff --git a/shaders_inc/RenderGLTF_PBR.vsh.h b/shaders_inc/RenderGLTF_PBR.vsh.h deleted file mode 100644 index 874c5813..00000000 --- a/shaders_inc/RenderGLTF_PBR.vsh.h +++ /dev/null @@ -1,63 +0,0 @@ -"#include \"BasicStructures.fxh\"\n" -"#include \"VertexProcessing.fxh\"\n" -"#include \"PBR_Structures.fxh\"\n" -"\n" -"struct GLTF_VS_Input\n" -"{\n" -" float3 Pos : ATTRIB0;\n" -" float3 Normal : ATTRIB1;\n" -" float2 UV0 : ATTRIB2;\n" -" float2 UV1 : ATTRIB3;\n" -" float4 Joint0 : ATTRIB4;\n" -" float4 Weight0 : ATTRIB5;\n" -"};\n" -"\n" -"cbuffer cbCameraAttribs\n" -"{\n" -" CameraAttribs g_CameraAttribs;\n" -"}\n" -"\n" -"cbuffer cbTransforms\n" -"{\n" -" GLTFNodeShaderTransforms g_Transforms;\n" -"}\n" -"\n" -"#ifndef MAX_JOINT_COUNT\n" -"# define MAX_JOINT_COUNT 64\n" -"#endif\n" -"\n" -"cbuffer cbJointTransforms\n" -"{\n" -" float4x4 g_Joints[MAX_JOINT_COUNT];\n" -"}\n" -"\n" -"void main(in GLTF_VS_Input VSIn,\n" -" out float4 ClipPos : SV_Position,\n" -" out float3 WorldPos : WORLD_POS,\n" -" out float3 Normal : NORMAL,\n" -" out float2 UV0 : UV0,\n" -" out float2 UV1 : UV1)\n" -"{\n" -" // Warning: moving this block into GLTF_TransformVertex() function causes huge\n" -" // performance degradation on Vulkan because glslang/SPIRV-Tools are apparently not able\n" -" // to eliminate the copy of g_Transforms structure.\n" -" float4x4 Transform = g_Transforms.NodeMatrix;\n" -" if (g_Transforms.JointCount > 0)\n" -" {\n" -" // Mesh is skinned\n" -" float4x4 SkinMat =\n" -" VSIn.Weight0.x * g_Joints[int(VSIn.Joint0.x)] +\n" -" VSIn.Weight0.y * g_Joints[int(VSIn.Joint0.y)] +\n" -" VSIn.Weight0.z * g_Joints[int(VSIn.Joint0.z)] +\n" -" VSIn.Weight0.w * g_Joints[int(VSIn.Joint0.w)];\n" -" Transform = mul(Transform, SkinMat);\n" -" }\n" -"\n" -" GLTF_TransformedVertex TransformedVert = GLTF_TransformVertex(VSIn.Pos, VSIn.Normal, Transform);\n" -"\n" -" ClipPos = mul(float4(TransformedVert.WorldPos, 1.0), g_CameraAttribs.mViewProj);\n" -" WorldPos = TransformedVert.WorldPos;\n" -" Normal = TransformedVert.Normal;\n" -" UV0 = VSIn.UV0;\n" -" UV1 = VSIn.UV1;\n" -"}\n" diff --git a/shaders_inc/RenderMeshId.psh.h b/shaders_inc/RenderMeshId.psh.h deleted file mode 100644 index bf1b20b1..00000000 --- a/shaders_inc/RenderMeshId.psh.h +++ /dev/null @@ -1,20 +0,0 @@ -"#include \"PBR_Structures.fxh\"\n" -"#include \"VSOutputStruct.generated\"\n" -"\n" -"cbuffer cbPBRAttribs\n" -"{\n" -" PBRShaderAttribs g_PBRAttribs;\n" -"}\n" -"\n" -"void main(in VSOutput VSOut,\n" -" out uint4 OutMeshId : SV_Target)\n" -"{\n" -" OutMeshId.r = (g_PBRAttribs.Renderer.MeshId >> 0u) & 0xFFu;\n" -" OutMeshId.g = (g_PBRAttribs.Renderer.MeshId >> 8u) & 0xFFu;\n" -" OutMeshId.b = (g_PBRAttribs.Renderer.MeshId >> 16u) & 0xFFu;\n" -" OutMeshId.a = (g_PBRAttribs.Renderer.MeshId >> 24u) & 0xFFu;\n" -" //OutMeshId.r = float((g_PBRAttribs.Renderer.MeshId >> 0u) & 0xFFu) / 255.0;\n" -" //OutMeshId.g = float((g_PBRAttribs.Renderer.MeshId >> 8u) & 0xFFu) / 255.0;\n" -" //OutMeshId.b = float((g_PBRAttribs.Renderer.MeshId >> 16u) & 0xFFu) / 255.0;\n" -" //OutMeshId.a = float((g_PBRAttribs.Renderer.MeshId >> 24u) & 0xFFu) / 255.0;\n" -"}\n"