浏览代码

Merge remote-tracking branch 'refs/remotes/origin/master' into Merge-FPTL

/main
sebastienlagarde 8 年前
当前提交
6a1b6e2f
共有 16 个文件被更改,包括 1068 次插入1029 次删除
  1. 15
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/LayeredLit/Editor/LayeredLitUI.cs
  2. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/LayeredLit/LayeredLit.shader
  3. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitData.hlsl
  4. 16
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitSharePass.hlsl
  5. 7
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/Layered.mat
  6. 1001
      Assets/TestScenes/HDTest/LayeredLitTest.unity
  7. 8
      Assets/TestScenes/HDTest/LayeredLitTest.unity.meta
  8. 9
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered.meta
  9. 8
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/Layered.mat.meta
  10. 8
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered.mat.meta
  11. 8
      Assets/TestScenes/HDTest/JulienTest.unity.meta
  12. 1001
      Assets/TestScenes/HDTest/JulienTest.unity
  13. 0
      /Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/LayerMask.tga
  14. 0
      /Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/LayerMask.tga.meta
  15. 0
      /Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/Layered.mat

15
Assets/ScriptableRenderLoop/HDRenderLoop/Material/LayeredLit/Editor/LayeredLitUI.cs


public readonly GUIContent syncButton = new GUIContent("Re-Synchronize Layers", "Re-synchronize all layers's properties with the referenced Material");
public readonly GUIContent layers = new GUIContent("Layers");
public readonly GUIContent emission = new GUIContent("Emissive");
public readonly GUIContent layerMapMask = new GUIContent("Layer Mask", "Layer mask (multiplied by vertex color)");
public readonly GUIContent layerMapMask = new GUIContent("Layer Mask", "Layer mask (multiplied by vertex color if enabled)");
public readonly GUIContent layerMapVertexColor = new GUIContent("Use Vertex Color", "Layer mask (multiplied by layer mask if enabled)");
public readonly GUIContent layerCount = new GUIContent("Layer Count", "Number of layers.");
public readonly GUIContent layerSize = new GUIContent("Size", "Size of the layer mapping in world units.");
public readonly GUIContent layerMapping = new GUIContent("Mapping", "Mapping mode of the layer.");

private const int kMaxLayerCount = 4;
private const int kSyncButtonWidth = 58;
private const string kLayerMaskMap = "_LayerMaskMap";
private const string kLayerMaskVertexColor = "_LayerMaskVertexColor";
private const string kLayerCount = "_LayerCount";
private const string kLayerMapping = "_LayerMapping";
private const string kLayerSize = "_LayerSize";

MaterialProperty layerCountProperty = null;
MaterialProperty layerMaskMapProperty = null;
MaterialProperty layerMaskVertexColorProperty = null;
MaterialProperty[] layerMappingProperty = new MaterialProperty[kMaxLayerCount];
MaterialProperty[] layerSizeProperty = new MaterialProperty[kMaxLayerCount];

bool layerChanged = false;
GUI.changed = false;
EditorGUI.indentLevel++;
GUILayout.Label(styles.layers, EditorStyles.boldLabel);

layerChanged = true;
}
m_MaterialEditor.ShaderProperty(layerMaskVertexColorProperty, styles.layerMapVertexColor);
m_MaterialEditor.TexturePropertySingleLine(styles.layerMapMask, layerMaskMapProperty);
for (int i = 0; i < layerCount; i++)

EditorGUI.indentLevel--;
layerChanged |= GUI.changed;
GUI.changed = false;
return layerChanged;
}

SetKeyword(material, "_HEIGHTMAP", material.GetTexture(kHeightMap + i));
}
SetKeyword(material, "_LAYERMASKMAP", material.GetTexture(kLayerMaskMap));
SetKeyword(material, "_LAYER_MASK_MAP", material.GetTexture(kLayerMaskMap));
SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR", material.GetFloat(kLayerMaskVertexColor) != 0.0f);
}
protected override void SetupEmissionGIFlags(Material material)

private void FindLayerProperties(MaterialProperty[] props)
{
layerMaskMapProperty = FindProperty(kLayerMaskMap, props);
layerMaskVertexColorProperty = FindProperty(kLayerMaskVertexColor, props);
layerCountProperty = FindProperty(kLayerCount, props);
for (int i = 0; i < layerCount; ++i)
{

4
Assets/ScriptableRenderLoop/HDRenderLoop/Material/LayeredLit/LayeredLit.shader


_LayerSize3("LayerSize3", Float) = 1.0
_LayerMaskMap("LayerMaskMap", 2D) = "white" {}
[ToggleOff] _LayerMaskVertexColor("Use Vertex Color Mask", Float) = 0.0
[ToggleOff] _DistortionOnly("Distortion Only", Float) = 0.0
[ToggleOff] _DistortionDepthTest("Distortion Only", Float) = 0.0

#pragma shader_feature _EMISSIVE_COLOR_MAP
#pragma shader_feature _HEIGHTMAP
#pragma shader_feature _HEIGHTMAP_AS_DISPLACEMENT
#pragma shader_feature _LAYERMASKMAP
#pragma shader_feature _LAYER_MASK_MAP
#pragma shader_feature _LAYER_MASK_VERTEX_COLOR
#pragma shader_feature _ _LAYEREDLIT_3_LAYERS _LAYEREDLIT_4_LAYERS
//#pragma shader_feature _ _LAYER_MAPPING_UV1_0 _LAYER_MAPPING_PLANAR_0 _LAYER_MAPPING_TRIPLANAR_0
//#pragma shader_feature _ _LAYER_MAPPING_UV1_1 _LAYER_MAPPING_PLANAR_1 _LAYER_MAPPING_TRIPLANAR_1

12
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitData.hlsl


ComputeLayerCoordinates(layerCoord, input);
// Mask Values : Layer 1, 2, 3 are r, g, b
float3 maskValues = float3(0.0, 0.0, 0.0);// input.vertexColor;
float3 maskValues = float3(0.0, 0.0, 0.0);
#ifdef _LAYERMASKMAP
#if defined(_LAYER_MASK_MAP)
#endif
#if defined(_LAYER_MASK_VERTEX_COLOR)
maskValues = input.vertexColor.rgb;
#endif
#if defined(_LAYER_MASK_MAP) && defined(_LAYER_MASK_VERTEX_COLOR)
maskValues = input.vertexColor.rgb * SAMPLE_TEXTURE2D(_LayerMaskMap, sampler_LayerMaskMap, input.texCoord0).rgb;
#endif
float weights[_MAX_LAYER];

16
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitSharePass.hlsl


float2 uv2 : TEXCOORD2;
#endif
float4 tangentOS : TANGENT; // Always present as we require it also in case of anisotropic lighting
float4 color : COLOR;
// UNITY_INSTANCE_ID
};

float2 texCoord2;
#endif
float3 tangentToWorld[3];
float4 color;
};
struct PackedVaryings

