浏览代码

prepare for available emission

prepare for available emission and remove emission buffer as source
/main
mmikk 8 年前
当前提交
aca1be24
共有 4 个文件被更改,包括 15 次插入5 次删除
  1. 4
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
  2. 10
      Assets/ScriptableRenderLoop/fptl/Internal-DeferredShading.shader
  3. 3
      Assets/ScriptableRenderLoop/fptl/lightlistbuild.compute
  4. 3
      Assets/ScriptableRenderLoop/fptl/scrbound.compute

4
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


//cmd.Blit (kGBufferNormal, (RenderTexture)null); // debug: display normals
cmd.Blit(kGBufferEmission, kCameraTarget, m_DeferredMaterial, 0);
cmd.Blit(kGBufferEmission, kCameraTarget, m_DeferredReflectionMaterial, 0);
cmd.Blit(0, kCameraTarget, m_DeferredMaterial, 0);
cmd.Blit(0, kCameraTarget, m_DeferredReflectionMaterial, 0);
// Set the intermediate target for compositing (skybox, etc)
cmd.SetRenderTarget(new RenderTargetIdentifier(kCameraTarget), new RenderTargetIdentifier(kCameraDepthTexture));

10
Assets/ScriptableRenderLoop/fptl/Internal-DeferredShading.shader


Texture2D _CameraGBufferTexture0;
Texture2D _CameraGBufferTexture1;
Texture2D _CameraGBufferTexture2;
Texture2D _CameraGBufferTexture3;
struct v2f {

float3 diffuseColor;
float3 normalWorld;
float smoothness;
float3 emission;
};
struct LocalDataBRDF

static LocalDataBRDF g_localParams;
StandardData UnityStandardDataFromGbuffer(float4 gbuffer0, float4 gbuffer1, float4 gbuffer2)
StandardData UnityStandardDataFromGbuffer(float4 gbuffer0, float4 gbuffer1, float4 gbuffer2, float4 gbuffer3)
{
StandardData data;

float ao = gbuffer0.a;
data.emission = gbuffer3.xyz;
return data;
}

float4 gbuffer0 = _CameraGBufferTexture0.Load( uint3(pixCoord.xy, 0) );
float4 gbuffer1 = _CameraGBufferTexture1.Load( uint3(pixCoord.xy, 0) );
float4 gbuffer2 = _CameraGBufferTexture2.Load( uint3(pixCoord.xy, 0) );
float4 gbuffer3 = _CameraGBufferTexture3.Load( uint3(pixCoord.xy, 0) );
StandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2);
StandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2, gbuffer3);
g_localParams.gbuf = data;
g_localParams.oneMinusReflectivity = 1.0 - SpecularStrength(data.specularColor.rgb);

float3 c = ExecuteLightListTiled(numLightsProcessed, pixCoord, vP, vPw, Vworld);
float3 c = /*data.emission +*/ ExecuteLightListTiled(numLightsProcessed, pixCoord, vP, vPw, Vworld);
//c = OverlayHeatMap(numLightsProcessed, c);
return float4(c,1.0);

3
Assets/ScriptableRenderLoop/fptl/lightlistbuild.compute


// The implementation is based on the demo on "fine pruned tiled lighting" published in GPU Pro 7.
// https://github.com/wolfgangfengel/GPU-Pro-7
#pragma kernel TileLightListGen
#include "..\common\ShaderBase.h"

3
Assets/ScriptableRenderLoop/fptl/scrbound.compute


// The implementation is based on the demo on "fine pruned tiled lighting" published in GPU Pro 7.
// https://github.com/wolfgangfengel/GPU-Pro-7
#pragma kernel ScreenBoundsAABB
#include "..\common\ShaderBase.h"

正在加载...
取消
保存