浏览代码

HDRednerLoop: Fixed bad code to reconstruct world position

/main
sebastienlagarde 8 年前
当前提交
1065c023
共有 5 个文件被更改,包括 5 次插入24 次删除
  1. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  2. 1
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightingDeferred.shader
  3. 7
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/TemplateDisneyGGX.hlsl
  4. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightingDeferred.hlsl.meta
  5. 0
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightingDeferred.hlsl

12
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


Matrix4x4 GetViewProjectionMatrix(Camera camera)
{
// Calculate inverse projection matrix as this is not done by Unity
Matrix4x4 view = camera.worldToCameraMatrix;
Matrix4x4 proj = camera.projectionMatrix;
Matrix4x4 gpuProj = GL.GetGPUProjectionMatrix(proj, false);
Matrix4x4 gpuVP = gpuProj * view;
Matrix4x4 gpuProj = GL.GetGPUProjectionMatrix(camera.projectionMatrix, false);
Matrix4x4 gpuVP = gpuProj * camera.worldToCameraMatrix;
return camera.projectionMatrix * camera.worldToCameraMatrix;
return gpuVP;
}
void RenderDeferredLighting(Camera camera, RenderLoop renderLoop)

RenderDeferredLighting(camera, renderLoop);
RenderForward(cullResults, camera, renderLoop);
// RenderForward(cullResults, camera, renderLoop);
FinalPass(renderLoop);

1
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightingDeferred.shader


ForwardLighting(V, positionWS, bsdfData, diffuseLighting, specularLighting);
return float4(diffuseLighting.rgb + specularLighting.rgb, 1.0);
//return float4(positionWS.y / 10, 0, 0, 1.0);
}
ENDCG

7
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/TemplateDisneyGGX.hlsl


// regular normal
float3 normalWS = normalize(tangentToWorld[2].xyz);
#else
// Do mul martix
float3 tangent = tangentToWorld[0].xyz;
float3 binormal = tangentToWorld[1].xyz;
float3 normal = tangentToWorld[2].xyz;
float3 normalWS = normalize(tangent * normalTS.x + binormal * normalTS.y + normal * normalTS.z);
float3 normalWS = normalize(mul(normalTS, float3x3(tangentToWorld[0].xyz, tangentToWorld[1].xyz, tangentToWorld[2].xyz)));
#endif
return normalWS;

9
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightingDeferred.hlsl.meta


fileFormatVersion: 2
guid: 8ab751a0da67569489f8852db5423571
timeCreated: 1474899794
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

0
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/LightingDeferred.hlsl

正在加载...
取消
保存