浏览代码

Merge pixel and vertex locak object scale, they are identical and the feature are mutually exclusive

/stochastic_alpha_test
sebastienlagarde 7 年前
当前提交
4c55d7e9
共有 10 个文件被更改,包括 24 次插入35 次删除
  1. 6
      SampleScenes/HDTest/GraphicTest/Parallax Occlusion Mapping/Material/POM - Rock.mat
  2. 7
      SampleScenes/HDTest/GraphicTest/Parallax Occlusion Mapping/Material/POM - Wood.mat
  3. 6
      SampleScenes/HDTest/GraphicTest/Tessellation/Material/Tessellation - Rock.mat
  4. 7
      SampleScenes/HDTest/GraphicTest/Tessellation/Material/Tessellation - Wood.mat
  5. 3
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
  6. 3
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
  7. 3
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs
  8. 3
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
  9. 18
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
  10. 3
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader

6
SampleScenes/HDTest/GraphicTest/Parallax Occlusion Mapping/Material/POM - Rock.mat


m_PrefabInternal: {fileID: 0}
m_Name: POM - Rock
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _HEIGHTMAP _NORMALMAP _NORMALMAP_TANGENT_SPACE _PER_PIXEL_DISPLACEMENT
_PER_PIXEL_DISPLACEMENT_OBJECT_SCALE _PER_PIXEL_DISPLACEMENT_TILING_SCALE _PIXEL_DISPLACEMENT
_PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
m_ShaderKeywords: _DISPLACEMENT_LOCK_TILING_SCALE _HEIGHTMAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
_PER_PIXEL_DISPLACEMENT _PER_PIXEL_DISPLACEMENT_OBJECT_SCALE _PER_PIXEL_DISPLACEMENT_TILING_SCALE
_PIXEL_DISPLACEMENT _PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0

7
SampleScenes/HDTest/GraphicTest/Parallax Occlusion Mapping/Material/POM - Wood.mat


m_PrefabInternal: {fileID: 0}
m_Name: POM - Wood
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _DEPTHOFFSET_ON _HEIGHTMAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
_PER_PIXEL_DISPLACEMENT _PER_PIXEL_DISPLACEMENT_OBJECT_SCALE _PER_PIXEL_DISPLACEMENT_TILING_SCALE
_PIXEL_DISPLACEMENT _PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
m_ShaderKeywords: _DEPTHOFFSET_ON _DISPLACEMENT_LOCK_TILING_SCALE _HEIGHTMAP _NORMALMAP
_NORMALMAP_TANGENT_SPACE _PER_PIXEL_DISPLACEMENT _PER_PIXEL_DISPLACEMENT_OBJECT_SCALE
_PER_PIXEL_DISPLACEMENT_TILING_SCALE _PIXEL_DISPLACEMENT _PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE
_PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0

6
SampleScenes/HDTest/GraphicTest/Tessellation/Material/Tessellation - Rock.mat


m_PrefabInternal: {fileID: 0}
m_Name: Tessellation - Rock
m_Shader: {fileID: 4800000, guid: 756bac9090102564582875f4c7e30202, type: 3}
m_ShaderKeywords: _EMISSIVE_COLOR _HEIGHTMAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
_TESSELLATION_DISPLACEMENT _TESSELLATION_TILING_SCALE _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
_VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
m_ShaderKeywords: _DISPLACEMENT_LOCK_TILING_SCALE _EMISSIVE_COLOR _HEIGHTMAP _NORMALMAP
_NORMALMAP_TANGENT_SPACE _TESSELLATION_DISPLACEMENT _TESSELLATION_TILING_SCALE
_VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0

7
SampleScenes/HDTest/GraphicTest/Tessellation/Material/Tessellation - Wood.mat


m_PrefabInternal: {fileID: 0}
m_Name: Tessellation - Wood
m_Shader: {fileID: 4800000, guid: 756bac9090102564582875f4c7e30202, type: 3}
m_ShaderKeywords: _HEIGHTMAP _NORMALMAP _NORMALMAP_TANGENT_SPACE _TESSELLATION_DISPLACEMENT
_TESSELLATION_OBJECT_SCALE _TESSELLATION_TILING_SCALE _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
_VERTEX_DISPLACEMENT_LOCK_TILING_SCALE _VERTEX_DISPLACEMENT_OBJECT_SCALE _VERTEX_DISPLACEMENT_TILING_SCALE
m_ShaderKeywords: _DISPLACEMENT_LOCK_TILING_SCALE _HEIGHTMAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
_TESSELLATION_DISPLACEMENT _TESSELLATION_OBJECT_SCALE _TESSELLATION_TILING_SCALE
_VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
_VERTEX_DISPLACEMENT_OBJECT_SCALE _VERTEX_DISPLACEMENT_TILING_SCALE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0

