浏览代码

update lightprobe scene to test PerMaterial persistent buffer (all materials has different _BaseColor)

/batch_rendering
Arnaud Carre 8 年前
当前提交
e0c0338a
共有 16 个文件被更改,包括 87 次插入92 次删除
  1. 4
      Assets/BasicRenderBatching/BasicRenderBatching.cs
  2. 3
      Assets/BasicRenderBatching/BasicRenderBatchingShader8.shader
  3. 2
      Assets/BasicRenderBatching/BasicRenderBatchingShaderFlat.shader
  4. 4
      Assets/BasicRenderBatching/Prefabs/Capsule.prefab
  5. 4
      Assets/BasicRenderBatching/Prefabs/cube.prefab
  6. 4
      Assets/BasicRenderBatching/Prefabs/cylinder.prefab
  7. 4
      Assets/BasicRenderBatching/Prefabs/sphere.prefab
  8. 2
      Assets/BasicRenderBatching/Scripts/PopulateScene.cs
  9. 1
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.shader
  10. 125
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitProperties.hlsl
  11. 13
      Assets/TestScenes/HDTest/Editor/Generator.cs
  12. 4
      ProjectSettings/EditorBuildSettings.asset
  13. 9
      Assets/TestScenes/HDTest/Leaf.meta

4
Assets/BasicRenderBatching/BasicRenderBatching.cs


var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("BasicPass"));
settings.sorting.flags = SortFlags.CommonOpaque;
settings.inputFilter.SetQueuesOpaque();
// context.DrawRenderers(ref settings);
context.DrawRenderers(settings);
// Draw skybox
context.DrawSkybox(camera);

settings.inputFilter.SetQueuesTransparent();
// context.DrawRenderers(ref settings);
context.DrawRenderers(settings);
context.Submit();
}

3
Assets/BasicRenderBatching/BasicRenderBatchingShader8.shader


float4 globalSH[7];
CBUFFER_END
CBUFFER_START(UniformBuffer_FastBatch : register(b1) )
CBUFFER_START(simplebufferTest)
float4 myColor;
CBUFFER_END

2
Assets/BasicRenderBatching/BasicRenderBatchingShaderFlat.shader


float4 globalSH[7];
CBUFFER_END
CBUFFER_START(UniformBuffer_FastBatch : register(b1) )
CBUFFER_START(testmybuffer)
float4 myColor;
CBUFFER_END

4
Assets/BasicRenderBatching/Prefabs/Capsule.prefab


m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 2
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}
m_StaticBatchInfo:

4
Assets/BasicRenderBatching/Prefabs/cube.prefab


m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 2
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}
m_StaticBatchInfo:

4
Assets/BasicRenderBatching/Prefabs/cylinder.prefab


m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 2
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}
m_StaticBatchInfo:

4
Assets/BasicRenderBatching/Prefabs/sphere.prefab


m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 2
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}
m_StaticBatchInfo:

2
Assets/BasicRenderBatching/Scripts/PopulateScene.cs


}
renderer.material = mat;
renderer.material.InitUniformBuffers();
// renderer.material.InitUniformBuffers();
m_Materials[iIndex] = renderer.material;
iIndex++;

1
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.shader


#pragma target 4.5
#pragma only_renderers d3d11 ps4 metal // TEMP: until we go futher in dev
#pragma enable_d3d11_debug_symbols
//-------------------------------------------------------------------------------------
// Variant

125
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitProperties.hlsl


