2e44b0b350
commit 8197605c1c6c660c71727db8472bf9a9ac2ae76d Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 23:55:05 2016 +0300 Convert cubemap to DDS. commit a06cf912e3a106f66137241722c7fd49c1805e2b Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 23:42:56 2016 +0300 Fix D3D11 crash if trying to assign color texture as a depth stencil or vice versa. Remove mistaken assignment of the 4th rendertarget output from PBRDeferredHWDepth.xml. commit de765127b10c8cef45689fd8117875930af7031a Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 23:17:37 2016 +0300 Add possibility to configure default material technique in Renderer. commit d876a081932f423a42adcc1371a6fac622e8d585 Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 23:10:32 2016 +0300 Refer to Utilities/Rotator.as script in the PBR scene. commit 9e4078c9a1cfa4be040a523d3b51aaf55a332c40 Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 23:06:00 2016 +0300 Readd deleted Flare.dds. commit 1f606cc883e89e15e32272f6d47877c6e511b74b Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 22:31:04 2016 +0300 Remove NinjaSnowWar copypasta. commit 745937646f3638a208e58c3cce76df7afbab8416 Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 22:11:28 2016 +0300 Separate skybox2 material. Remove unused materials. Fix typo in material name. commit 258d0325d4bed282f28d8ec8364ee64700e4f025 Author: Lasse Öörni <loorni@gmail.com> Date: Thu Apr 14 22:04:48 2016 +0300 Squashed commit of the following: commit a329abe9a2a0f77dcb415bafd15c6e309261e7cc Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Thu Apr 14 15:08:26 2016 +0100 removed white space commit 434b1d8599ce2d0828acfc2939b94b33cd821fad Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Thu Apr 14 15:06:36 2016 +0100 Updated Licence commit f89a2369c83791c43762ca2b34f8b3aeeb562b24 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Thu Apr 14 15:03:57 2016 +0100 Converted texture formats commit 028cd1da4d7ac226e1943a70abfd6037912c86b0 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Thu Apr 14 14:55:31 2016 +0100 Updated Licence commit ecc288b3cbc046a678bbc2d0df408b2f29220b30 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Wed Apr 13 00:02:34 2016 +0100 Added basic licence commit ce34c0496e80043e3e79f4273468a66463ed13cb Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Tue Apr 12 14:00:52 2016 +0100 Cleaned Up Data and Reverted Default Technique commit a9e08bbd3a4f08c09baa477a0ce06cef517d506e Merge: 53c53ae d009f11 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Sat Apr 9 11:10:30 2016 +0100 Merge pull request #11 from hdunderscore/typoFix_Metallic Fix metallic typo commit 53c53aec4c1d935b31cbc0ce5eac93faaa5b9f89 Merge: 851487e 9c1d728 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Sat Apr 9 11:08:17 2016 +0100 Merge pull request #10 from cosmy1/patch-10 Remove extra float casts commit d009f11865dfdf9634fa9c297f2cc339164724de Author: hdunderscore <hdunderscore@gmail.com> Date: Sat Apr 9 15:07:44 2016 +1000 Fix metallic typo commit 9c1d728be919a74dfee8973b146f312121daed9e Author: cosmy1 <cosmy_rulezz@hotmail.it> Date: Sat Apr 9 04:50:36 2016 +0200 Remove extra float casts commit 851487ea63c181eb45c5988eb71dd526e2c12852 Merge: 3142270 8edbae9 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Fri Apr 8 19:32:06 2016 +0100 Merge pull request #9 from hdunderscore/PBRChangesR Updates to IBL commit 8edbae92c5e454727126c444b49075ef07e36ab8 Author: hdunderscore <hdunderscore@gmail.com> Date: Fri Apr 8 20:01:33 2016 +1000 - Updated glsl shaders - Fixed a potential bug with direct lighting. - Introduced a new define 'PBRFAST' that will allow the IBL to take a short-cut for significantly higher frame-rate, but lower quality. commit e63a5d4faedb22710f28dbfdff3705fdfb3b1d22 Author: hdunderscore <hdunderscore@gmail.com> Date: Fri Apr 8 10:06:18 2016 +1000 Fixed a divide-by-zero in the CookTorranceBRDF, which was causing a visual issue in DX11. commit 37d30d906c93ebb2e4165f91db5adc7e7893edc4 Author: hdunderscore <hdunderscore@gmail.com> Date: Fri Apr 8 00:30:26 2016 +1000 Fixed specular IBL energy conservation. commit 4643342079dce76c3b26ac101745e49cabad7b68 Author: hdunderscore <hdunderscore@gmail.com> Date: Thu Apr 7 21:27:16 2016 +1000 - Exposed tangents and bi-tangents to the IBL. - Removed unused calculations in deferred first pass. - Added a simpler image sampling calculation. commit b7ea9b89fe455d8e9c62fc3a1dd441a8860c9708 Author: hdunderscore <hdunderscore@gmail.com> Date: Wed Apr 6 22:44:09 2016 +1000 - Fixed a few errors in the BRDF functions - Fixed the specular calculations - Small code refactor to allow for more consistency and easier experimentation. - Implemented the ImageSampling algorithm as described in Epic's 2013 paper, with improvements. - Implemented a true working deferred renderer. - Updated the concrete normal map (reversed the direction). - Changed the sRGB setting of the diffuse textures and cubemap, to perform calculations in linear space. - Added post-process effects to the PBR sample. commit 314227053b26c6ba70d7de32b2c5894d60d25784 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Wed Apr 6 01:35:52 2016 +0100 Missing OpenGL changes (reverted from commit 4169cfca4abe7b23b5f2a84aa391992fe22e3a8b) commit 9cd441c413f4742bca3889d3cdf9f2c290462e3d Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Wed Apr 6 01:27:42 2016 +0100 - Fix Metallic typo - Fix HLSL specular metallic bug - Fix indentation. - Fix BRDF typo. - Fix sample scene material to use normal maps. - Revert IBL Importance sample to use Epic described method. - Removed incorrect application of split sum on top of importance sample method. - Added diffuse IBL calculation. (reverted from commit 143379cee9968588974879e1ce53123f45d8741a) commit 143379cee9968588974879e1ce53123f45d8741a Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Wed Apr 6 01:10:37 2016 +0100 - Fix Metallic typo - Fix HLSL specular metallic bug - Fix indentation. - Fix BRDF typo. - Fix sample scene material to use normal maps. - Revert IBL Importance sample to use Epic described method. - Removed incorrect application of split sum on top of importance sample method. - Added diffuse IBL calculation. commit fbba0f389b571d0b3814254c16b05279bfd29a58 Merge: 4169cfc c9ba2ec Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Tue Apr 5 14:03:40 2016 +0100 Merge pull request #5 from cosmy1/patch-6 Update BDRF.hlsl commit 4169cfca4abe7b23b5f2a84aa391992fe22e3a8b Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Mon Apr 4 22:55:56 2016 +0100 Missing OpenGL changes commit 62491b160cd356cdf4bc292815862fbdea2be22a Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Mon Apr 4 22:54:50 2016 +0100 Fixed OpenGL PBR commit a453cfea1a061900c9de604b5d422d5915cf1712 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Mon Apr 4 02:37:53 2016 +0100 Fixed IBL function taking metallic commit e33efba25b455a6c77679941c489619a02fa1098 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Mon Apr 4 02:35:28 2016 +0100 Improve IBL and fixed specular color commit 4c7058f1c41bbed32c96df550cb93a14b17ec07d Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Sat Apr 2 01:43:18 2016 +0100 Fixed HLSL commit 9d095a14ac64e34fa2c016e4503b2b076e64b025 Merge: 2de2597 0a9ea24 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Sun Apr 3 14:22:46 2016 +0100 Merge pull request #6 from cosmy1/patch-8 Update PBRExample.xml commit 2de259781a588c80117744892083065fbe5bb5c8 Merge: 92ab68c 12bd826 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Sat Apr 2 20:51:30 2016 +0100 Merge pull request #4 from cosmy1/patch-4 Update IBL.glsl commit 92ab68ce3b94a092ad96d9cd0e577d1b7fedf61c Merge: 295a23e e1f5ac2 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Sat Apr 2 20:51:05 2016 +0100 Merge pull request #3 from cosmy1/patch-3 Update BRDF.glsl commit 0a9ea24b6681bac8e3deab58081ee9462b6ada31 Author: cosmy1 <cosmy_rulezz@hotmail.it> Date: Sat Apr 2 11:54:33 2016 +0200 Update PBRExample.xml commit c9ba2ec10f34da559c6148cb0d8d9cbc2ca62ff0 Author: cosmy1 <cosmy_rulezz@hotmail.it> Date: Sat Apr 2 11:50:30 2016 +0200 Update BDRF.hlsl commit 12bd826c73092b8e96782c91b9cc7d925e77708f Author: cosmy1 <cosmy_rulezz@hotmail.it> Date: Sat Apr 2 11:47:29 2016 +0200 Update IBL.glsl commit e1f5ac27606295bf81c07d3d46fda1dae6f191a7 Author: cosmy1 <cosmy_rulezz@hotmail.it> Date: Sat Apr 2 11:43:37 2016 +0200 Update BRDF.glsl commit 295a23e96f3dcdf05aac8d4e9057e8e6c67b3607 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Sat Apr 2 00:19:01 2016 +0100 Updated Example commit 9b105230ecd33082bb82a8963057d635ffbe41ac Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Sat Apr 2 00:15:55 2016 +0100 Fixed IBL and indentation commit 185d31b6a0af7d084e7305d783e407d354274cac Merge: 6b7b5be dad5c04 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Fri Apr 1 23:55:46 2016 +0100 Merge pull request #2 from cosmy1/patch-2 Update BRDF.glsl commit dad5c042fc3272accbb9c26f2e17214ece66ebf8 Author: cosmy1 <cosmy_rulezz@hotmail.it> Date: Sat Apr 2 00:39:35 2016 +0200 Update BRDF.glsl commit 6b7b5bee9c56304aa92a4009d15282b6456d77c6 Merge: a5b6b93 c398e82 Author: dragonCASTjosh <NUT13000804@students.wnc.ac.uk> Date: Fri Apr 1 23:34:40 2016 +0100 Merge pull request #1 from cosmy1/patch-1 Fix whitespaces in Material commit c398e82153ac0d0ab2b29f61d4345d747be3d40c Author: cosmy1 <cosmy_rulezz@hotmail.it> Date: Sat Apr 2 00:33:27 2016 +0200 Fix whitespaces in Material commit a5b6b93b96a053f304b7326b4fa3930d60195051 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Fri Apr 1 21:33:52 2016 +0100 fixed indentation commit 5b402e75092e680975435384ecb8b0af0292139d Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Fri Apr 1 21:32:35 2016 +0100 Fixed issue with deletion of wrong values commit 4ca39ec5bfb905621de8c80999cf640a8ad6d5e0 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Fri Apr 1 21:28:59 2016 +0100 removed nolonger needed licence commit d2ab0f9a048d594d7115c41c2dbea2ce2d39e31b Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Fri Apr 1 21:28:18 2016 +0100 Improve PBR and moved forward PBR into new shader commit cdaae6e2cf234f28cef90f244e2e24e6b7d0d915 Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Fri Apr 1 21:26:57 2016 +0100 Removed remaining area lighting and fixed pbr in deferred rendering commit 6fca9d3b98fc2cacea2a11129eb1fc69a7e2fd2f Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Fri Apr 1 13:19:48 2016 +0100 Replaced data folder with one from mater to avoid commit revert errors commit 543c30f0b3b035df13ce09cc127117fb160bfe5f Author: dragonCASTjosh <dragonCASTjosh@gmail.com> Date: Thu Mar 31 20:52:47 2016 +0100 Complete PBR work
117 lines
4.1 KiB
HLSL
117 lines
4.1 KiB
HLSL
#ifdef D3D11
|
|
// Make sampling macros also available for VS on D3D11
|
|
#define Sample2D(tex, uv) t##tex.Sample(s##tex, uv)
|
|
#define Sample2DProj(tex, uv) t##tex.Sample(s##tex, uv.xy / uv.w)
|
|
#define Sample2DLod0(tex, uv) t##tex.SampleLevel(s##tex, uv, 0.0)
|
|
#define SampleCube(tex, uv) t##tex.Sample(s##tex, uv)
|
|
#define SampleCubeLOD(tex, uv) t##tex.SampleLevel(s##tex, uv.xyz, uv.w)
|
|
#define SampleShadow(tex, uv) t##tex.SampleCmpLevelZero(s##tex, uv.xy, uv.z)
|
|
#endif
|
|
|
|
#ifdef COMPILEPS
|
|
|
|
#ifndef D3D11
|
|
|
|
// D3D9 samplers
|
|
sampler2D sDiffMap : register(s0);
|
|
samplerCUBE sDiffCubeMap : register(s0);
|
|
sampler2D sAlbedoBuffer : register(s0);
|
|
sampler2D sNormalMap : register(s1);
|
|
sampler2D sNormalBuffer : register(s1);
|
|
sampler2D sSpecMap : register(s2);
|
|
sampler2D sRoughMetalFresnel : register(s2); //R: Roughness, G: Metal
|
|
sampler2D sEmissiveMap : register(s3);
|
|
sampler2D sEnvMap : register(s4);
|
|
sampler3D sVolumeMap : register(s5);
|
|
samplerCUBE sEnvCubeMap : register(s4);
|
|
sampler2D sLightRampMap : register(s8);
|
|
sampler2D sLightSpotMap : register(s9);
|
|
samplerCUBE sLightCubeMap : register(s9);
|
|
sampler2D sShadowMap : register(s10);
|
|
samplerCUBE sFaceSelectCubeMap : register(s11);
|
|
samplerCUBE sIndirectionCubeMap : register(s12);
|
|
sampler2D sDepthBuffer : register(s13);
|
|
sampler2D sLightBuffer : register(s14);
|
|
samplerCUBE sZoneCubeMap : register(s15);
|
|
sampler3D sZoneVolumeMap : register(s15);
|
|
|
|
#define Sample2D(tex, uv) tex2D(s##tex, uv)
|
|
#define Sample2DProj(tex, uv) tex2Dproj(s##tex, uv)
|
|
#define Sample2DLod0(tex, uv) tex2Dlod(s##tex, float4(uv, 0.0, 0.0))
|
|
#define SampleCube(tex, uv) texCUBE(s##tex, uv)
|
|
#define SampleCubeLOD(tex, uv) texCUBElod(s##tex, uv)
|
|
#define SampleShadow(tex, uv) tex2Dproj(s##tex, uv)
|
|
|
|
#else
|
|
|
|
// D3D11 textures and samplers
|
|
|
|
Texture2D tDiffMap : register(t0);
|
|
TextureCube tDiffCubeMap : register(t0);
|
|
Texture2D tAlbedoBuffer : register(t0);
|
|
Texture2D tNormalMap : register(t1);
|
|
Texture2D tNormalBuffer : register(t1);
|
|
Texture2D tSpecMap : register(t2);
|
|
Texture2D tRoughMetalFresnel : register(t2); //R: Roughness, G: Metal
|
|
Texture2D tEmissiveMap : register(t3);
|
|
Texture2D tEnvMap : register(t4);
|
|
Texture3D tVolumeMap : register(t5);
|
|
TextureCube tEnvCubeMap : register(t4);
|
|
Texture2D tLightRampMap : register(t8);
|
|
Texture2D tLightSpotMap : register(t9);
|
|
TextureCube tLightCubeMap : register(t9);
|
|
Texture2D tShadowMap : register(t10);
|
|
TextureCube tFaceSelectCubeMap : register(t11);
|
|
TextureCube tIndirectionCubeMap : register(t12);
|
|
Texture2D tDepthBuffer : register(t13);
|
|
Texture2D tLightBuffer : register(t14);
|
|
TextureCube tZoneCubeMap : register(t15);
|
|
Texture3D tZoneVolumeMap : register(t15);
|
|
|
|
SamplerState sDiffMap : register(s0);
|
|
SamplerState sDiffCubeMap : register(s0);
|
|
SamplerState sAlbedoBuffer : register(s0);
|
|
SamplerState sNormalMap : register(s1);
|
|
SamplerState sNormalBuffer : register(s1);
|
|
SamplerState sSpecMap : register(s2);
|
|
SamplerState sRoughMetalFresnel : register(s2); //R: Roughness, G: Metal
|
|
SamplerState sEmissiveMap : register(s3);
|
|
SamplerState sEnvMap : register(s4);
|
|
SamplerState sVolumeMap : register(s5);
|
|
SamplerState sEnvCubeMap : register(s4);
|
|
SamplerState sLightRampMap : register(s8);
|
|
SamplerState sLightSpotMap : register(s9);
|
|
SamplerState sLightCubeMap : register(s9);
|
|
#ifdef VSM_SHADOW
|
|
SamplerState sShadowMap : register(s10);
|
|
#else
|
|
SamplerComparisonState sShadowMap : register(s10);
|
|
#endif
|
|
SamplerState sFaceSelectCubeMap : register(s11);
|
|
SamplerState sIndirectionCubeMap : register(s12);
|
|
SamplerState sDepthBuffer : register(s13);
|
|
SamplerState sLightBuffer : register(s14);
|
|
SamplerState sZoneCubeMap : register(s15);
|
|
SamplerState sZoneVolumeMap : register(s15);
|
|
|
|
#endif
|
|
|
|
float3 DecodeNormal(float4 normalInput)
|
|
{
|
|
#ifdef PACKEDNORMAL
|
|
float3 normal;
|
|
normal.xy = normalInput.ag * 2.0 - 1.0;
|
|
normal.z = sqrt(max(1.0 - dot(normal.xy, normal.xy), 0.0));
|
|
return normal;
|
|
#else
|
|
return normalInput.rgb * 2.0 - 1.0;
|
|
#endif
|
|
}
|
|
|
|
float ReconstructDepth(float hwDepth)
|
|
{
|
|
return dot(float2(hwDepth, cDepthReconstruct.y / (hwDepth - cDepthReconstruct.x)), cDepthReconstruct.zw);
|
|
}
|
|
|
|
#endif
|