float4 interpolators[5] : TEXCOORD0;
float4 interpolators[6] : TEXCOORD0;
float4 interpolators[4] : TEXCOORD0;
float4 interpolators[5] : TEXCOORD0;
#endif
#if SHADER_STAGE_FRAGMENT

output.interpolators[1].w = input.texCoord0.y;
output.interpolators[2].w = input.texCoord1.x;
output.interpolators[3].w = input.texCoord1.y;
output.interpolators[4] = input.color;
output.interpolators[4] = float4(input.texCoord2.xy, 0.0, 0.0);
output.interpolators[5] = float4(input.texCoord2.xy, 0.0, 0.0);
#endif
return output;

output.texCoord0.xy = float2(input.interpolators[0].w, input.interpolators[1].w);
output.texCoord1.xy = float2(input.interpolators[2].w, input.interpolators[3].w);
output.vertexColor = input.interpolators[4];
output.texCoord2 = input.interpolators[4].xy;
output.texCoord2 = input.interpolators[5].xy;
#endif
#if SHADER_STAGE_FRAGMENT

output.tangentToWorld[0] = tangentToWorld[0];
output.tangentToWorld[1] = tangentToWorld[1];
output.tangentToWorld[2] = tangentToWorld[2];
output.color = input.color;
return PackVaryings(output);
}

7
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/Layered.mat


m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _LAYEREDLIT_4_LAYER _LAYEREDLIT_4_LAYERS _LAYERMASKMAP _LAYER_MAPPING_PLANAR0
_LAYER_MAPPING_PLANAR_0 _LAYER_MAPPING_PLANAR_1 _LAYER_MAPPING_UV1_2 _MASKMAP
_NORMALMAP _NORMALMAP_TANGENT_SPACE
_LAYER_MAPPING_PLANAR_0 _LAYER_MAPPING_PLANAR_1 _LAYER_MAPPING_UV1_2 _LAYER_MASK_VERTEX_COLOR
_MASKMAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _LayerMaskMap:
m_Texture: {fileID: 2800000, guid: 6b43fa9736beb354dba359b5d2ec3699, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:

- _LayerMapping1: 2
- _LayerMapping2: 1
- _LayerMapping3: 0
- _LayerMaskVertexColor: 1
- _LayerSize0: 4
- _LayerSize1: 4
- _LayerSize2: 1

1001
Assets/TestScenes/HDTest/LayeredLitTest.unity
文件差异内容过多而无法显示
查看文件

8
Assets/TestScenes/HDTest/LayeredLitTest.unity.meta


fileFormatVersion: 2
guid: 24eac3913fb63b147a2e2e6649ab56aa
timeCreated: 1479291192
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered.meta


fileFormatVersion: 2
guid: cabfe187baa4b2a448047e9ccb6bab31
folderAsset: yes
timeCreated: 1479292304
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

8
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/Layered.mat.meta


fileFormatVersion: 2
guid: 6e7fa39a7d1b15c4184c9f51d86eba22
timeCreated: 1479298680
licenseType: Pro
NativeFormatImporter:
userData: '{"GUIDArray":["01fa3be727161d249a81ad7065c15459","3acf8f156d29e494e8cd196462d1a17c","62b3c923bc540b94a803550e9927936a","c569253e641dc934db7c3595b31890da"]}'
assetBundleName:
assetBundleVariant:

8
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered.mat.meta


fileFormatVersion: 2
guid: 6e7fa39a7d1b15c4184c9f51d86eba22
timeCreated: 1478788268
licenseType: Pro
NativeFormatImporter:
userData: '{"GUIDArray":["01fa3be727161d249a81ad7065c15459","3acf8f156d29e494e8cd196462d1a17c","62b3c923bc540b94a803550e9927936a","c569253e641dc934db7c3595b31890da"]}'
assetBundleName:
assetBundleVariant:

8
Assets/TestScenes/HDTest/JulienTest.unity.meta


fileFormatVersion: 2
guid: 2f8109075b126c745a0b6a02aa1b07d6
timeCreated: 1475571359
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

1001
Assets/TestScenes/HDTest/JulienTest.unity
文件差异内容过多而无法显示
查看文件

/Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/LayerMask.tga → /Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/LayerMask.tga

/Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/LayerMask.tga.meta → /Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/LayerMask.tga.meta

/Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered.mat → /Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Layered/Layered.mat

正在加载...
取消
保存