浏览代码
Merge branch 'master' of https://github.com/Unity-Technologies/ScriptableRenderLoop into Branch_DebugMenu2
Merge branch 'master' of https://github.com/Unity-Technologies/ScriptableRenderLoop into Branch_DebugMenu2
# Conflicts: # Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs/RenderPassXR_Sandbox
Julien Ignace
8 年前
当前提交
205fb8de
共有 46 个文件被更改,包括 2602 次插入 和 1731 次删除
-
18Assets/GraphicsTests/RenderPipeline/LightweightPipeline/Assets/LDPipe_Shader/LDPipe_UnlitMat.mat
-
3Assets/GraphicsTests/RenderPipeline/LightweightPipeline/Assets/LDPipe_Shader/LDPipe_UnlitMatTexture.mat
-
102Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
-
41Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
-
94Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset
-
15Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs
-
91Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
35Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Builtin/BuiltinData.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
-
236Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs
-
72Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
-
5Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
998Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LtcData.DisneyDiffuse.cs
-
998Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LtcData.GGX.cs
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader
-
111Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Unlit.cs
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/RenderPipelineResources.cs
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/Resources/DrawSssProfile.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/Resources/DrawTransmittanceGraph.shader
-
28Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VaryingMesh.hlsl
-
38Assets/ScriptableRenderPipeline/HDRenderPipeline/Utilities.cs
-
83Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightPipelineUpgraders.cs
-
6Assets/ScriptableRenderPipeline/ShaderLibrary/CommonMaterial.hlsl
-
12Assets/TestScenes/HDTest/GraphicTest/Common/Dragon/DragonStatueSpecular.mat
-
999ImageTemplates/LightweightPipeline/Scenes/Shaders/LDPipe_LitShaderMaps.unity.png
-
2ProjectSettings/GraphicsSettings.asset
-
23Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/RenderPipelineMaterial.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/RenderPipelineMaterial.cs.meta
-
53Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightShaderHelper.cs
-
12Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightShaderHelper.cs.meta
-
9Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI.meta
-
81Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader
-
9Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader.meta
-
68Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightUnlitGUI.cs
-
12Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightUnlitGUI.cs.meta
-
0/Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightPipelineMaterialEditor.cs.meta
-
0/Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightPipelineMaterialEditor.cs
998
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LtcData.DisneyDiffuse.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
998
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LtcData.GGX.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
999
ImageTemplates/LightweightPipeline/Scenes/Shaders/LDPipe_LitShaderMaps.unity.png
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class RenderPipelineMaterial : Object |
|||
{ |
|||
// GBuffer management
|
|||
public virtual int GetMaterialGBufferCount() { return 0; } |
|||
public virtual void GetMaterialGBufferDescription(out RenderTextureFormat[] RTFormat, out RenderTextureReadWrite[] RTReadWrite) |
|||
{ |
|||
RTFormat = null; |
|||
RTReadWrite = null; |
|||
} |
|||
|
|||
// Regular interface
|
|||
public virtual void Build(RenderPipelineResources renderPipelineResources) {} |
|||
public virtual void Cleanup() {} |
|||
|
|||
// Following function can be use to initialize GPU resource (once or each frame) and bind them
|
|||
public virtual void RenderInit(Rendering.ScriptableRenderContext renderContext) {} |
|||
public virtual void Bind() {} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7c168d89b1622cd479edd36df0a8869e |
|||
timeCreated: 1496530306 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.LightweightPipeline |
|||
{ |
|||
public static class LightweightShaderHelper |
|||
{ |
|||
public static void SetMaterialBlendMode(Material material) |
|||
{ |
|||
UpgradeBlendMode mode = (UpgradeBlendMode) material.GetFloat("_Mode"); |
|||
switch (mode) |
|||
{ |
|||
case UpgradeBlendMode.Opaque: |
|||
material.SetOverrideTag("RenderType", ""); |
|||
material.SetInt("_SrcBlend", (int) UnityEngine.Rendering.BlendMode.One); |
|||
material.SetInt("_DstBlend", (int) UnityEngine.Rendering.BlendMode.Zero); |
|||
material.SetInt("_ZWrite", 1); |
|||
SetKeyword(material, "_ALPHATEST_ON", false); |
|||
SetKeyword(material, "_ALPHABLEND_ON", false); |
|||
material.renderQueue = -1; |
|||
break; |
|||
|
|||
case UpgradeBlendMode.Cutout: |
|||
material.SetOverrideTag("RenderType", "Transparent"); |
|||
material.SetInt("_SrcBlend", (int) UnityEngine.Rendering.BlendMode.One); |
|||
material.SetInt("_DstBlend", (int) UnityEngine.Rendering.BlendMode.Zero); |
|||
material.SetInt("_ZWrite", 1); |
|||
SetKeyword(material, "_ALPHATEST_ON", true); |
|||
SetKeyword(material, "_ALPHABLEND_ON", false); |
|||
material.renderQueue = (int) RenderQueue.AlphaTest; |
|||
break; |
|||
|
|||
case UpgradeBlendMode.Alpha: |
|||
material.SetOverrideTag("RenderType", "Transparent"); |
|||
material.SetInt("_SrcBlend", (int) UnityEngine.Rendering.BlendMode.SrcAlpha); |
|||
material.SetInt("_DstBlend", (int) UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); |
|||
material.SetInt("_ZWrite", 0); |
|||
SetKeyword(material, "_ALPHATEST_ON", false); |
|||
SetKeyword(material, "_ALPHABLEND_ON", true); |
|||
material.renderQueue = (int) RenderQueue.Transparent; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public static void SetKeyword(Material material, string keyword, bool enable) |
|||
{ |
|||
if (enable) |
|||
material.EnableKeyword(keyword); |
|||
else |
|||
material.DisableKeyword(keyword); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 673aad8cdc228cf499f7974fb673fa10 |
|||
timeCreated: 1496821330 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c8b417f54d2314549995022591d5454f |
|||
folderAsset: yes |
|||
timeCreated: 1496821940 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Shader "ScriptableRenderPipeline/LightweightPipeline/Unlit" |
|||
{ |
|||
Properties |
|||
{ |
|||
_MainTex("Texture", 2D) = "white" {} |
|||
_MainColor("MainColor", Color) = (1, 1, 1, 1) |
|||
_Cutoff("AlphaCutout", Range(0.0, 1.0)) = 0.5 |
|||
|
|||
// BlendMode |
|||
[HideInInspector] _Mode("Mode", Float) = 0.0 |
|||
[HideInInspector] _SrcBlend("Src", Float) = 1.0 |
|||
[HideInInspector] _DstBlend("Dst", Float) = 0.0 |
|||
[HideInInspector] _ZWrite("ZWrite", Float) = 1.0 |
|||
} |
|||
SubShader |
|||
{ |
|||
Tags { "RenderType" = "Opaque" "IgnoreProjectors" = "True" "RenderPipeline" = "LightweightPipe" "Lightmode" = "LightweightForward" } |
|||
LOD 100 |
|||
|
|||
Blend [_SrcBlend][_DstBlend] |
|||
ZWrite [_ZWrite] |
|||
|
|||
Pass |
|||
{ |
|||
CGPROGRAM |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
#pragma multi_compile_fog |
|||
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
struct appdata |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
}; |
|||
|
|||
struct v2f |
|||
{ |
|||
float2 uv : TEXCOORD0; |
|||
UNITY_FOG_COORDS(1) |
|||
float4 vertex : SV_POSITION; |
|||
}; |
|||
|
|||
sampler2D _MainTex; |
|||
float4 _MainTex_ST; |
|||
half4 _MainColor; |
|||
half _Cutoff; |
|||
|
|||
v2f vert(appdata v) |
|||
{ |
|||
v2f o; |
|||
o.vertex = UnityObjectToClipPos(v.vertex); |
|||
o.uv = TRANSFORM_TEX(v.uv, _MainTex); |
|||
UNITY_TRANSFER_FOG(o,o.vertex); |
|||
return o; |
|||
} |
|||
|
|||
fixed4 frag(v2f i) : SV_Target |
|||
{ |
|||
fixed4 texColor = tex2D(_MainTex, i.uv); |
|||
fixed alpha = texColor.a * _MainColor.a; |
|||
fixed3 color = texColor.rgb * _MainColor.rgb; |
|||
|
|||
#ifdef _ALPHATEST_ON |
|||
clip(alpha - _Cutoff); |
|||
#endif |
|||
UNITY_APPLY_FOG(i.fogCoord, color); |
|||
|
|||
#ifdef _ALPHABLEND_ON |
|||
return fixed4(color, alpha); |
|||
#else |
|||
return fixed4(color, 1.0); |
|||
#endif |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
CustomEditor "LightweightUnlitGUI" |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 650dd9526735d5b46b79224bc6e94025 |
|||
timeCreated: 1496762173 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
using UnityEditor.Experimental.Rendering.LightweightPipeline; |
|||
|
|||
public class LightweightUnlitGUI : ShaderGUI |
|||
{ |
|||
private MaterialProperty blendModeProp = null; |
|||
private MaterialProperty mainTexProp = null; |
|||
private MaterialProperty mainColorProp = null; |
|||
private MaterialProperty alphaCutoffProp = null; |
|||
|
|||
private MaterialEditor m_MaterialEditor = null; |
|||
|
|||
private static class Styles |
|||
{ |
|||
public static GUIContent[] mainTexLabels = |
|||
{ |
|||
new GUIContent("MainTex (RGB)", "Base Color"), |
|||
new GUIContent("MainTex (RGB) Alpha (A)", "Base Color and Alpha") |
|||
}; |
|||
|
|||
public static readonly string[] blendNames = Enum.GetNames(typeof(UpgradeBlendMode)); |
|||
|
|||
public static string renderingModeLabel = "Rendering Mode"; |
|||
public static string alphaCutoffLabel = "Alpha Cutoff"; |
|||
} |
|||
|
|||
private void FindMaterialProperties(MaterialProperty[] properties) |
|||
{ |
|||
blendModeProp = FindProperty("_Mode", properties); |
|||
mainTexProp = FindProperty("_MainTex", properties); |
|||
mainColorProp = FindProperty("_MainColor", properties); |
|||
alphaCutoffProp = FindProperty("_Cutoff", properties); |
|||
} |
|||
|
|||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) |
|||
{ |
|||
Material material = materialEditor.target as Material; |
|||
m_MaterialEditor = materialEditor; |
|||
|
|||
FindMaterialProperties(properties); |
|||
|
|||
int modeValue = (int)blendModeProp.floatValue; |
|||
EditorGUI.BeginChangeCheck(); |
|||
modeValue = EditorGUILayout.Popup(Styles.renderingModeLabel, modeValue, Styles.blendNames); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
blendModeProp.floatValue = modeValue; |
|||
|
|||
GUIContent mainTexLabel = Styles.mainTexLabels[Math.Min(modeValue, 1)]; |
|||
m_MaterialEditor.TexturePropertySingleLine(mainTexLabel, mainTexProp, mainColorProp); |
|||
m_MaterialEditor.TextureScaleOffsetProperty(mainTexProp); |
|||
|
|||
if ((UpgradeBlendMode) modeValue == UpgradeBlendMode.Cutout) |
|||
m_MaterialEditor.RangeProperty(alphaCutoffProp, Styles.alphaCutoffLabel); |
|||
|
|||
EditorGUILayout.Space(); |
|||
EditorGUILayout.Space(); |
|||
|
|||
materialEditor.RenderQueueField(); |
|||
|
|||
LightweightShaderHelper.SetMaterialBlendMode(material); |
|||
|
|||
EditorGUILayout.Space(); |
|||
EditorGUILayout.Space(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3be3f3707c329b043b5816855ee127fd |
|||
timeCreated: 1487767801 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue