浏览代码

Merge pull request #838 from Unity-Technologies/Add-instancing-property-view-mode

Add instancing property view mode
/main
GitHub 7 年前
当前提交
829ff2f1
共有 6 个文件被更改,包括 16 次插入15 次删除
  1. 13
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/UnityInstancing.hlsl
  2. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.hlsl
  3. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/MaterialDebug.cs
  4. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/MaterialDebug.cs.hlsl
  5. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassForward.hlsl
  6. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassForwardUnlit.hlsl

13
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/UnityInstancing.hlsl


#endif
#if defined(UNITY_INSTANCED_SH) && !defined(LIGHTMAP_ON)
//In HDRenderpipe we only decide to look at probe data based on Lightmap flags.
#if !defined(DYNAMICLIGHTMAP_ON)
#if !defined(DYNAMICLIGHTMAP_ON)
#define UNITY_USE_SHCOEFFS_ARRAYS
#endif
#if defined(SHADOWS_SHADOWMASK)

#undef UNITY_MATRIX_I_M
#define UNITY_MATRIX_I_M UNITY_ACCESS_INSTANCED_PROP(MERGE_UNITY_BUILTINS_INDEX(UNITY_WORLDTOOBJECTARRAY_CB), unity_WorldToObjectArray)
inline float4 UnityObjectToClipPosInstanced(in float3 pos)
{
return mul(UNITY_MATRIX_VP, mul(UNITY_MATRIX_M, float4(pos, 1.0)));
}
inline float4 UnityObjectToClipPosInstanced(float4 pos)
{
return UnityObjectToClipPosInstanced(pos.xyz);
}
#define UnityObjectToClipPos UnityObjectToClipPosInstanced
#else // UNITY_INSTANCING_ENABLED

9
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.hlsl


#include "MipMapDebug.cs.hlsl"
#include "ColorPickerDebug.cs.hlsl"
CBUFFER_START(UnityDebugDisplay)
// Set of parameters available when switching to debug shader mode
int _DebugLightingMode; // Match enum DebugLightingMode
int _DebugViewMaterial; // Contain the id (define in various materialXXX.cs.hlsl) of the property to display

float4 _MousePixelCoord; // xy unorm, zw norm
CBUFFER_END
TEXTURE2D(_DebugFont); // Debug font to write string in shader

#endif
break;
case DEBUGVIEWPROPERTIES_INSTANCING:
#if defined(UNITY_INSTANCING_ENABLED)
result = float3(1.0, 0.0, 0.0);
#else
result = float3(0.0, 0.0, 0.0);
#endif
break;
}
}

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/MaterialDebug.cs


TessellationDisplacement,
DepthOffset,
Lightmap,
Instancing,
Last,
}
}

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/MaterialDebug.cs.hlsl


#define DEBUGVIEWPROPERTIES_TESSELLATION_DISPLACEMENT (19)
#define DEBUGVIEWPROPERTIES_DEPTH_OFFSET (20)
#define DEBUGVIEWPROPERTIES_LIGHTMAP (21)
#define DEBUGVIEWPROPERTIES_LAST (22)
#define DEBUGVIEWPROPERTIES_INSTANCING (22)
#define DEBUGVIEWPROPERTIES_LAST (23)
#endif

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassForward.hlsl


GetVaryingsDataDebug(_DebugViewMaterial, input, result, needLinearToSRGB);
GetBuiltinDataDebug(_DebugViewMaterial, builtinData, result, needLinearToSRGB);
GetSurfaceDataDebug(_DebugViewMaterial, surfaceData, result, needLinearToSRGB);
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB); // TODO: This required to initialize all field from BSDFData...
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB);
// TEMP!
// For now, the final blit in the backbuffer performs an sRGB write

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassForwardUnlit.hlsl


GetPropertiesDataDebug(_DebugViewMaterial, result, needLinearToSRGB);
GetVaryingsDataDebug(_DebugViewMaterial, input, result, needLinearToSRGB);
GetBuiltinDataDebug(_DebugViewMaterial, builtinData, result, needLinearToSRGB);
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB); // TODO: This required to initialize all field from BSDFData...
GetSurfaceDataDebug(_DebugViewMaterial, surfaceData, result, needLinearToSRGB);
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB);
// TEMP!
// For now, the final blit in the backbuffer performs an sRGB write

正在加载...
取消
保存