3
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader


#pragma shader_feature _DOUBLESIDED_ON
#pragma shader_feature _ _VERTEX_DISPLACEMENT _PIXEL_DISPLACEMENT
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _VERTEX_WIND
#pragma shader_feature _LAYER_TILING_COUPLED_WITH_UNIFORM_OBJECT_SCALE

3
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader


#pragma shader_feature _DOUBLESIDED_ON
#pragma shader_feature _ _VERTEX_DISPLACEMENT _PIXEL_DISPLACEMENT _TESSELLATION_DISPLACEMENT
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _VERTEX_WIND
#pragma shader_feature _TESSELLATION_PHONG

3
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs


bool displacementLockTilingScale = material.GetFloat(kDisplacementLockTilingScale) > 0.0;
// Tessellation reuse vertex flag.
SetKeyword(material, "_VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE", displacementLockObjectScale && (enableVertexDisplacement || enableTessellationDisplacement));
SetKeyword(material, "_VERTEX_DISPLACEMENT_LOCK_TILING_SCALE", displacementLockTilingScale && (enableVertexDisplacement || enableTessellationDisplacement));
SetKeyword(material, "_PIXEL_DISPLACEMENT_LOCK_TILING_SCALE", displacementLockTilingScale && enablePixelDisplacement);
SetKeyword(material, "_DISPLACEMENT_LOCK_TILING_SCALE", displacementLockTilingScale && enableDisplacement);
bool windEnabled = material.GetFloat(kWindEnabled) > 0.0f;
SetKeyword(material, "_VERTEX_WIND", windEnabled);

3
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader


#pragma shader_feature _DOUBLESIDED_ON
#pragma shader_feature _ _VERTEX_DISPLACEMENT _PIXEL_DISPLACEMENT
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _VERTEX_WIND
#pragma shader_feature _ _REFRACTION_THINPLANE _REFRACTION_THICKPLANE _REFRACTION_THICKSPHERE

18
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl


}
// TODO: share this function with tessellation code.
float GetInverseTilingScale()
float GetHeightmapInverseTilingScale()
#ifdef _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
#ifdef _DISPLACEMENT_LOCK_TILING_SCALE
return _InvTilingScale
#if _MAPPING_PLANAR
* rcp(_TexWorldScale)

bool isTriplanar = layerTexCoord.base.mappingType == UV_MAPPING_TRIPLANAR;
// See comment in layered version for details
float maxHeight = GetMaxDisplacement() * GetInverseTilingScale();
float maxHeight = GetMaxDisplacement() * GetHeightmapInverseTilingScale();
float2 minUvSize = GetMinUvSize(layerTexCoord);
float lod = ComputeTextureLOD(minUvSize);

float ComputePerVertexDisplacement(LayerTexCoord layerTexCoord, float4 vertexColor, float lod)
{
float height = (SAMPLE_UVMAPPING_TEXTURE2D_LOD(_HeightMap, sampler_HeightMap, layerTexCoord.base, lod).r - _HeightCenter) * _HeightAmplitude;
#ifdef _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
// TODO: precompute these scaling factors!
float tilingScale = rcp(0.5 * abs(_BaseColorMap_ST.x) + 0.5 * abs(_BaseColorMap_ST.y));
height *= tilingScale;
#ifdef _MAPPING_PLANAR
height *= rcp(_TexWorldScale);
#endif
#endif
return height;
return height * GetHeightmapInverseTilingScale();
}
void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)

void ApplyDisplacementTileScale(inout float height0, inout float height1, inout float height2, inout float height3)
{
// When we change the tiling, we have want to conserve the ratio with the displacement (and this is consistent with per pixel displacement)
#if _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
#if _DISPLACEMENT_LOCK_TILING_SCALE
float tileObjectScale = 1.0;
#ifdef _LAYER_TILING_COUPLED_WITH_UNIFORM_OBJECT_SCALE
// Extract scaling from world transform

3
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader


#pragma shader_feature _DOUBLESIDED_ON
#pragma shader_feature _ _VERTEX_DISPLACEMENT _PIXEL_DISPLACEMENT _TESSELLATION_DISPLACEMENT
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
#pragma shader_feature _VERTEX_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _PIXEL_DISPLACEMENT_LOCK_TILING_SCALE
#pragma shader_feature _VERTEX_WIND
#pragma shader_feature _ _TESSELLATION_PHONG

正在加载...
取消
保存