浏览代码

HDRenderLoop: SinglePAss work but Tile is broken...

/main
Sebastien Lagarde 8 年前
当前提交
1b338186
共有 4 个文件被更改,包括 30 次插入17 次删除
  1. 13
      Assets/ScriptableRenderLoop/HDRenderLoop/Debug/Resources/DebugViewTiles.shader
  2. 6
      Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs
  3. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  4. 26
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePassLoop.hlsl

13
Assets/ScriptableRenderLoop/HDRenderLoop/Debug/Resources/DebugViewTiles.shader


#endif
int n = 0;
for(int category = 0; category < LIGHTCATEGORY_COUNT; category++)
for (int category = 0; category < LIGHTCATEGORY_COUNT; category++)
uint start;
uint count;
GetCountAndStart(coord, category, linearDepth, start, count);
n += count;
if (mask & _ViewTilesFlags)
{
uint start;
uint count;
GetCountAndStart(coord, category, linearDepth, start, count);
n += count;
}
}
if (n > 0)

6
Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs


public readonly GUIContent useForwardRenderingOnly = new GUIContent("Use Forward Rendering Only");
public readonly GUIContent useDepthPrepass = new GUIContent("Use Depth Prepass");
public readonly GUIContent useSinglePassLightLoop = new GUIContent("Use single Pass light loop");
public bool isDebugViewMaterialInit = false;
public GUIContent[] debugViewMaterialStrings = null;

public readonly GUIContent shadowsCascades = new GUIContent("Cascade values");
public readonly GUIContent tileLightLoopSettings = new GUIContent("Tile Light Loop settings");
public readonly string[] tileLightLoopDebugTileFlagStrings = new string[] { "Direct Light", "Reflection Light", "Area Light"};
public readonly GUIContent splitLightEvaluation = new GUIContent("Enable direct and indirect lighting in single pass", "Toggle");
public readonly string[] tileLightLoopDebugTileFlagStrings = new string[] { "Punctual Light", "Area Light", "Env Light"};
public readonly GUIContent splitLightEvaluation = new GUIContent("Split light and reflection evaluation", "Toggle");
public readonly GUIContent bigTilePrepass = new GUIContent("Enable big tile prepass", "Toggle");
public readonly GUIContent clustered = new GUIContent("Enable clustered", "Toggle");
public readonly GUIContent disableTileAndCluster = new GUIContent("Disable Tile/clustered", "Toggle");

debugParameters.displayTransparentObjects = EditorGUILayout.Toggle(styles.displayTransparentObjects, debugParameters.displayTransparentObjects);
debugParameters.useForwardRenderingOnly = EditorGUILayout.Toggle(styles.useForwardRenderingOnly, debugParameters.useForwardRenderingOnly);
debugParameters.useDepthPrepass = EditorGUILayout.Toggle(styles.useDepthPrepass, debugParameters.useDepthPrepass);
debugParameters.useSinglePassLightLoop = EditorGUILayout.Toggle(styles.useSinglePassLightLoop, debugParameters.useSinglePassLightLoop);
if (EditorGUI.EndChangeCheck())
{

2
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


public bool enableTonemap = true;
public float exposure = 0;
public bool useSinglePassLightLoop = true;
}
DebugParameters m_DebugParameters = new DebugParameters();

26
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePassLoop.hlsl


#endif
#ifdef PROCESS_ENV_LIGHT
uint envLightStart;
uint envLightCount;
GetCountAndStart(coord, LIGHTCATEGORY_ENV, linearDepth, envLightStart, envLightCount);
// Only apply sky IBL if the sky texture is available.
if (_EnvLightSkyEnabled)
{
float3 localDiffuseLighting, localSpecularLighting;
float2 weight;
// The sky is a single cubemap texture separate from the reflection probe texture array (different resolution and compression)
context.sampleReflection = SINGLE_PASS_CONTEXT_SAMPLE_SKY;
EnvLightData envLightSky = InitSkyEnvLightData(0); // The sky data are generated on the fly so the compiler can optimize the code
EvaluateBSDF_Env(context, V, positionWS, prelightData, envLightSky, bsdfData, localDiffuseLighting, localSpecularLighting, weight);
iblDiffuseLighting = lerp(iblDiffuseLighting, localDiffuseLighting, weight.x); // Should be remove by the compiler if it is smart as all is constant 0
iblSpecularLighting = lerp(iblSpecularLighting, localSpecularLighting, weight.y);
}
uint envLightStart;
uint envLightCount;
GetCountAndStart(coord, LIGHTCATEGORY_ENV, linearDepth, envLightStart, envLightCount);
for (i = 0; i < envLightCount; ++i)
{
float3 localDiffuseLighting, localSpecularLighting;

specularLighting += iblSpecularLighting;
#endif
// Currently do lightmap with indirect specula
// TODO: test what is the most appropriate here...
#ifdef PROCESS_ENV_LIGHT
// TODO: HACK: to avoid the message Fragment program 'Frag': sampler 'sampler_PreIntegratedFGD' has no matching texture and will be undefined.
// we sample the GI during direct lighting, so FGD texture is used...
#ifdef LIGHTLOOP_TILE_DIRECT
// Add indirect diffuse + emissive (if any)
diffuseLighting += bakeDiffuseLighting;
#endif

正在加载...
取消
保存