#ifndef LAYERED_LIT_SHADER
// Set of users variables
float4 _BaseColor;
TEXTURE2D(_BaseColorMap);
SAMPLER2D(sampler_BaseColorMap);
float4 _BaseColorMap_ST;
CBUFFER_START(_PerMaterial)
float _Metallic;
float _Smoothness;
TEXTURE2D(_MaskMap);
SAMPLER2D(sampler_MaskMap);
TEXTURE2D(_SpecularOcclusionMap);
SAMPLER2D(sampler_SpecularOcclusionMap);
// Set of users variables
float4 _BaseColor;
TEXTURE2D(_BaseColorMap);
SAMPLER2D(sampler_BaseColorMap);
float4 _BaseColorMap_ST;
TEXTURE2D(_NormalMap);
SAMPLER2D(sampler_NormalMap);
float _NormalScale;
float _Metallic;
float _Smoothness;
TEXTURE2D(_MaskMap);
SAMPLER2D(sampler_MaskMap);
TEXTURE2D(_SpecularOcclusionMap);
SAMPLER2D(sampler_SpecularOcclusionMap);
TEXTURE2D(_DetailMask);
SAMPLER2D(sampler_DetailMask);
TEXTURE2D(_DetailMap);
SAMPLER2D(sampler_DetailMap);
float4 _DetailMap_ST;
float _DetailAlbedoScale;
float _DetailNormalScale;
float _DetailSmoothnessScale;
float _DetailHeightScale;
float _DetailAOScale;
TEXTURE2D(_NormalMap);
SAMPLER2D(sampler_NormalMap);
float _NormalScale;
TEXTURE2D(_DetailMask);
SAMPLER2D(sampler_DetailMask);
TEXTURE2D(_DetailMap);
SAMPLER2D(sampler_DetailMap);
float4 _DetailMap_ST;
float _DetailAlbedoScale;
float _DetailNormalScale;
float _DetailSmoothnessScale;
float _DetailHeightScale;
float _DetailAOScale;
TEXTURE2D(_HeightMap);
SAMPLER2D(sampler_HeightMap);
float4 _HeightMap_TexelSize; // Unity facility. This will provide the size of the heightmap to the shader
TEXTURE2D(_HeightMap);
SAMPLER2D(sampler_HeightMap);
float4 _HeightMap_TexelSize; // Unity facility. This will provide the size of the heightmap to the shader
float _HeightAmplitude;
float _HeightCenter;
float _HeightAmplitude;
float _HeightCenter;
TEXTURE2D(_TangentMap);
SAMPLER2D(sampler_TangentMap);
TEXTURE2D(_TangentMap);
SAMPLER2D(sampler_TangentMap);
float _Anisotropy;
TEXTURE2D(_AnisotropyMap);
SAMPLER2D(sampler_AnisotropyMap);
float _Anisotropy;
TEXTURE2D(_AnisotropyMap);
SAMPLER2D(sampler_AnisotropyMap);
//float _SubSurfaceRadius;
//TEXTURE2D(_SubSurfaceRadiusMap);
//SAMPLER2D(sampler_SubSurfaceRadiusMap);
//float _SubSurfaceRadius;
//TEXTURE2D(_SubSurfaceRadiusMap);
//SAMPLER2D(sampler_SubSurfaceRadiusMap);
// float _Thickness;
//TEXTURE2D(_ThicknessMap);
//SAMPLER2D(sampler_ThicknessMap);
// float _Thickness;
//TEXTURE2D(_ThicknessMap);
//SAMPLER2D(sampler_ThicknessMap);
// float _CoatCoverage;
//TEXTURE2D(_CoatCoverageMap);
//SAMPLER2D(sampler_CoatCoverageMap);
// float _CoatCoverage;
//TEXTURE2D(_CoatCoverageMap);
//SAMPLER2D(sampler_CoatCoverageMap);
// float _CoatRoughness;
//TEXTURE2D(_CoatRoughnessMap);
//SAMPLER2D(sampler_CoatRoughnessMap);
// float _CoatRoughness;
//TEXTURE2D(_CoatRoughnessMap);
//SAMPLER2D(sampler_CoatRoughnessMap);
TEXTURE2D(_DiffuseLightingMap);
SAMPLER2D(sampler_DiffuseLightingMap);
TEXTURE2D(_DiffuseLightingMap);
SAMPLER2D(sampler_DiffuseLightingMap);
TEXTURE2D(_DistortionVectorMap);
SAMPLER2D(sampler_DistortionVectorMap);
TEXTURE2D(_DistortionVectorMap);
SAMPLER2D(sampler_DistortionVectorMap);
float3 _EmissiveColor;
TEXTURE2D(_EmissiveColorMap);
SAMPLER2D(sampler_EmissiveColorMap);
float _EmissiveIntensity;
float3 _EmissiveColor;
TEXTURE2D(_EmissiveColorMap);
SAMPLER2D(sampler_EmissiveColorMap);
float _EmissiveIntensity;
float _AlphaCutoff;
float _AlphaCutoff;
float _TexWorldScale;
float _UVMappingPlanar;
float4 _UVMappingMask;
float4 _UVDetailsMappingMask;
float _TexWorldScale;
float _UVMappingPlanar;
float4 _UVMappingMask;
float4 _UVDetailsMappingMask;
float _PPDMaxSamples;
float _PPDMinSamples;
float _PPDMaxSamples;
float _PPDMinSamples;
CBUFFER_END
#else // LAYERED_LIT_SHADER

13
Assets/TestScenes/HDTest/Editor/Generator.cs


Renderer renderer = obj.GetComponent<Renderer>();
// int matN = 0; // Random.Range(0, 4)
// Material mat = Material.Instantiate(m_MaterialPrefab[matN]);
int matN = 0; // Random.Range(0, 4)
Material mat = Material.Instantiate(m_MaterialPrefab[matN]);
Material mat = Material.Instantiate(chromeMat);
// Material mat = Material.Instantiate(chromeMat);
// Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
// mat.SetColor("myColor", oColor);
Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
mat.SetColor("_BaseColor", oColor);
// mat.SetTexture("_BaseColorMap", m_TexturesPrefab[Random.Range(0, 4)]);
mat.SetTexture("_BaseColorMap", m_TexturesPrefab[Random.Range(0, 4)]);
renderer.material = mat;

4
ProjectSettings/EditorBuildSettings.asset


path: Assets/TestScenes/HDTest/GlobalIlluminationTest.unity
- enabled: 0
path: Assets/BasicRenderBatching/LightingBatching.unity
- enabled: 0
path: Assets/BasicRenderBatching/LightingBatchingProbe.unity
path: Assets/BasicRenderBatching/LightingBatchingProbe.unity
- enabled: 0
path: Assets/BasicRenderBatching/LightingBatchingProxyVolume.unity
- enabled: 0
path: Assets/BasicRenderBatching/LightingBatchingReflectionProbe.unity

9
Assets/TestScenes/HDTest/Leaf.meta


fileFormatVersion: 2
guid: 01cfa4863006ad6499396fb0d4802c7e
folderAsset: yes
timeCreated: 1475755141
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存