浏览代码
Merge remote-tracking branch 'origin/master' into refactor-properties
Merge remote-tracking branch 'origin/master' into refactor-properties
# Conflicts: # MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphEditWindow.cs # MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/GraphInspectorPresenter.cs # MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/SurfaceMasterNodeEditorPresenter.cs # MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Views/GraphInspectorView.cs # MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GraphEditorPresenter.cs # MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs/main
Tim Cooper
7 年前
当前提交
95cdeda0
共有 125 个文件被更改,包括 6795 次插入 和 1267 次删除
-
11MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableGraph.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/IGraph.cs
-
2MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightUnlitGUI.cs
-
65MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader
-
249MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPBR.shader
-
8MaterialGraphProject/Assets/TestAssets/bricks_normal.tga.meta
-
51MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphEditWindow.cs
-
89MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphPreviewGenerator.cs
-
31MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GraphEditorPresenter.cs
-
96MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
48MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialNodePresenter.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
29MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
-
33MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
16MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/ShaderGenerationTest.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/Util/UIUtilities.cs
-
2MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightBRDF.cginc
-
17MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightShadows.cginc
-
53MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/StandardNodeEditorView.cs
-
107MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/IMGUISlotEditorView.cs
-
31MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/AbstractNodeEditorView.cs
-
35MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/SurfaceMasterNodeEditorView.cs
-
24MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/GraphChange.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/GraphChange.cs.meta
-
126MaterialGraphProject/Assets/PartyPreview.ShaderGraph
-
11MaterialGraphProject/Assets/PartyPreview.ShaderGraph.meta
-
10MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes.meta
-
126MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/FastBlinnTest.ShaderGraph
-
13MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/FastBlinnTest.ShaderGraph.meta
-
225MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightFastBlinn.shader
-
364MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/MetallicTest.ShaderGraph
-
15MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/MetallicTest.ShaderGraph.meta
-
371MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/SpecularTest.ShaderGraph
-
15MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/SpecularTest.ShaderGraph.meta
-
70MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/UnlitTest.ShaderGraph
-
11MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/UnlitTest.ShaderGraph.meta
-
80MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs
-
123MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
-
318MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewSystem.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewSystem.cs.meta
-
120MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderFastBlinn.template
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderFastBlinn.template.meta
-
89MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderPBR.template
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderPBR.template.meta
-
53MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderUnlit.template
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderUnlit.template.meta
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline.meta
-
99MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightCore.cginc
-
134MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightFastBlinn.cginc
-
9MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightFastBlinn.cginc.meta
-
107MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightInput.cginc
-
154MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightPBR.cginc
-
9MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightPBR.cginc.meta
-
67MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightPass.cginc
-
9MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightPass.cginc.meta
-
78MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightUnlit.cginc
-
9MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightUnlit.cginc.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightPBRMasterNode.cs.meta
-
81MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightMetallicMasterNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightMetallicMasterNode.cs.meta
-
9MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/ShaderTest.unity.meta
-
81MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightSpecularMasterNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightSpecularMasterNode.cs.meta
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightFastBlinnMasterNode.cs.meta
-
418MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightPBRMasterNode.cs
-
449MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightFastBlinnMasterNode.cs
-
413MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightUnlitMasterNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightUnlitMasterNode.cs.meta
-
138MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-PBRMetallic.mat
-
134MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-PBRSpecular.mat
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-PBRSpecular.mat.meta
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-Legacy.mat.meta
-
92MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-Unlit.mat
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-Unlit.mat.meta
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-PBRMetallic.mat.meta
-
91MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-Legacy.mat
-
105MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-PBRSpecular.mat
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-PBRSpecular.mat.meta
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-PBRMetallic.mat.meta
-
105MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/Test-PBRMetallic.mat
-
149MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-FastBlinn.mat
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-FastBlinn.mat.meta
-
96MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-Unlit.mat
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/Materials/TestGraph-Unlit.mat.meta
-
996MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/ShaderTest.unity
-
344MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipeline.shader
-
71MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipelineCore.cginc
-
160MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipelineInput.cginc
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/AbstractNodeEditorPresenter.cs.meta
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/IMGUISlotEditorPresenter.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/IMGUISlotEditorPresenter.cs.meta
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/StandardNodeEditorPresenter.cs.meta
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/SurfaceMasterNodeEditorPresenter.cs.meta
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/AbstractNodeEditorPresenter.cs
-
43MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters/StandardNodeEditorPresenter.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters.meta
|
|||
using System; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine.Graphing; |
|||
using Object = UnityEngine.Object; |
|||
public class IMGUISlotEditorView : DataWatchContainer |
|||
public class IMGUISlotEditorView : VisualElement |
|||
[SerializeField] |
|||
IMGUISlotEditorPresenter m_Presenter; |
|||
MaterialSlot m_Slot; |
|||
int m_SlotsHash; |
|||
ConcreteSlotValueType m_CurrentValueType = ConcreteSlotValueType.Error; |
|||
|
|||
public override void OnDataChanged() |
|||
public IMGUISlotEditorView(MaterialSlot slot) |
|||
if (presenter == null) |
|||
{ |
|||
Clear(); |
|||
return; |
|||
} |
|||
|
|||
if (presenter.slot.concreteValueType == m_CurrentValueType) |
|||
return; |
|||
|
|||
Clear(); |
|||
m_CurrentValueType = presenter.slot.concreteValueType; |
|||
|
|||
Action onGUIHandler; |
|||
if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector4) |
|||
onGUIHandler = Vector4OnGUIHandler; |
|||
else if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector3) |
|||
onGUIHandler = Vector3OnGUIHandler; |
|||
else if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector2) |
|||
onGUIHandler = Vector2OnGUIHandler; |
|||
else if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector1) |
|||
onGUIHandler = Vector1OnGUIHandler; |
|||
else |
|||
return; |
|||
|
|||
Add(new IMGUIContainer(onGUIHandler)); |
|||
m_Slot = slot; |
|||
Add(new IMGUIContainer(OnGUIHandler)); |
|||
void Vector4OnGUIHandler() |
|||
void OnGUIHandler() |
|||
if (presenter.slot == null) |
|||
if (m_Slot == null) |
|||
presenter.value = EditorGUILayout.Vector4Field(presenter.slot.displayName, presenter.value); |
|||
var newValue = SlotField(m_Slot); |
|||
if (newValue != m_Slot.currentValue) |
|||
{ |
|||
m_Slot.currentValue = newValue; |
|||
m_Slot.owner.onModified(m_Slot.owner, ModificationScope.Node); |
|||
} |
|||
void Vector3OnGUIHandler() |
|||
static Vector4 SlotField(MaterialSlot slot) |
|||
if (presenter.slot == null) |
|||
return; |
|||
var previousWideMode = EditorGUIUtility.wideMode; |
|||
EditorGUIUtility.wideMode = true; |
|||
presenter.value = EditorGUILayout.Vector3Field(presenter.slot.displayName, presenter.value); |
|||
EditorGUIUtility.wideMode = previousWideMode; |
|||
} |
|||
|
|||
void Vector2OnGUIHandler() |
|||
{ |
|||
if (presenter.slot == null) |
|||
return; |
|||
var previousWideMode = EditorGUIUtility.wideMode; |
|||
EditorGUIUtility.wideMode = true; |
|||
presenter.value = EditorGUILayout.Vector2Field(presenter.slot.displayName, presenter.value); |
|||
EditorGUIUtility.wideMode = previousWideMode; |
|||
} |
|||
|
|||
void Vector1OnGUIHandler() |
|||
{ |
|||
if (presenter.slot == null) |
|||
return; |
|||
var previousWideMode = EditorGUIUtility.wideMode; |
|||
EditorGUIUtility.wideMode = true; |
|||
presenter.value = new Vector4(EditorGUILayout.FloatField(presenter.slot.displayName, presenter.value.x), 0, 0, 0); |
|||
EditorGUIUtility.wideMode = previousWideMode; |
|||
} |
|||
|
|||
protected override Object[] toWatch |
|||
{ |
|||
get { return new Object[] { presenter }; } |
|||
} |
|||
|
|||
public IMGUISlotEditorPresenter presenter |
|||
{ |
|||
get { return m_Presenter; } |
|||
set |
|||
{ |
|||
if (value == m_Presenter) |
|||
return; |
|||
RemoveWatch(); |
|||
m_Presenter = value; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector1) |
|||
return new Vector4(EditorGUILayout.FloatField(slot.displayName, slot.currentValue.x), 0, 0, 0); |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector2) |
|||
return EditorGUILayout.Vector2Field(slot.displayName, slot.currentValue); |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector3) |
|||
return EditorGUILayout.Vector3Field(slot.displayName, slot.currentValue); |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector4) |
|||
return EditorGUILayout.Vector4Field(slot.displayName, slot.currentValue); |
|||
return Vector4.zero; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using System; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEngine.Graphing; |
|||
public class AbstractNodeEditorView : DataWatchContainer |
|||
public abstract class AbstractNodeEditorView : VisualElement, IDisposable |
|||
[SerializeField] |
|||
AbstractNodeEditorPresenter m_Presenter; |
|||
public abstract INode node { get; set; } |
|||
public AbstractNodeEditorPresenter presenter |
|||
{ |
|||
get { return m_Presenter; } |
|||
set |
|||
{ |
|||
if (value == m_Presenter) |
|||
return; |
|||
RemoveWatch(); |
|||
m_Presenter = value; |
|||
m_ToWatch[0] = m_Presenter; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
} |
|||
|
|||
Object[] m_ToWatch = { null }; |
|||
|
|||
protected override Object[] toWatch |
|||
{ |
|||
get { return m_ToWatch; } |
|||
} |
|||
public abstract void Dispose(); |
|||
} |
|||
} |
|
|||
namespace UnityEngine.Graphing |
|||
{ |
|||
public abstract class GraphChange {} |
|||
|
|||
public sealed class NodeAddedGraphChange : GraphChange |
|||
{ |
|||
public NodeAddedGraphChange(INode node) |
|||
{ |
|||
this.node = node; |
|||
} |
|||
|
|||
public INode node { get; private set; } |
|||
} |
|||
|
|||
public sealed class NodeRemovedGraphChange : GraphChange |
|||
{ |
|||
public NodeRemovedGraphChange(INode node) |
|||
{ |
|||
this.node = node; |
|||
} |
|||
|
|||
public INode node { get; private set; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: cbfac7ed81744ca281be9e21eae861c7 |
|||
timeCreated: 1505620762 |
126
MaterialGraphProject/Assets/PartyPreview.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: e67b8be7b087145ab87b7ae0a690c35e |
|||
timeCreated: 1505629362 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 2376bae6f236e5842972372c576a8645 |
|||
folderAsset: yes |
|||
timeCreated: 1505346231 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
126
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/FastBlinnTest.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: fb10f96bca7384c4794179be4353d50e |
|||
timeCreated: 1505525127 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: |
|||
- Texture2D_Texture2D_37BDC883_Uniform: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, |
|||
type: 3} |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// Shader targeted for low end devices. Single Pass Forward Rendering. Shader Model 2 |
|||
Shader "ScriptableRenderPipeline/LightweightPipeline/FastBlinn" |
|||
{ |
|||
// Keep properties of StandardSpecular shader for upgrade reasons. |
|||
Properties |
|||
{ |
|||
_Color("Color", Color) = (1,1,1,1) |
|||
_MainTex("Base (RGB) Glossiness / Alpha (A)", 2D) = "white" {} |
|||
|
|||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 |
|||
|
|||
_Shininess("Shininess", Range(0.01, 1.0)) = 1.0 |
|||
_GlossMapScale("Smoothness Factor", Range(0.0, 1.0)) = 1.0 |
|||
|
|||
_Glossiness("Glossiness", Range(0.0, 1.0)) = 0.5 |
|||
[Enum(Specular Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel("Smoothness texture channel", Float) = 0 |
|||
|
|||
_Cube ("Reflection Cubemap", CUBE) = "" {} |
|||
_ReflectionSource("Reflection Source", Float) = 0 |
|||
|
|||
[HideInInspector] _SpecSource("Specular Color Source", Float) = 0.0 |
|||
_SpecColor("Specular", Color) = (1.0, 1.0, 1.0) |
|||
_SpecGlossMap("Specular", 2D) = "white" {} |
|||
[HideInInspector] _GlossinessSource("Glossiness Source", Float) = 0.0 |
|||
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 |
|||
[ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0 |
|||
|
|||
[HideInInspector] _BumpScale("Scale", Float) = 1.0 |
|||
[NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {} |
|||
|
|||
_Parallax("Height Scale", Range(0.005, 0.08)) = 0.02 |
|||
_ParallaxMap("Height Map", 2D) = "black" {} |
|||
|
|||
_EmissionColor("Emission Color", Color) = (0,0,0) |
|||
_EmissionMap("Emission", 2D) = "white" {} |
|||
|
|||
_DetailMask("Detail Mask", 2D) = "white" {} |
|||
|
|||
_DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {} |
|||
_DetailNormalMapScale("Scale", Float) = 1.0 |
|||
_DetailNormalMap("Normal Map", 2D) = "bump" {} |
|||
|
|||
[Enum(UV0,0,UV1,1)] _UVSec("UV Set for secondary textures", Float) = 0 |
|||
|
|||
// Blending state |
|||
[HideInInspector] _Mode("__mode", Float) = 0.0 |
|||
[HideInInspector] _SrcBlend("__src", Float) = 1.0 |
|||
[HideInInspector] _DstBlend("__dst", Float) = 0.0 |
|||
[HideInInspector] _ZWrite("__zw", Float) = 1.0 |
|||
} |
|||
|
|||
SubShader |
|||
{ |
|||
Tags { "RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline" } |
|||
LOD 300 |
|||
|
|||
Pass |
|||
{ |
|||
Tags { "LightMode" = "LightweightForward" } |
|||
|
|||
// Use same blending / depth states as Standard shader |
|||
Blend[_SrcBlend][_DstBlend] |
|||
ZWrite[_ZWrite] |
|||
|
|||
CGPROGRAM |
|||
#pragma target 3.0 |
|||
|
|||
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON |
|||
#pragma shader_feature _ _SPECGLOSSMAP _SPECGLOSSMAP_BASE_ALPHA _SPECULAR_COLOR |
|||
#pragma shader_feature _NORMALMAP |
|||
#pragma shader_feature _EMISSION |
|||
#pragma shader_feature _ _REFLECTION_CUBEMAP _REFLECTION_PROBE |
|||
|
|||
#pragma multi_compile _ LIGHTWEIGHT_LINEAR |
|||
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON |
|||
#pragma multi_compile _ _SINGLE_DIRECTIONAL_LIGHT _SINGLE_SPOT_LIGHT _SINGLE_POINT_LIGHT |
|||
#pragma multi_compile _ LIGHTMAP_ON |
|||
#pragma multi_compile _ _LIGHT_PROBES_ON |
|||
#pragma multi_compile _ _HARD_SHADOWS _SOFT_SHADOWS _HARD_SHADOWS_CASCADES _SOFT_SHADOWS_CASCADES |
|||
#pragma multi_compile _ _VERTEX_LIGHTS |
|||
#pragma multi_compile _ _ATTENUATION_TEXTURE |
|||
#pragma multi_compile_fog |
|||
#pragma multi_compile_instancing |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
#define VERTEX_CUSTOM \ |
|||
o.tangent = normalize(UnityObjectToWorldDir(v.tangent)); \ |
|||
o.binormal = cross(o.normal, o.tangent) * v.tangent.w; |
|||
|
|||
#define VERTOUTPUT_CUSTOM \ |
|||
half3 tangent : TEXCOORD5; \ |
|||
half3 binormal : TEXCOORD6; |
|||
|
|||
#include "CGIncludes/LightweightFastBlinn.cginc" |
|||
|
|||
#pragma vertex Vertex |
|||
#pragma fragment LightweightFragmentFastBlinn |
|||
|
|||
void DefineSurface(VertOutput i, inout SurfaceFastBlinn s) |
|||
{ |
|||
// Albedo |
|||
float4 c = tex2D(_MainTex, i.meshUV0.xy); |
|||
s.Diffuse = LIGHTWEIGHT_GAMMA_TO_LINEAR(c.rgb) * _Color.rgb; |
|||
// Specular |
|||
#ifdef _SPECGLOSSMAP |
|||
half4 specularMap = tex2D(_SpecGlossMap, i.uv01.xy); |
|||
#if defined(UNITY_COLORSPACE_GAMMA) && defined(LIGHTWEIGHT_LINEAR) |
|||
s.Specular = LIGHTWEIGHT_GAMMA_TO_LINEAR(specularGloss.rgb); |
|||
#endif |
|||
#elif defined(_SPECGLOSSMAP_BASE_ALPHA) |
|||
s.Specular.rgb = LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_SpecGlossMap, i.meshUV0.xy).rgb) * _SpecColor.rgb; |
|||
s.Glossiness = s.Alpha; |
|||
#else |
|||
s.Specular = _SpecColor.rgb; |
|||
s.Glossiness = _SpecColor.a; |
|||
#endif |
|||
// Shininess |
|||
s.Shininess = _Shininess; |
|||
// Normal |
|||
#if _NORMALMAP |
|||
s.Normal = UnpackNormal(tex2D(_BumpMap, i.meshUV0.xy)); |
|||
#endif |
|||
// Emission |
|||
#ifndef _EMISSION |
|||
s.Emission = _EmissionColor.rgb; |
|||
#else |
|||
s.Emission = LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_EmissionMap, uv).rgb) * _EmissionColor.rgb; |
|||
#endif |
|||
// Alpha |
|||
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
s.Alpha = _Color.a; |
|||
#else |
|||
s.Alpha = c.a * _Color.a; |
|||
#endif |
|||
|
|||
#ifdef _ALPHATEST_ON |
|||
clip(s.Alpha - _Cutoff); |
|||
#endif |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags { "Lightmode" = "ShadowCaster" } |
|||
ZWrite On ZTest LEqual |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#include "UnityCG.cginc" |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex shadowVert |
|||
#pragma fragment shadowFrag |
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"Lightmode" = "DepthOnly"} |
|||
ZWrite On |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex depthVert |
|||
#pragma fragment depthFrag |
|||
ENDCG |
|||
} |
|||
/* |
|||
// This pass it not used during regular rendering, only for lightmap baking. |
|||
Pass |
|||
{ |
|||
Tags{ "LightMode" = "Meta" } |
|||
|
|||
Cull Off |
|||
|
|||
CGPROGRAM |
|||
#define UNITY_SETUP_BRDF_INPUT SpecularSetup |
|||
|
|||
#pragma shader_feature _EMISSION |
|||
#pragma shader_feature _SPECGLOSSMAP |
|||
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
#pragma shader_feature ___ _DETAIL_MULX2 |
|||
#pragma shader_feature EDITOR_VISUALIZATION |
|||
|
|||
#include "UnityCG.cginc" |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex Vert_Meta |
|||
#pragma fragment frag_meta_ld |
|||
|
|||
void DefineSurfaceMeta(VertOutput_Meta i, inout SurfaceFastBlinn s) |
|||
{ |
|||
// Albedo |
|||
float4 c = tex2D(_MainTex, i.meshUV0.xy); |
|||
s.Diffuse = c.rgb; |
|||
// Specular |
|||
#ifdef _SPECGLOSSMAP |
|||
half4 specularMap = tex2D(_SpecGlossMap, i.meshUV0.xy); |
|||
#if defined(UNITY_COLORSPACE_GAMMA) && defined(LIGHTWEIGHT_LINEAR) |
|||
s.Specular = LIGHTWEIGHT_GAMMA_TO_LINEAR(specularGloss.rgb); |
|||
#endif |
|||
#elif defined(_SPECGLOSSMAP_BASE_ALPHA) |
|||
s.Specular.rgb = LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_SpecGlossMap, i.meshUV0.xy).rgb) * _SpecColor.rgb; |
|||
s.Glossiness = s.Alpha; |
|||
#else |
|||
s.Specular = _SpecColor.rgb; |
|||
s.Glossiness = _SpecColor.a; |
|||
#endif |
|||
// Emission |
|||
#ifndef _EMISSION |
|||
s.Emission = _EmissionColor.rgb; |
|||
#else |
|||
s.Emission = LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_EmissionMap, uv).rgb) * _EmissionColor.rgb; |
|||
#endif |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
*/ |
|||
} |
|||
Fallback "Standard (Specular setup)" |
|||
CustomEditor "LightweightPipelineMaterialEditor" |
|||
} |
364
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/MetallicTest.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 02a3ca69ec995e94aa47105621a17e4c |
|||
timeCreated: 1505519513 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: |
|||
- Texture2D_Texture2D_AEB21289_Uniform: {fileID: 2800000, guid: 6e8d12f68bae2294da814f9d4c81b29a, |
|||
type: 3} |
|||
- Texture2D_Texture2D_87733D67_Uniform: {fileID: 2800000, guid: 3f3b8bdf3ccd30c4fb97b62bd26ef1f6, |
|||
type: 3} |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
371
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/SpecularTest.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: a96bafc6e4c6e7c4ca1fb43c905d7948 |
|||
timeCreated: 1505519516 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: |
|||
- Texture2D_Texture2D_AEB21289_Uniform: {fileID: 2800000, guid: 6e8d12f68bae2294da814f9d4c81b29a, |
|||
type: 3} |
|||
- Texture2D_Texture2D_87733D67_Uniform: {fileID: 2800000, guid: 3f3b8bdf3ccd30c4fb97b62bd26ef1f6, |
|||
type: 3} |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
70
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/UnlitTest.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: c575d6799ba1a994a931fe22b1d3fe08 |
|||
timeCreated: 1505526719 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Inspector |
|||
{ |
|||
public class GraphInspectorPresenter : ScriptableObject, IDisposable |
|||
{ |
|||
PreviewData m_PreviewHandle; |
|||
|
|||
public IGraph graph { get; set; } |
|||
|
|||
public string assetName { get; set; } |
|||
|
|||
public List<INode> selectedNodes { get; set; } |
|||
|
|||
public Texture previewTexture { get; private set; } |
|||
|
|||
[Flags] |
|||
public enum ChangeType |
|||
{ |
|||
Graph = 1 << 0, |
|||
SelectedNodes = 1 << 1, |
|||
AssetName = 1 << 2, |
|||
PreviewTexture = 1 << 3, |
|||
All = -1 |
|||
} |
|||
|
|||
public delegate void OnChange(ChangeType changeType); |
|||
|
|||
public OnChange onChange; |
|||
|
|||
public void Initialize(string assetName, IGraph graph, PreviewSystem previewSystem) |
|||
{ |
|||
var masterNode = graph.GetNodes<AbstractMasterNode>().FirstOrDefault(); |
|||
if (masterNode != null) |
|||
{ |
|||
m_PreviewHandle = previewSystem.GetPreview(masterNode); |
|||
m_PreviewHandle.onPreviewChanged += OnPreviewChanged; |
|||
} |
|||
this.graph = graph; |
|||
this.assetName = assetName; |
|||
selectedNodes = new List<INode>(); |
|||
|
|||
Change(ChangeType.Graph | ChangeType.SelectedNodes | ChangeType.AssetName); |
|||
} |
|||
|
|||
void OnPreviewChanged() |
|||
{ |
|||
previewTexture = m_PreviewHandle.texture; |
|||
Change(ChangeType.PreviewTexture); |
|||
} |
|||
|
|||
public void UpdateSelection(IEnumerable<INode> nodes) |
|||
{ |
|||
selectedNodes.Clear(); |
|||
selectedNodes.AddRange(nodes); |
|||
|
|||
Change(ChangeType.SelectedNodes); |
|||
} |
|||
|
|||
void Change(ChangeType changeType) |
|||
{ |
|||
if (onChange != null) |
|||
onChange(changeType); |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
if (m_PreviewHandle != null) |
|||
{ |
|||
m_PreviewHandle.onPreviewChanged -= OnPreviewChanged; |
|||
m_PreviewHandle = null; |
|||
}; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Linq; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEditor.Graphing.Util; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Inspector |
|||
{ |
|||
public class GraphInspectorView : VisualElement, IDisposable |
|||
{ |
|||
[SerializeField] |
|||
GraphInspectorPresenter m_Presenter; |
|||
|
|||
int m_SelectionHash; |
|||
|
|||
VisualElement m_Title; |
|||
VisualElement m_ContentContainer; |
|||
AbstractNodeEditorView m_EditorView; |
|||
|
|||
TypeMapper m_TypeMapper; |
|||
Image m_Preview; |
|||
|
|||
public GraphInspectorView() |
|||
{ |
|||
AddStyleSheetPath("Styles/MaterialGraph"); |
|||
|
|||
var topContainer = new VisualElement { name = "top" }; |
|||
{ |
|||
var headerContainer = new VisualElement { name = "header" }; |
|||
{ |
|||
m_Title = new VisualElement() { name = "title" }; |
|||
headerContainer.Add(m_Title); |
|||
} |
|||
topContainer.Add(headerContainer); |
|||
|
|||
m_ContentContainer = new VisualElement { name = "content" }; |
|||
topContainer.Add(m_ContentContainer); |
|||
} |
|||
Add(topContainer); |
|||
|
|||
var bottomContainer = new VisualElement { name = "bottom" }; |
|||
{ |
|||
m_Preview = new Image { name = "preview", image = Texture2D.blackTexture}; |
|||
bottomContainer.Add(m_Preview); |
|||
} |
|||
Add(bottomContainer); |
|||
|
|||
// Nodes missing custom editors:
|
|||
// - PropertyNode
|
|||
// - SubGraphInputNode
|
|||
// - SubGraphOutputNode
|
|||
m_TypeMapper = new TypeMapper(typeof(INode), typeof(AbstractNodeEditorView), typeof(StandardNodeEditorView)) |
|||
{ |
|||
{ typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeEditorView) } |
|||
}; |
|||
} |
|||
|
|||
public void OnChange(GraphInspectorPresenter.ChangeType changeType) |
|||
{ |
|||
if (presenter == null) |
|||
{ |
|||
m_ContentContainer.Clear(); |
|||
m_SelectionHash = 0; |
|||
return; |
|||
} |
|||
|
|||
if ((changeType & GraphInspectorPresenter.ChangeType.AssetName) != 0) |
|||
m_Title.text = presenter.assetName; |
|||
|
|||
if ((changeType & GraphInspectorPresenter.ChangeType.SelectedNodes) != 0) |
|||
{ |
|||
var selectionHash = UIUtilities.GetHashCode(presenter.selectedNodes.Count, presenter.selectedNodes != null ? presenter.selectedNodes.FirstOrDefault() : null); |
|||
if (selectionHash != m_SelectionHash) |
|||
{ |
|||
m_SelectionHash = selectionHash; |
|||
m_ContentContainer.Clear(); |
|||
if (presenter.selectedNodes.Count > 1) |
|||
{ |
|||
var element = new VisualElement { name = "selectionCount", text = string.Format("{0} nodes selected.", presenter.selectedNodes.Count) }; |
|||
m_ContentContainer.Add(element); |
|||
} |
|||
else if (presenter.selectedNodes.Count == 1) |
|||
{ |
|||
var node = presenter.selectedNodes.First(); |
|||
var view = (AbstractNodeEditorView)Activator.CreateInstance(m_TypeMapper.MapType(node.GetType())); |
|||
view.node = node; |
|||
m_ContentContainer.Add(view); |
|||
} |
|||
} |
|||
} |
|||
|
|||
if ((changeType & GraphInspectorPresenter.ChangeType.PreviewTexture) != 0) |
|||
{ |
|||
m_Preview.image = presenter.previewTexture ?? Texture2D.blackTexture; |
|||
} |
|||
} |
|||
|
|||
public GraphInspectorPresenter presenter |
|||
{ |
|||
get { return m_Presenter; } |
|||
set |
|||
{ |
|||
if (m_Presenter == value) |
|||
return; |
|||
if (m_Presenter != null) |
|||
m_Presenter.onChange -= OnChange; |
|||
m_Presenter = value; |
|||
OnChange(GraphInspectorPresenter.ChangeType.All); |
|||
m_Presenter.onChange += OnChange; |
|||
} |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
if (m_Presenter != null) |
|||
m_Presenter.onChange -= OnChange; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Runtime.InteropServices; |
|||
using System.Threading; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class PreviewSystem : IDisposable |
|||
{ |
|||
IGraph m_Graph; |
|||
Dictionary<Guid, PreviewData> m_Previews = new Dictionary<Guid, PreviewData>(); |
|||
HashSet<Guid> m_DirtyPreviews = new HashSet<Guid>(); |
|||
HashSet<Guid> m_DirtyShaders = new HashSet<Guid>(); |
|||
HashSet<Guid> m_TimeDependentPreviews = new HashSet<Guid>(); |
|||
Material m_PreviewMaterial; |
|||
MaterialPropertyBlock m_PreviewPropertyBlock; |
|||
MaterialGraphPreviewGenerator m_PreviewGenerator = new MaterialGraphPreviewGenerator(); |
|||
Texture2D m_ErrorTexture; |
|||
|
|||
public PreviewSystem(IGraph graph) |
|||
{ |
|||
m_Graph = graph; |
|||
m_PreviewMaterial = new Material(Shader.Find("Unlit/Color")) { hideFlags = HideFlags.HideInHierarchy }; |
|||
m_PreviewMaterial.hideFlags = HideFlags.HideInHierarchy; |
|||
m_PreviewPropertyBlock = new MaterialPropertyBlock(); |
|||
m_ErrorTexture = new Texture2D(2, 2); |
|||
m_ErrorTexture.SetPixel(0, 0, Color.magenta); |
|||
m_ErrorTexture.SetPixel(0, 1, Color.black); |
|||
m_ErrorTexture.SetPixel(1, 0, Color.black); |
|||
m_ErrorTexture.SetPixel(1, 1, Color.magenta); |
|||
m_ErrorTexture.Apply(); |
|||
|
|||
foreach (var node in m_Graph.GetNodes<INode>()) |
|||
AddPreview(node); |
|||
m_Graph.onChange += OnGraphChange; |
|||
} |
|||
|
|||
public PreviewData GetPreview(INode node) |
|||
{ |
|||
return m_Previews[node.guid]; |
|||
} |
|||
|
|||
void OnGraphChange(GraphChange change) |
|||
{ |
|||
if (change is NodeAddedGraphChange) |
|||
AddPreview(((NodeAddedGraphChange)change).node); |
|||
else if (change is NodeRemovedGraphChange) |
|||
RemovePreview(((NodeRemovedGraphChange)change).node); |
|||
} |
|||
|
|||
void AddPreview(INode node) |
|||
{ |
|||
var previewData = new PreviewData |
|||
{ |
|||
renderTexture = new RenderTexture(256, 256, 16, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default) { hideFlags = HideFlags.HideAndDontSave } |
|||
}; |
|||
m_Previews.Add(node.guid, previewData); |
|||
m_DirtyShaders.Add(node.guid); |
|||
node.onModified += OnNodeModified; |
|||
} |
|||
|
|||
void RemovePreview(INode node) |
|||
{ |
|||
node.onModified -= OnNodeModified; |
|||
m_Previews.Remove(node.guid); |
|||
} |
|||
|
|||
void OnNodeModified(INode node, ModificationScope scope) |
|||
{ |
|||
if (scope >= ModificationScope.Graph) |
|||
m_DirtyShaders.Add(node.guid); |
|||
else if (scope == ModificationScope.Node) |
|||
m_DirtyPreviews.Add(node.guid); |
|||
} |
|||
|
|||
Stack<Guid> m_Wavefront = new Stack<Guid>(); |
|||
|
|||
void PropagateNodeSet(HashSet<Guid> nodeGuidSet, bool forward = true) |
|||
{ |
|||
m_Wavefront.Clear(); |
|||
foreach (var guid in nodeGuidSet) |
|||
m_Wavefront.Push(guid); |
|||
while (m_Wavefront.Count > 0) |
|||
{ |
|||
var nodeGuid = m_Wavefront.Pop(); |
|||
var node = m_Graph.GetNodeFromGuid(nodeGuid); |
|||
if (node == null) |
|||
continue; |
|||
|
|||
// Loop through all nodes that the node feeds into.
|
|||
foreach (var slot in forward ? node.GetOutputSlots<ISlot>() : node.GetInputSlots<ISlot>()) |
|||
{ |
|||
foreach (var edge in m_Graph.GetEdges(slot.slotReference)) |
|||
{ |
|||
// We look at each node we feed into.
|
|||
var connectedSlot = forward ? edge.inputSlot : edge.outputSlot; |
|||
var connectedNodeGuid = connectedSlot.nodeGuid; |
|||
|
|||
// If the input node is already in the set of time-dependent nodes, we don't need to process it.
|
|||
if (nodeGuidSet.Contains(connectedNodeGuid)) |
|||
continue; |
|||
|
|||
// Add the node to the set of time-dependent nodes, and to the wavefront such that we can process the nodes that it feeds into.
|
|||
nodeGuidSet.Add(connectedNodeGuid); |
|||
m_Wavefront.Push(connectedNodeGuid); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public void UpdateTimeDependentPreviews() |
|||
{ |
|||
m_TimeDependentPreviews.Clear(); |
|||
foreach (var node in m_Graph.GetNodes<INode>()) |
|||
{ |
|||
var timeNode = node as IMayRequireTime; |
|||
if (timeNode != null && timeNode.RequiresTime()) |
|||
m_TimeDependentPreviews.Add(node.guid); |
|||
} |
|||
PropagateNodeSet(m_TimeDependentPreviews); |
|||
} |
|||
|
|||
HashSet<Guid> m_PropertyNodeGuids = new HashSet<Guid>(); |
|||
List<PreviewProperty> m_PreviewProperties = new List<PreviewProperty>(); |
|||
|
|||
public void Update() |
|||
{ |
|||
PropagateNodeSet(m_DirtyShaders); |
|||
foreach (var nodeGuid in m_DirtyShaders) |
|||
{ |
|||
UpdateShader(nodeGuid); |
|||
} |
|||
m_DirtyPreviews.UnionWith(m_DirtyShaders); |
|||
m_DirtyShaders.Clear(); |
|||
|
|||
PropagateNodeSet(m_DirtyPreviews); |
|||
m_DirtyPreviews.UnionWith(m_TimeDependentPreviews); |
|||
|
|||
// Find nodes we need properties from
|
|||
m_PropertyNodeGuids.Clear(); |
|||
foreach (var nodeGuid in m_DirtyPreviews) |
|||
m_PropertyNodeGuids.Add(nodeGuid); |
|||
PropagateNodeSet(m_PropertyNodeGuids, false); |
|||
|
|||
// Fill MaterialPropertyBlock
|
|||
m_PreviewPropertyBlock.Clear(); |
|||
foreach (var nodeGuid in m_PropertyNodeGuids) |
|||
{ |
|||
var node = m_Graph.GetNodeFromGuid<AbstractMaterialNode>(nodeGuid); |
|||
node.CollectPreviewMaterialProperties(m_PreviewProperties); |
|||
foreach (var previewProperty in m_PreviewProperties) |
|||
{ |
|||
if (previewProperty.m_PropType == PropertyType.Texture && previewProperty.m_Texture != null) |
|||
m_PreviewPropertyBlock.SetTexture(previewProperty.m_Name, previewProperty.m_Texture); |
|||
else if (previewProperty.m_PropType == PropertyType.Cubemap && previewProperty.m_Cubemap != null) |
|||
m_PreviewPropertyBlock.SetTexture(previewProperty.m_Name, previewProperty.m_Cubemap); |
|||
else if (previewProperty.m_PropType == PropertyType.Color) |
|||
m_PreviewPropertyBlock.SetColor(previewProperty.m_Name, previewProperty.m_Color); |
|||
else if (previewProperty.m_PropType == PropertyType.Vector2) |
|||
m_PreviewPropertyBlock.SetVector(previewProperty.m_Name, previewProperty.m_Vector4); |
|||
else if (previewProperty.m_PropType == PropertyType.Vector3) |
|||
m_PreviewPropertyBlock.SetVector(previewProperty.m_Name, previewProperty.m_Vector4); |
|||
else if (previewProperty.m_PropType == PropertyType.Vector4) |
|||
m_PreviewPropertyBlock.SetVector(previewProperty.m_Name, previewProperty.m_Vector4); |
|||
else if (previewProperty.m_PropType == PropertyType.Float) |
|||
m_PreviewPropertyBlock.SetFloat(previewProperty.m_Name, previewProperty.m_Float); |
|||
} |
|||
m_PreviewProperties.Clear(); |
|||
} |
|||
|
|||
var time = Time.realtimeSinceStartup; |
|||
foreach (var nodeGuid in m_DirtyPreviews) |
|||
{ |
|||
var previewData = m_Previews[nodeGuid]; |
|||
if (previewData.shader == null) |
|||
{ |
|||
previewData.texture = null; |
|||
continue; |
|||
} |
|||
if (MaterialGraphAsset.ShaderHasError(previewData.shader)) |
|||
{ |
|||
previewData.texture = m_ErrorTexture; |
|||
continue; |
|||
} |
|||
var node = m_Graph.GetNodeFromGuid(nodeGuid); |
|||
m_PreviewMaterial.shader = previewData.shader; |
|||
m_PreviewGenerator.DoRenderPreview(previewData.renderTexture, m_PreviewMaterial, previewData.previewMode, node is IMasterNode, time, m_PreviewPropertyBlock); |
|||
previewData.texture = previewData.renderTexture; |
|||
} |
|||
|
|||
foreach (var nodeGuid in m_DirtyPreviews) |
|||
{ |
|||
var previewData = m_Previews[nodeGuid]; |
|||
if (previewData.onPreviewChanged != null) |
|||
previewData.onPreviewChanged(); |
|||
} |
|||
|
|||
m_DirtyPreviews.Clear(); |
|||
} |
|||
|
|||
void UpdateShader(Guid nodeGuid) |
|||
{ |
|||
var node = m_Graph.GetNodeFromGuid<AbstractMaterialNode>(nodeGuid); |
|||
PreviewData previewData; |
|||
if (!m_Previews.TryGetValue(nodeGuid, out previewData)) |
|||
return; |
|||
|
|||
if (node is IMasterNode) |
|||
{ |
|||
var masterNode = (IMasterNode)node; |
|||
List<PropertyGenerator.TextureInfo> defaultTextures; |
|||
previewData.shaderString = masterNode.GetFullShader(GenerationMode.Preview, node.guid + "_preview", out defaultTextures); |
|||
previewData.previewMode = masterNode.has3DPreview() ? PreviewMode.Preview3D : PreviewMode.Preview2D; |
|||
} |
|||
else if (!node.hasPreview || NodeUtils.FindEffectiveShaderStage(node, true) == ShaderStage.Vertex) |
|||
{ |
|||
previewData.shaderString = null; |
|||
} |
|||
else |
|||
{ |
|||
PreviewMode previewMode; |
|||
previewData.shaderString = ShaderGenerator.GeneratePreviewShader(node, out previewMode); |
|||
previewData.previewMode = previewMode; |
|||
} |
|||
|
|||
// Debug output
|
|||
Debug.Log("RecreateShader: " + node.GetVariableNameForNode() + Environment.NewLine + previewData.shaderString); |
|||
File.WriteAllText(Application.dataPath + "/../GeneratedShader.shader", (previewData.shaderString ?? "null").Replace("UnityEngine.MaterialGraph", "Generated")); |
|||
|
|||
if (string.IsNullOrEmpty(previewData.shaderString)) |
|||
{ |
|||
if (previewData.shader != null) |
|||
Object.DestroyImmediate(previewData.shader, true); |
|||
previewData.shader = null; |
|||
return; |
|||
} |
|||
|
|||
if (previewData.shader != null && MaterialGraphAsset.ShaderHasError(previewData.shader)) |
|||
{ |
|||
Object.DestroyImmediate(previewData.shader, true); |
|||
previewData.shader = null; |
|||
} |
|||
|
|||
if (previewData.shader == null) |
|||
{ |
|||
previewData.shader = ShaderUtil.CreateShaderAsset(previewData.shaderString); |
|||
previewData.shader.hideFlags = HideFlags.HideAndDontSave; |
|||
} |
|||
else |
|||
{ |
|||
ShaderUtil.UpdateShaderAsset(previewData.shader, previewData.shaderString); |
|||
} |
|||
} |
|||
|
|||
void DestroyPreview(Guid nodeGuid, PreviewData previewData) |
|||
{ |
|||
if (m_Previews.Remove(nodeGuid)) |
|||
{ |
|||
if (previewData.shader != null) |
|||
Object.DestroyImmediate(previewData.shader, true); |
|||
if (previewData.renderTexture != null) |
|||
Object.DestroyImmediate(previewData.renderTexture, true); |
|||
var node = m_Graph.GetNodeFromGuid(nodeGuid); |
|||
if (node != null) |
|||
node.onModified -= OnNodeModified; |
|||
m_DirtyPreviews.Remove(nodeGuid); |
|||
m_DirtyShaders.Remove(nodeGuid); |
|||
m_TimeDependentPreviews.Remove(nodeGuid); |
|||
previewData.shader = null; |
|||
previewData.renderTexture = null; |
|||
previewData.texture = null; |
|||
previewData.onPreviewChanged = null; |
|||
} |
|||
} |
|||
|
|||
void ReleaseUnmanagedResources() |
|||
{ |
|||
if (m_PreviewMaterial != null) |
|||
Object.DestroyImmediate(m_PreviewMaterial, true); |
|||
m_PreviewMaterial = null; |
|||
if (m_PreviewGenerator != null) |
|||
m_PreviewGenerator.Dispose(); |
|||
m_PreviewGenerator = null; |
|||
var previews = m_Previews.ToList(); |
|||
foreach (var kvp in previews) |
|||
DestroyPreview(kvp.Key, kvp.Value); |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
ReleaseUnmanagedResources(); |
|||
GC.SuppressFinalize(this); |
|||
} |
|||
|
|||
~PreviewSystem() |
|||
{ |
|||
ReleaseUnmanagedResources(); |
|||
} |
|||
} |
|||
|
|||
public delegate void OnPreviewChanged(); |
|||
|
|||
public class PreviewData |
|||
{ |
|||
public Shader shader { get; set; } |
|||
public string shaderString { get; set; } |
|||
public PreviewMode previewMode { get; set; } |
|||
public RenderTexture renderTexture { get; set; } |
|||
public Texture texture { get; set; } |
|||
public OnPreviewChanged onPreviewChanged; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: aa2238545a2849ecb0a6285b5a632a69 |
|||
timeCreated: 1505525146 |
|
|||
SubShader |
|||
{ |
|||
Tags{"RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline"} |
|||
|
|||
LOD ${LOD} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"LightMode" = "LightweightForward"} |
|||
${Tags} |
|||
${Blending} |
|||
${Culling} |
|||
${ZTest} |
|||
${ZWrite} |
|||
|
|||
CGPROGRAM |
|||
#pragma target 3.0 |
|||
|
|||
#pragma multi_compile _ _SINGLE_DIRECTIONAL_LIGHT _SINGLE_SPOT_LIGHT _SINGLE_POINT_LIGHT |
|||
#pragma multi_compile _ LIGHTWEIGHT_LINEAR |
|||
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON |
|||
#pragma multi_compile _ LIGHTMAP_ON |
|||
#pragma multi_compile _ _LIGHT_PROBES_ON |
|||
#pragma multi_compile _ _HARD_SHADOWS _SOFT_SHADOWS _HARD_SHADOWS_CASCADES _SOFT_SHADOWS_CASCADES |
|||
#pragma multi_compile _ _VERTEX_LIGHTS |
|||
#pragma multi_compile_fog |
|||
#pragma multi_compile_instancing |
|||
|
|||
#pragma vertex Vertex |
|||
#pragma fragment LightweightFragmentFastBlinn |
|||
#pragma glsl |
|||
#pragma debug |
|||
|
|||
${Defines} |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
#define UNITY_SAMPLE_TEX2D(tex, coord) LIGHTWEIGHT_GAMMA_TO_LINEAR4(tex.Sample (sampler##tex,coord)) |
|||
|
|||
#define VERTEX_CUSTOM \ |
|||
${VertexShaderBody} |
|||
|
|||
//#define VERTINPUT_CUSTOM \ |
|||
//${VertexInputs} |
|||
|
|||
#define VERTOUTPUT_CUSTOM \ |
|||
${VertexOutputs} |
|||
|
|||
#include "CGIncludes/LightweightFastBlinn.cginc" |
|||
|
|||
${ShaderPropertyUsages} |
|||
${ShaderFunctions} |
|||
|
|||
void DefineSurface(VertOutput i, inout SurfaceFastBlinn o) |
|||
{ |
|||
${PixelShaderBody} |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"Lightmode" = "ShadowCaster"} |
|||
ZWrite On ZTest LEqual |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#include "UnityCG.cginc" |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex shadowVert |
|||
#pragma fragment shadowFrag |
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"Lightmode" = "DepthOnly"} |
|||
ZWrite On |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#include "UnityCG.cginc" |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex depthVert |
|||
#pragma fragment depthFrag |
|||
ENDCG |
|||
} |
|||
|
|||
/*Pass |
|||
{ |
|||
Tags{ "LightMode" = "Meta" } |
|||
|
|||
Cull Off |
|||
|
|||
CGPROGRAM |
|||
#define UNITY_SETUP_BRDF_INPUT SpecularSetup |
|||
|
|||
#pragma shader_feature _EMISSION |
|||
#pragma shader_feature _SPECGLOSSMAP |
|||
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
#pragma shader_feature ___ _DETAIL_MULX2 |
|||
#pragma shader_feature EDITOR_VISUALIZATION |
|||
|
|||
#include "UnityCG.cginc" |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex Vert_Meta |
|||
#pragma fragment frag_meta_ld |
|||
|
|||
${ShaderPropertyUsages} |
|||
${ShaderFunctions} |
|||
|
|||
void DefineSurfaceMeta(VertOutput_Meta i, inout SurfaceFastBlinn o) |
|||
{ |
|||
${PixelShaderBody} |
|||
} |
|||
|
|||
ENDCG |
|||
}*/ |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: bc924eeca96fbbf458b692b836fa8e56 |
|||
timeCreated: 1481194716 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
SubShader |
|||
{ |
|||
Tags{"RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline"} |
|||
|
|||
LOD ${LOD} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"LightMode" = "LightweightForward"} |
|||
${Tags} |
|||
${Blending} |
|||
${Culling} |
|||
${ZTest} |
|||
${ZWrite} |
|||
|
|||
CGPROGRAM |
|||
#pragma target 3.0 |
|||
|
|||
#pragma multi_compile _ _SINGLE_DIRECTIONAL_LIGHT _SINGLE_SPOT_LIGHT _SINGLE_POINT_LIGHT |
|||
#pragma multi_compile _ LIGHTWEIGHT_LINEAR |
|||
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON |
|||
#pragma multi_compile _ LIGHTMAP_ON |
|||
#pragma multi_compile _ _LIGHT_PROBES_ON |
|||
#pragma multi_compile _ _HARD_SHADOWS _SOFT_SHADOWS _HARD_SHADOWS_CASCADES _SOFT_SHADOWS_CASCADES |
|||
#pragma multi_compile _ _VERTEX_LIGHTS |
|||
#pragma multi_compile_fog |
|||
#pragma multi_compile_instancing |
|||
|
|||
#pragma vertex Vertex |
|||
#pragma fragment LightweightFragmentPBR |
|||
#pragma glsl |
|||
#pragma debug |
|||
|
|||
${Defines} |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
//#define UNITY_SAMPLE_TEX2D(tex, coord) LIGHTWEIGHT_GAMMA_TO_LINEAR4(tex.Sample (sampler##tex,coord)) |
|||
|
|||
#define VERTEX_CUSTOM \ |
|||
${VertexShaderBody} |
|||
|
|||
//#define VERTINPUT_CUSTOM \ |
|||
//${VertexInputs} |
|||
|
|||
#define VERTOUTPUT_CUSTOM \ |
|||
${VertexOutputs} |
|||
|
|||
#include "CGIncludes/LightweightPBR.cginc" |
|||
|
|||
${ShaderPropertyUsages} |
|||
${ShaderFunctions} |
|||
|
|||
void DefineSurface(VertOutput i, inout SurfacePBR o) |
|||
{ |
|||
${PixelShaderBody} |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"Lightmode" = "ShadowCaster"} |
|||
ZWrite On ZTest LEqual |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#include "UnityCG.cginc" |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex shadowVert |
|||
#pragma fragment shadowFrag |
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"Lightmode" = "DepthOnly"} |
|||
ZWrite On |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#include "UnityCG.cginc" |
|||
#include "CGIncludes/LightweightPass.cginc" |
|||
#pragma vertex depthVert |
|||
#pragma fragment depthFrag |
|||
ENDCG |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2353df0680be00447b3e7be2e8f1c71f |
|||
timeCreated: 1481194716 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
SubShader |
|||
{ |
|||
Tags{"RenderType" = "Opaque" "IgnoreProjectors" = "True" "RenderPipeline" = "LightweightPipeline"} |
|||
|
|||
LOD ${LOD} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"LightMode" = "LightweightForward"} |
|||
${Tags} |
|||
${Blending} |
|||
${Culling} |
|||
${ZTest} |
|||
${ZWrite} |
|||
|
|||
CGPROGRAM |
|||
#pragma target 3.0 |
|||
|
|||
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON |
|||
#pragma multi_compile_fog |
|||
#pragma multi_compile_instancing |
|||
|
|||
#pragma vertex LightweightVertexUnlit |
|||
#pragma fragment LightweightFragmentUnlit |
|||
#pragma glsl |
|||
#pragma debug |
|||
|
|||
${Defines} |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
#define VERTEX_CUSTOM \ |
|||
${VertexShaderBody} |
|||
|
|||
//#define VERTINPUT_CUSTOM \ |
|||
//${VertexInputs} |
|||
|
|||
#define VERTOUTPUT_CUSTOM \ |
|||
${VertexOutputs} |
|||
|
|||
#include "CGIncludes/LightweightUnlit.cginc" |
|||
|
|||
${ShaderPropertyUsages} |
|||
${ShaderFunctions} |
|||
|
|||
void DefineSurface(LightweightVertexOutputUnlit i, inout SurfaceUnlit o) |
|||
{ |
|||
${PixelShaderBody} |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6076bf8142e1aab42843b38e9585e81c |
|||
timeCreated: 1481194716 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 916528b44860a914c9ce5f4db133a19b |
|||
folderAsset: yes |
|||
timeCreated: 1505322757 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef LIGHTWEIGHT_CORE_INCLUDED |
|||
#define LIGHTWEIGHT_CORE_INCLUDED |
|||
|
|||
// ------------------------------------- |
|||
|
|||
#include "LightweightInput.cginc" |
|||
#include "LightweightLighting.cginc" |
|||
|
|||
#if defined(_HARD_SHADOWS) || defined(_SOFT_SHADOWS) || defined(_HARD_SHADOWS_CASCADES) || defined(_SOFT_SHADOWS_CASCADES) |
|||
#define _SHADOWS |
|||
#endif |
|||
|
|||
#if defined(_HARD_SHADOWS_CASCADES) || defined(_SOFT_SHADOWS_CASCADES) |
|||
#define _SHADOW_CASCADES |
|||
#endif |
|||
|
|||
#ifdef _SHADOWS |
|||
#include "LightweightShadows.cginc" |
|||
#endif |
|||
|
|||
#if defined(_SPECGLOSSMAP_BASE_ALPHA) || defined(_SPECGLOSSMAP) || defined(_SPECULAR_COLOR) |
|||
#define _SPECULARHIGHLIGHTS_ON |
|||
#endif |
|||
|
|||
#define _DieletricSpec half4(0.04, 0.04, 0.04, 1.0 - 0.04) // standard dielectric reflectivity coef at incident angle (= 4%) |
|||
|
|||
half SpecularReflectivity(half3 specular) |
|||
{ |
|||
#if (SHADER_TARGET < 30) |
|||
// SM2.0: instruction count limitation |
|||
// SM2.0: simplified SpecularStrength |
|||
return specular.r; // Red channel - because most metals are either monocrhome or with redish/yellowish tint |
|||
#else |
|||
return max(max(specular.r, specular.g), specular.b); |
|||
#endif |
|||
} |
|||
|
|||
half4 OutputColor(half3 color, half alpha) |
|||
{ |
|||
#if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) |
|||
return LIGHTWEIGHT_LINEAR_TO_GAMMA(half4(color, alpha)); |
|||
#else |
|||
return half4(LIGHTWEIGHT_LINEAR_TO_GAMMA(color), 1); |
|||
#endif |
|||
} |
|||
|
|||
VertOutput Vertex(VertInput v) |
|||
{ |
|||
VertOutput o = (VertOutput)0; |
|||
|
|||
UNITY_SETUP_INSTANCE_ID(v); |
|||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|||
|
|||
o.normal = normalize(UnityObjectToWorldNormal(v.normal)); |
|||
|
|||
o.meshUV0.xy = v.texcoord0.xy; |
|||
#ifdef LIGHTMAP_ON |
|||
o.meshUV0.zw = v.lightmapUV * unity_LightmapST.xy + unity_LightmapST.zw; |
|||
#endif |
|||
|
|||
//${ VertexShaderBody } |
|||
#ifdef VERTEX_CUSTOM |
|||
VERTEX_CUSTOM; |
|||
#endif |
|||
|
|||
o.hpos = UnityObjectToClipPos(v.vertex); |
|||
float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; |
|||
o.posWS.xyz = worldPos; |
|||
o.viewDir.xyz = normalize(_WorldSpaceCameraPos - worldPos); |
|||
|
|||
// TODO: change to only support point lights per vertex. This will greatly simplify shader ALU |
|||
#if defined(_VERTEX_LIGHTS) && defined(_MULTIPLE_LIGHTS) |
|||
half3 diffuse = half3(1.0, 1.0, 1.0); |
|||
// pixel lights shaded = min(pixelLights, perObjectLights) |
|||
// vertex lights shaded = min(vertexLights, perObjectLights) - pixel lights shaded |
|||
// Therefore vertexStartIndex = pixelLightCount; vertexEndIndex = min(vertexLights, perObjectLights) |
|||
int vertexLightStart = min(globalLightCount.x, unity_LightIndicesOffsetAndCount.y); |
|||
int vertexLightEnd = min(globalLightCount.y, unity_LightIndicesOffsetAndCount.y); |
|||
for (int lightIter = vertexLightStart; lightIter < vertexLightEnd; ++lightIter) |
|||
{ |
|||
int lightIndex = unity_4LightIndices0[lightIter]; |
|||
LightInput lightInput; |
|||
INITIALIZE_LIGHT(lightInput, lightIndex); |
|||
|
|||
half3 lightDirection; |
|||
half atten = ComputeLightAttenuationVertex(lightInput, o.normal, worldPos, lightDirection); |
|||
o.fogCoord.yzw += LightingLambert(diffuse, lightDirection, normal, atten); |
|||
} |
|||
#endif |
|||
|
|||
#if defined(_LIGHT_PROBES_ON) && !defined(LIGHTMAP_ON) |
|||
o.fogCoord.yzw += max(half3(0, 0, 0), ShadeSH9(half4(o.normal, 1))); |
|||
#endif |
|||
|
|||
UNITY_TRANSFER_FOG(o, o.hpos); |
|||
return o; |
|||
} |
|||
|
|||
#endif |
|
|||
#ifndef LIGHTWEIGHT_FASTBLINN_INCLUDED |
|||
#define LIGHTWEIGHT_FASTBLINN_INCLUDED |
|||
|
|||
#include "UnityStandardInput.cginc" |
|||
#include "LightweightCore.cginc" |
|||
|
|||
struct SurfaceFastBlinn |
|||
{ |
|||
float3 Diffuse; // diffuse color |
|||
float3 Specular; // specular color |
|||
float Shininess; |
|||
float3 Normal; // tangent space normal, if written |
|||
half3 Emission; |
|||
half Glossiness; // 0=rough, 1=smooth |
|||
float Alpha; // alpha for transparencies |
|||
}; |
|||
|
|||
SurfaceFastBlinn InitializeSurfaceFastBlinn() |
|||
{ |
|||
SurfaceFastBlinn s; |
|||
s.Diffuse = float3(0.5, 0.5, 0.5); |
|||
s.Specular = float3(0, 0, 0); |
|||
s.Shininess = 0.5; |
|||
s.Normal = float3(.5, .5, 1); |
|||
s.Emission = 0; |
|||
s.Glossiness = 0; |
|||
s.Alpha = 1; |
|||
return s; |
|||
} |
|||
|
|||
void DefineSurface(VertOutput i, inout SurfaceFastBlinn o); |
|||
|
|||
half4 LightweightFragmentFastBlinn(VertOutput i) : SV_Target |
|||
{ |
|||
SurfaceFastBlinn o = InitializeSurfaceFastBlinn(); |
|||
DefineSurface(i, o); |
|||
|
|||
_Shininess = o.Shininess; |
|||
|
|||
// Keep for compatibility reasons. Shader Inpector throws a warning when using cutoff |
|||
// due overdraw performance impact. |
|||
#ifdef _ALPHATEST_ON |
|||
clip(o.Alpha - _Cutoff); |
|||
#endif |
|||
|
|||
half3 normal; |
|||
#if _NORMALMAP |
|||
half3 tangentToWorld0 = half3(i.tangent.x, i.binormal.x, i.normal.x); |
|||
half3 tangentToWorld1 = half3(i.tangent.y, i.binormal.y, i.normal.y); |
|||
half3 tangentToWorld2 = half3(i.tangent.z, i.binormal.z, i.normal.z); |
|||
normal = normalize(half3(dot(o.Normal, tangentToWorld0), dot(o.Normal, tangentToWorld1), dot(o.Normal, tangentToWorld2))); |
|||
#else |
|||
normal = normalize(i.normal); |
|||
#endif |
|||
|
|||
half3 viewDir = i.viewDir.xyz; |
|||
float3 worldPos = i.posWS.xyz; |
|||
|
|||
half3 lightDirection; |
|||
|
|||
half4 specularGloss = half4(o.Specular, o.Glossiness); |
|||
|
|||
#ifdef _SHADOWS |
|||
#if _NORMALMAP |
|||
half3 vertexNormal = half3(tangentToWorld0.z, tangentToWorld1.z, tangentToWorld2.z); // Fix this |
|||
#else |
|||
half3 vertexNormal = i.normal; |
|||
#endif |
|||
#endif |
|||
|
|||
#ifndef _MULTIPLE_LIGHTS |
|||
LightInput lightInput; |
|||
INITIALIZE_MAIN_LIGHT(lightInput); |
|||
half lightAtten = ComputeLightAttenuation(lightInput, normal, worldPos, lightDirection); |
|||
#ifdef _SHADOWS |
|||
lightAtten *= ComputeShadowAttenuation(vertexNormal, i.posWS, _ShadowLightDirection.xyz); |
|||
#endif |
|||
|
|||
#ifdef _SPECULARHIGHLIGHTS_ON |
|||
half3 color = LightingBlinnPhong(o.Diffuse, specularGloss, lightDirection, normal, viewDir, lightAtten) * lightInput.color; |
|||
#else |
|||
half3 color = LightingLambert(o.Diffuse, lightDirection, normal, lightAtten) * lightInput.color; |
|||
#endif |
|||
|
|||
#else |
|||
half3 color = half3(0, 0, 0); |
|||
|
|||
#ifdef _SHADOWS |
|||
half shadowAttenuation = ComputeShadowAttenuation(vertexNormal, i.posWS, _ShadowLightDirection.xyz); |
|||
#endif |
|||
int pixelLightCount = min(globalLightCount.x, unity_LightIndicesOffsetAndCount.y); |
|||
for (int lightIter = 0; lightIter < pixelLightCount; ++lightIter) |
|||
{ |
|||
LightInput lightData; |
|||
int lightIndex = unity_4LightIndices0[lightIter]; |
|||
INITIALIZE_LIGHT(lightData, lightIndex); |
|||
half lightAtten = ComputeLightAttenuation(lightData, normal, worldPos, lightDirection); |
|||
#ifdef _SHADOWS |
|||
lightAtten *= max(shadowAttenuation, half(lightIndex != _ShadowData.x)); |
|||
#endif |
|||
|
|||
#ifdef _SPECULARHIGHLIGHTS_ON |
|||
color += LightingBlinnPhong(o.Diffuse, specularGloss, lightDirection, normal, viewDir, lightAtten) * lightData.color; |
|||
#else |
|||
color += LightingLambert(o.Diffuse, lightDirection, normal, lightAtten) * lightData.color; |
|||
#endif |
|||
} |
|||
|
|||
#endif // _MULTIPLE_LIGHTS |
|||
|
|||
color += o.Emission; |
|||
|
|||
#if defined(LIGHTMAP_ON) |
|||
color += (DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv01.zw)) + i.fogCoord.yzw) * o.Diffuse; |
|||
#elif defined(_VERTEX_LIGHTS) || defined(_LIGHT_PROBES_ON) |
|||
color += i.fogCoord.yzw * o.Diffuse; |
|||
#endif |
|||
|
|||
#if _REFLECTION_CUBEMAP |
|||
// TODO: we can use reflect vec to compute specular instead of half when computing cubemap reflection |
|||
half3 reflectVec = reflect(-i.viewDir.xyz, normal); |
|||
color += texCUBE(_Cube, reflectVec).rgb * o.Specular; |
|||
#elif defined(_REFLECTION_PROBE) |
|||
half3 reflectVec = reflect(-i.viewDir.xyz, normal); |
|||
half4 reflectionProbe = UNITY_SAMPLE_TEXCUBE(unity_SpecCube0, reflectVec); |
|||
color += reflectionProbe.rgb * (reflectionProbe.a * unity_SpecCube0_HDR.x) * o.Specular; |
|||
#endif |
|||
|
|||
UNITY_APPLY_FOG(i.fogCoord, color); |
|||
|
|||
return OutputColor(color, o.Alpha); |
|||
}; |
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 34f60d15edc79b040ba710e07e9582a8 |
|||
timeCreated: 1488965025 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef LIGHTWEIGHT_INPUT_INCLUDED |
|||
#define LIGHTWEIGHT_INPUT_INCLUDED |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
#define MAX_VISIBLE_LIGHTS 16 |
|||
|
|||
// Main light initialized without indexing |
|||
#define INITIALIZE_MAIN_LIGHT(light) \ |
|||
light.pos = _LightPosition; \ |
|||
light.color = _LightColor; \ |
|||
light.atten = _LightAttenuationParams; \ |
|||
light.spotDir = _LightSpotDir; |
|||
|
|||
// Indexing might have a performance hit for old mobile hardware |
|||
#define INITIALIZE_LIGHT(light, lightIndex) \ |
|||
light.pos = globalLightPos[lightIndex]; \ |
|||
light.color = globalLightColor[lightIndex]; \ |
|||
light.atten = globalLightAtten[lightIndex]; \ |
|||
light.spotDir = globalLightSpotDir[lightIndex] |
|||
|
|||
#if !(defined(_SINGLE_DIRECTIONAL_LIGHT) || defined(_SINGLE_SPOT_LIGHT) || defined(_SINGLE_POINT_LIGHT)) |
|||
#define _MULTIPLE_LIGHTS |
|||
#endif |
|||
|
|||
#if defined(UNITY_COLORSPACE_GAMMA) && defined(LIGHTWEIGHT_LINEAR) |
|||
// Ideally we want an approximation of gamma curve 2.0 to save ALU on GPU but as off now it won't match the GammaToLinear conversion of props in engine |
|||
//#define LIGHTWEIGHT_GAMMA_TO_LINEAR(gammaColor) gammaColor * gammaColor |
|||
//#define LIGHTWEIGHT_LINEAR_TO_GAMMA(linColor) sqrt(color) |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(sRGB) sRGB * (sRGB * (sRGB * 0.305306011h + 0.682171111h) + 0.012522878h) |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(linRGB) max(1.055h * pow(max(linRGB, 0.h), 0.416666667h) - 0.055h, 0.h) |
|||
|
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR4(sRGBA) float4(sRGBA.rgb * (sRGBA.rgb * (sRGBA.rgb * 0.305306011h + 0.682171111h) + 0.012522878h), sRGBA.a) |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA4(linRGBA) float4(max(1.055h * pow(max(linRGBA.rgb, 0.h), 0.416666667h) - 0.055h, 0.h), linRGBA.a) |
|||
#else |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(color) color |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(color) color |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR4(color) color |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA4(color) color |
|||
#endif |
|||
|
|||
|
|||
struct LightInput |
|||
{ |
|||
float4 pos; |
|||
half4 color; |
|||
float4 atten; |
|||
half4 spotDir; |
|||
}; |
|||
|
|||
sampler2D _AttenuationTexture; |
|||
|
|||
// Per object light list data |
|||
#ifdef _MULTIPLE_LIGHTS |
|||
half4 unity_LightIndicesOffsetAndCount; |
|||
half4 unity_4LightIndices0; |
|||
|
|||
// The variables are very similar to built-in unity_LightColor, unity_LightPosition, |
|||
// unity_LightAtten, unity_SpotDirection as used by the VertexLit shaders, except here |
|||
// we use world space positions instead of view space. |
|||
half4 globalLightCount; |
|||
half4 globalLightColor[MAX_VISIBLE_LIGHTS]; |
|||
float4 globalLightPos[MAX_VISIBLE_LIGHTS]; |
|||
half4 globalLightSpotDir[MAX_VISIBLE_LIGHTS]; |
|||
float4 globalLightAtten[MAX_VISIBLE_LIGHTS]; |
|||
#else |
|||
float4 _LightPosition; |
|||
half4 _LightColor; |
|||
float4 _LightAttenuationParams; |
|||
half4 _LightSpotDir; |
|||
#endif |
|||
|
|||
sampler2D _MetallicSpecGlossMap; |
|||
|
|||
half4 _DieletricSpec; |
|||
half _Shininess; |
|||
samplerCUBE _Cube; |
|||
half4 _ReflectColor; |
|||
|
|||
struct VertInput |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float3 normal : NORMAL; |
|||
float4 tangent : TANGENT; |
|||
float4 texcoord0 : TEXCOORD0; |
|||
float2 lightmapUV : TEXCOORD1; |
|||
#ifdef VERTINPUT_CUSTOM |
|||
VERTINPUT_CUSTOM; |
|||
#endif |
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct VertOutput |
|||
{ |
|||
float4 posWS : TEXCOORD0; |
|||
float4 viewDir : TEXCOORD1; // xyz: viewDir |
|||
half4 fogCoord : TEXCOORD2; // x: fogCoord, yzw: vertexColor |
|||
half3 normal : TEXCOORD3; |
|||
half4 meshUV0 : TEXCOORD4; // uv01.xy: uv0, uv01.zw: uv1 |
|||
#ifdef VERTOUTPUT_CUSTOM |
|||
VERTOUTPUT_CUSTOM |
|||
#endif |
|||
float4 hpos : SV_POSITION; |
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
#endif |
|
|||
#ifndef LIGHTWEIGHT_PBR_INCLUDED |
|||
#define LIGHTWEIGHT_PBR_INCLUDED |
|||
|
|||
#include "UnityStandardInput.cginc" |
|||
#include "LightweightShadows.cginc" |
|||
#include "LightweightBRDF.cginc" |
|||
#include "LightweightCore.cginc" |
|||
|
|||
struct SurfacePBR |
|||
{ |
|||
float3 Albedo; // diffuse color |
|||
float3 Specular; // specular color |
|||
float Metallic; // metallic |
|||
float3 Normal; // tangent space normal, if written |
|||
half3 Emission; |
|||
half Smoothness; // 0=rough, 1=smooth |
|||
half Occlusion; // occlusion (default 1) |
|||
float Alpha; // alpha for transparencies |
|||
}; |
|||
|
|||
SurfacePBR InitializeSurfacePBR() |
|||
{ |
|||
SurfacePBR s; |
|||
s.Albedo = float3(0.5, 0.5, 0.5); |
|||
s.Specular = float3(0, 0, 0); |
|||
s.Metallic = 0; |
|||
s.Normal = float3(.5, .5, 1); |
|||
s.Emission = 0; |
|||
s.Smoothness = 0; |
|||
s.Occlusion = 1; |
|||
s.Alpha = 1; |
|||
return s; |
|||
} |
|||
|
|||
void DefineSurface(VertOutput i, inout SurfacePBR o); |
|||
|
|||
half3 MetallicSetup(float2 uv, SurfacePBR s, out half3 specular, out half smoothness, out half oneMinusReflectivity) |
|||
{ |
|||
smoothness = s.Smoothness;// metallicGloss.g; |
|||
|
|||
// We'll need oneMinusReflectivity, so |
|||
// 1-reflectivity = 1-lerp(dielectricSpec, 1, metallic) = lerp(1-dielectricSpec, 0, metallic) |
|||
// store (1-dielectricSpec) in unity_ColorSpaceDielectricSpec.a, then |
|||
// 1-reflectivity = lerp(alpha, 0, metallic) = alpha + metallic*(0 - alpha) = |
|||
// = alpha - metallic * alpha |
|||
half oneMinusDielectricSpec = _DieletricSpec.a; |
|||
oneMinusReflectivity = oneMinusDielectricSpec - s.Metallic * oneMinusDielectricSpec; |
|||
specular = lerp(_DieletricSpec.rgb, s.Albedo, s.Metallic); |
|||
|
|||
return s.Albedo * oneMinusReflectivity; |
|||
} |
|||
|
|||
half3 SpecularSetup(float2 uv, SurfacePBR s, out half3 specular, out half smoothness, out half oneMinusReflectivity) |
|||
{ |
|||
half4 specGloss = float4(s.Specular, s.Smoothness); |
|||
specular = specGloss.rgb; |
|||
smoothness = specGloss.a; |
|||
oneMinusReflectivity = 1.0h - SpecularReflectivity(specular); |
|||
return s.Albedo * (half3(1, 1, 1) - specular); |
|||
} |
|||
|
|||
half4 LightweightFragmentPBR(VertOutput i) : SV_Target |
|||
{ |
|||
SurfacePBR o = InitializeSurfacePBR(); |
|||
DefineSurface(i, o); |
|||
|
|||
//float2 uv = i.mesUV0.xy; |
|||
float2 lightmapUV = i.meshUV0.zw; |
|||
|
|||
half3 specColor; |
|||
half smoothness; |
|||
half oneMinusReflectivity; |
|||
#ifdef _METALLIC_SETUP |
|||
half3 diffColor = MetallicSetup(i.meshUV0.xy, o, specColor, smoothness, oneMinusReflectivity); |
|||
#else |
|||
half3 diffColor = SpecularSetup(i.meshUV0.xy, o, specColor, smoothness, oneMinusReflectivity); |
|||
#endif |
|||
|
|||
diffColor = PreMultiplyAlpha(diffColor, o.Alpha, oneMinusReflectivity, /*out*/ o.Alpha); |
|||
|
|||
// Roughness is (1.0 - smoothness)² |
|||
half perceptualRoughness = 1.0h - smoothness; |
|||
|
|||
half3 normal; |
|||
#if _NORMALMAP |
|||
half3 tangentToWorld0 = half3(i.tangent.x, i.binormal.x, i.normal.x); |
|||
half3 tangentToWorld1 = half3(i.tangent.y, i.binormal.y, i.normal.y); |
|||
half3 tangentToWorld2 = half3(i.tangent.z, i.binormal.z, i.normal.z); |
|||
normal = normalize(half3(dot(o.Normal, tangentToWorld0), dot(o.Normal, tangentToWorld1), dot(o.Normal, tangentToWorld2))); |
|||
#else |
|||
normal = normalize(i.normal); |
|||
#endif |
|||
|
|||
// TODO: shader keyword for occlusion |
|||
// TODO: Reflection Probe blend support. |
|||
half3 reflectVec = reflect(-i.viewDir.xyz, normal); |
|||
|
|||
UnityIndirect indirectLight = LightweightGI(lightmapUV, i.fogCoord.yzw, reflectVec, o.Occlusion, perceptualRoughness); |
|||
|
|||
// PBS |
|||
// grazingTerm = F90 |
|||
half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity)); |
|||
half fresnelTerm = Pow4(1.0 - saturate(dot(normal, i.viewDir.xyz))); |
|||
half3 color = LightweightBRDFIndirect(diffColor, specColor, indirectLight, perceptualRoughness * perceptualRoughness, grazingTerm, fresnelTerm); |
|||
half3 lightDirection; |
|||
|
|||
#ifdef _SHADOWS |
|||
#if _NORMALMAP |
|||
half3 vertexNormal = half3(tangentToWorld0.z, tangentToWorld1.z, tangentToWorld2.z); // Fix this |
|||
#else |
|||
half3 vertexNormal = i.normal; |
|||
#endif |
|||
#endif |
|||
|
|||
#ifndef _MULTIPLE_LIGHTS |
|||
LightInput light; |
|||
INITIALIZE_MAIN_LIGHT(light); |
|||
half lightAtten = ComputeLightAttenuation(light, normal, i.posWS.xyz, lightDirection); |
|||
|
|||
#ifdef _SHADOWS |
|||
lightAtten *= ComputeShadowAttenuation(vertexNormal, i.posWS, _ShadowLightDirection.xyz); |
|||
#endif |
|||
|
|||
half NdotL = saturate(dot(normal, lightDirection)); |
|||
half3 radiance = light.color * (lightAtten * NdotL); |
|||
color += LightweightBDRF(diffColor, specColor, oneMinusReflectivity, perceptualRoughness, normal, lightDirection, i.viewDir.xyz) * radiance; |
|||
#else |
|||
|
|||
#ifdef _SHADOWS |
|||
half shadowAttenuation = ComputeShadowAttenuation(vertexNormal, i.posWS, _ShadowLightDirection.xyz); |
|||
#endif |
|||
int pixelLightCount = min(globalLightCount.x, unity_LightIndicesOffsetAndCount.y); |
|||
for (int lightIter = 0; lightIter < pixelLightCount; ++lightIter) |
|||
{ |
|||
LightInput light; |
|||
int lightIndex = unity_4LightIndices0[lightIter]; |
|||
INITIALIZE_LIGHT(light, lightIndex); |
|||
half lightAtten = ComputeLightAttenuation(light, normal, i.posWS.xyz, lightDirection); |
|||
#ifdef _SHADOWS |
|||
lightAtten *= max(shadowAttenuation, half(lightIndex != _ShadowData.x)); |
|||
#endif |
|||
half NdotL = saturate(dot(normal, lightDirection)); |
|||
half3 radiance = light.color * (lightAtten * NdotL); |
|||
|
|||
color += LightweightBDRF(diffColor, specColor, oneMinusReflectivity, perceptualRoughness, normal, lightDirection, i.viewDir.xyz) * radiance; |
|||
} |
|||
#endif |
|||
|
|||
color += o.Emission; |
|||
UNITY_APPLY_FOG(i.fogCoord, color); |
|||
return OutputColor(color, o.Alpha); |
|||
} |
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 7cfc2533f15ff004ca757daee1df2c37 |
|||
timeCreated: 1488965025 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef LIGHTWEIGHT_PASS_INCLUDED |
|||
#define LIGHTWEIGHT_PASS_INCLUDED |
|||
|
|||
float4 shadowVert(float4 pos : POSITION) : SV_POSITION |
|||
{ |
|||
float4 clipPos = UnityObjectToClipPos(pos); |
|||
#if defined(UNITY_REVERSED_Z) |
|||
clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); |
|||
#else |
|||
clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); |
|||
#endif |
|||
return clipPos; |
|||
} |
|||
|
|||
half4 shadowFrag() : SV_TARGET |
|||
{ |
|||
return 0; |
|||
} |
|||
|
|||
float4 depthVert(float4 pos : POSITION) : SV_POSITION |
|||
{ |
|||
return UnityObjectToClipPos(pos); |
|||
} |
|||
|
|||
half4 depthFrag() : SV_TARGET |
|||
{ |
|||
return 0; |
|||
} |
|||
|
|||
// -------------------------------- |
|||
// Meta |
|||
|
|||
#include "UnityStandardMeta.cginc" |
|||
#include "LightweightFastBlinn.cginc" |
|||
|
|||
struct VertOutput_Meta |
|||
{ |
|||
float4 meshUV0 : TEXCOORD0; |
|||
float4 pos : SV_POSITION; |
|||
}; |
|||
|
|||
VertOutput_Meta Vert_Meta(VertexInput v) |
|||
{ |
|||
VertOutput_Meta o; |
|||
o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); |
|||
o.meshUV0 = TexCoords(v); |
|||
return o; |
|||
} |
|||
|
|||
void DefineSurfaceMeta(VertOutput_Meta i, inout SurfaceFastBlinn s); |
|||
|
|||
fixed4 frag_meta_ld(VertOutput_Meta i) : SV_Target |
|||
{ |
|||
UnityMetaInput o; |
|||
UNITY_INITIALIZE_OUTPUT(UnityMetaInput, o); |
|||
|
|||
SurfaceFastBlinn s = InitializeSurfaceFastBlinn(); |
|||
DefineSurfaceMeta(i, s); |
|||
|
|||
o.Albedo = s.Diffuse; |
|||
o.SpecularColor = s.Specular; |
|||
o.Emission = s.Emission; |
|||
|
|||
return UnityMetaFragment(o); |
|||
} |
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 83e29b5f678b4c847bb1d9677843726d |
|||
timeCreated: 1488965025 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef LIGHTWEIGHT_UNLIT_INCLUDED |
|||
#define LIGHTWEIGHT_UNLIT_INCLUDED |
|||
|
|||
struct appdata_unlit |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float4 texcoord0 : TEXCOORD0; |
|||
#ifdef VERTINPUT_CUSTOM |
|||
VERTINPUT_CUSTOM; |
|||
#endif |
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct LightweightVertexOutputUnlit |
|||
{ |
|||
float4 meshUV0 : TEXCOORD0; |
|||
UNITY_FOG_COORDS(1) |
|||
float4 vertex : SV_POSITION; |
|||
#ifdef VERTOUTPUT_CUSTOM |
|||
VERTOUTPUT_CUSTOM |
|||
#endif |
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
struct SurfaceUnlit |
|||
{ |
|||
float3 Color; // color |
|||
float Alpha; // alpha for transparencies |
|||
}; |
|||
|
|||
SurfaceUnlit InitializeSurfaceUnlit() |
|||
{ |
|||
SurfaceUnlit s; |
|||
s.Color = float3(0.5, 0.5, 0.5); |
|||
s.Alpha = 1; |
|||
return s; |
|||
} |
|||
|
|||
void DefineSurface(LightweightVertexOutputUnlit i, inout SurfaceUnlit s); |
|||
|
|||
sampler2D _MainTex; |
|||
float4 _MainTex_ST; |
|||
half4 _Color; |
|||
half _Cutoff; |
|||
|
|||
LightweightVertexOutputUnlit LightweightVertexUnlit(appdata_unlit v) |
|||
{ |
|||
LightweightVertexOutputUnlit o; |
|||
|
|||
UNITY_SETUP_INSTANCE_ID(v); |
|||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|||
|
|||
#ifdef VERTEX_CUSTOM |
|||
VERTEX_CUSTOM; |
|||
#endif |
|||
|
|||
o.vertex = UnityObjectToClipPos(v.vertex); |
|||
o.meshUV0 = float4(0, 0, 0, 0); |
|||
o.meshUV0.xy = v.texcoord0.xy;// TRANSFORM_TEX(v.texcoord0, _MainTex); |
|||
UNITY_TRANSFER_FOG(o,o.vertex); |
|||
return o; |
|||
} |
|||
|
|||
half4 LightweightFragmentUnlit(LightweightVertexOutputUnlit i) : SV_Target |
|||
{ |
|||
SurfaceUnlit s = InitializeSurfaceUnlit(); |
|||
DefineSurface(i, s); |
|||
|
|||
UNITY_APPLY_FOG(i.fogCoord, s.Color); |
|||
|
|||
#ifdef _ALPHABLEND_ON |
|||
return fixed4(s.Color, s.Alpha); |
|||
#else |
|||
return fixed4(s.Color, 1.0); |
|||
#endif |
|||
}; |
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 48b597269e31da549b83620e270727a5 |
|||
timeCreated: 1488965025 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1ac259924f8784a4aa1eb5e9e556b08d |
|||
timeCreated: 1478188276 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Serializable] |
|||
[Title("Master/Lightweight/PBR Metallic")] |
|||
public class LightweightMetallicMasterNode : AbstractLightweightPBRMasterNode |
|||
{ |
|||
public const string MetallicSlotName = "Metallic"; |
|||
public const int MetallicSlotId = 2; |
|||
|
|||
public const string WorkflowName = "Metallic"; |
|||
|
|||
public LightweightMetallicMasterNode() |
|||
{ |
|||
name = "LightweightMetallicMasterNode"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(VertexOffsetId, VertexOffsetName, VertexOffsetName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Vertex)); |
|||
AddSlot(new MaterialSlot(AlbedoSlotId, AlbedoSlotName, AlbedoSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(NormalSlotId, NormalSlotName, NormalSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(EmissionSlotId, EmissionSlotName, EmissionSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(MetallicSlotId, MetallicSlotName, MetallicSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(SmoothnessSlotId, SmoothnessSlotName, SmoothnessSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(OcclusionSlotId, OcclusionSlotName, OcclusionSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(AlphaSlotId, AlphaSlotName, AlphaSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
|
|||
// clear out slot names that do not match the slots
|
|||
// we support
|
|||
RemoveSlotsNameNotMatching( |
|||
new[] |
|||
{ |
|||
AlbedoSlotId, |
|||
NormalSlotId, |
|||
EmissionSlotId, |
|||
MetallicSlotId, |
|||
SmoothnessSlotId, |
|||
OcclusionSlotId, |
|||
AlphaSlotId, |
|||
VertexOffsetId |
|||
}); |
|||
} |
|||
|
|||
protected override int[] surfaceInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
AlbedoSlotId, |
|||
NormalSlotId, |
|||
EmissionSlotId, |
|||
MetallicSlotId, |
|||
SmoothnessSlotId, |
|||
OcclusionSlotId, |
|||
AlphaSlotId, |
|||
}; |
|||
} |
|||
} |
|||
|
|||
protected override int[] vertexInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
VertexOffsetId |
|||
}; |
|||
} |
|||
} |
|||
|
|||
public override string GetWorkflowName() |
|||
{ |
|||
return WorkflowName; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4b9e77744d433de4186738959cadcfca |
|||
timeCreated: 1478188276 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 7878b24712c094649abcc7b75433986c |
|||
timeCreated: 1505339540 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Serializable] |
|||
[Title("Master/Lightweight/PBR Specular")] |
|||
public class LightweightSpecularMasterNode : AbstractLightweightPBRMasterNode |
|||
{ |
|||
public const string SpecularSlotName = "Specular"; |
|||
public const int SpecularSlotId = 2; |
|||
|
|||
public const string WorkflowName = "Specular"; |
|||
|
|||
public LightweightSpecularMasterNode() |
|||
{ |
|||
name = "LightweightSpecularMasterNode"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(VertexOffsetId, VertexOffsetName, VertexOffsetName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Vertex)); |
|||
AddSlot(new MaterialSlot(AlbedoSlotId, AlbedoSlotName, AlbedoSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(NormalSlotId, NormalSlotName, NormalSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(EmissionSlotId, EmissionSlotName, EmissionSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(SpecularSlotId, SpecularSlotName, SpecularSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(SmoothnessSlotId, SmoothnessSlotName, SmoothnessSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(OcclusionSlotId, OcclusionSlotName, OcclusionSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(AlphaSlotId, AlphaSlotName, AlphaSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
|
|||
// clear out slot names that do not match the slots
|
|||
// we support
|
|||
RemoveSlotsNameNotMatching( |
|||
new[] |
|||
{ |
|||
AlbedoSlotId, |
|||
NormalSlotId, |
|||
EmissionSlotId, |
|||
SpecularSlotId, |
|||
SmoothnessSlotId, |
|||
OcclusionSlotId, |
|||
AlphaSlotId, |
|||
VertexOffsetId |
|||
}); |
|||
} |
|||
|
|||
protected override int[] surfaceInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
AlbedoSlotId, |
|||
NormalSlotId, |
|||
EmissionSlotId, |
|||
SpecularSlotId, |
|||
SmoothnessSlotId, |
|||
OcclusionSlotId, |
|||
AlphaSlotId, |
|||
}; |
|||
} |
|||
} |
|||
|
|||
protected override int[] vertexInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
VertexOffsetId |
|||
}; |
|||
} |
|||
} |
|||
|
|||
public override string GetWorkflowName() |
|||
{ |
|||
return WorkflowName; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: bf358c1c084b6cf4b9a4a9cc49cd61f0 |
|||
timeCreated: 1478188276 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 19fc28fd8cfc0e24185139d888b580e0 |
|||
folderAsset: yes |
|||
timeCreated: 1505498024 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: dd9161734a395a842b4c7efb8eaee2b0 |
|||
timeCreated: 1478188276 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text.RegularExpressions; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Serializable] |
|||
public abstract class AbstractLightweightPBRMasterNode : AbstractMasterNode |
|||
{ |
|||
public const string AlbedoSlotName = "Albedo"; |
|||
public const string NormalSlotName = "Normal"; |
|||
public const string EmissionSlotName = "Emission"; |
|||
public const string SmoothnessSlotName = "Smoothness"; |
|||
public const string OcclusionSlotName = "Occlusion"; |
|||
public const string AlphaSlotName = "Alpha"; |
|||
public const string VertexOffsetName = "VertexPosition"; |
|||
|
|||
public const int AlbedoSlotId = 0; |
|||
public const int NormalSlotId = 1; |
|||
public const int EmissionSlotId = 3; |
|||
public const int SmoothnessSlotId = 4; |
|||
public const int OcclusionSlotId = 5; |
|||
public const int AlphaSlotId = 6; |
|||
public const int VertexOffsetId = 7; |
|||
|
|||
[SerializeField] |
|||
private SurfaceMaterialOptions m_MaterialOptions = new SurfaceMaterialOptions(); |
|||
|
|||
public SurfaceMaterialOptions options |
|||
{ |
|||
get { return m_MaterialOptions; } |
|||
} |
|||
|
|||
public abstract string GetWorkflowName(); |
|||
|
|||
|
|||
void GenerateNodeFunctionsAndPropertyUsages( |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator nodeFunction, |
|||
GenerationMode mode, |
|||
int[] validNodeIds) |
|||
{ |
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this, NodeUtils.IncludeSelf.Include, |
|||
new List<int>(validNodeIds)); |
|||
|
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
{ |
|||
if (node is IGeneratesFunction) |
|||
(node as IGeneratesFunction).GenerateNodeFunction(nodeFunction, mode); |
|||
|
|||
node.GeneratePropertyUsages(propertyUsages, mode); |
|||
} |
|||
|
|||
var nodes = ListPool<INode>.Get(); |
|||
//Get the rest of the nodes for all the other slots
|
|||
NodeUtils.DepthFirstCollectNodesFromNode(nodes, this, NodeUtils.IncludeSelf.Exclude, new List<int>(vertexInputs)); |
|||
for (var i = 0; i < nodes.Count; i++) |
|||
{ |
|||
var node = nodes[i]; |
|||
if (node is IGeneratesBodyCode) |
|||
(node as IGeneratesBodyCode).GenerateNodeCode(shaderBody, mode); |
|||
} |
|||
ListPool<INode>.Release(nodes); |
|||
} |
|||
|
|||
void GenerateVertexShaderInternal( |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator nodeFunction, |
|||
ShaderGenerator vertexShaderBlock, |
|||
GenerationMode mode) |
|||
{ |
|||
GenerateNodeFunctionsAndPropertyUsages(vertexShaderBlock, propertyUsages, nodeFunction, mode, vertexInputs); |
|||
|
|||
var slot = FindInputSlot<MaterialSlot>(VertexOffsetId); |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
vertexShaderBlock.AddShaderChunk("v.vertex.xyz += " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true); |
|||
} |
|||
} |
|||
|
|||
public override string GetSubShader(GenerationMode mode, PropertyGenerator shaderPropertiesVisitor) |
|||
{ |
|||
var templateLocation = ShaderGenerator.GetTemplatePath("lightweightSubshaderPBR.template"); |
|||
|
|||
if (!File.Exists(templateLocation)) |
|||
return string.Empty; |
|||
|
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this); |
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
node.GeneratePropertyBlock(shaderPropertiesVisitor, mode); |
|||
|
|||
var templateText = File.ReadAllText(templateLocation); |
|||
var shaderBodyVisitor = new ShaderGenerator(); |
|||
var shaderFunctionVisitor = new ShaderGenerator(); |
|||
var shaderPropertyUsagesVisitor = new ShaderGenerator(); |
|||
var shaderInputVisitor = new ShaderGenerator(); |
|||
var shaderOutputVisitor = new ShaderGenerator(); |
|||
var vertexShaderBlock = new ShaderGenerator(); |
|||
var definesVisitor = new ShaderGenerator(); |
|||
|
|||
GenerateSurfaceShaderInternal( |
|||
shaderPropertyUsagesVisitor, |
|||
shaderBodyVisitor, |
|||
shaderFunctionVisitor, |
|||
shaderInputVisitor, |
|||
shaderOutputVisitor, |
|||
vertexShaderBlock, |
|||
definesVisitor, |
|||
mode); |
|||
|
|||
GenerateVertexShaderInternal( |
|||
shaderPropertyUsagesVisitor, |
|||
shaderBodyVisitor, |
|||
shaderFunctionVisitor, |
|||
vertexShaderBlock, |
|||
mode); |
|||
|
|||
var tagsVisitor = new ShaderGenerator(); |
|||
var blendingVisitor = new ShaderGenerator(); |
|||
var cullingVisitor = new ShaderGenerator(); |
|||
var zTestVisitor = new ShaderGenerator(); |
|||
var zWriteVisitor = new ShaderGenerator(); |
|||
|
|||
m_MaterialOptions.GetTags(tagsVisitor); |
|||
m_MaterialOptions.GetBlend(blendingVisitor); |
|||
m_MaterialOptions.GetCull(cullingVisitor); |
|||
m_MaterialOptions.GetDepthTest(zTestVisitor); |
|||
m_MaterialOptions.GetDepthWrite(zWriteVisitor); |
|||
|
|||
GetDefines(definesVisitor); |
|||
|
|||
var resultShader = templateText.Replace("${ShaderPropertyUsages}", shaderPropertyUsagesVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ShaderFunctions}", shaderFunctionVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${VertexInputs}", shaderInputVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${VertexOutputs}", shaderOutputVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${PixelShaderBody}", shaderBodyVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${Tags}", tagsVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Blending}", blendingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Culling}", cullingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZTest}", zTestVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZWrite}", zWriteVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${LOD}", "" + m_MaterialOptions.lod); |
|||
|
|||
resultShader = resultShader.Replace("${Defines}", definesVisitor.GetShaderString(2)); |
|||
|
|||
resultShader = resultShader.Replace("${VertexShaderBody}", vertexShaderBlock.GetShaderString(3)); |
|||
|
|||
return resultShader; |
|||
} |
|||
|
|||
public void GetDefines(ShaderGenerator visitor) |
|||
{ |
|||
if(GetWorkflowName() == "Metallic") |
|||
visitor.AddShaderChunk("#define _METALLIC_SETUP 1", true); |
|||
else |
|||
visitor.AddShaderChunk("", false); |
|||
visitor.AddShaderChunk("#define _GLOSSYREFLECTIONS_ON", true); |
|||
visitor.AddShaderChunk("#define _SPECULARHIGHLIGHTS_ON", true); |
|||
} |
|||
|
|||
public override string GetFullShader(GenerationMode mode, string name, out List<PropertyGenerator.TextureInfo> configuredTextures) |
|||
{ |
|||
var templateLocation = ShaderGenerator.GetTemplatePath("shader.template"); |
|||
|
|||
if (!File.Exists(templateLocation)) |
|||
{ |
|||
configuredTextures = new List<PropertyGenerator.TextureInfo>(); |
|||
return string.Empty; |
|||
} |
|||
|
|||
var templateText = File.ReadAllText(templateLocation); |
|||
|
|||
var shaderPropertiesVisitor = new PropertyGenerator(); |
|||
var resultShader = templateText.Replace("${ShaderName}", name); |
|||
resultShader = resultShader.Replace("${SubShader}", GetSubShader(mode, shaderPropertiesVisitor)); |
|||
resultShader = resultShader.Replace("${ShaderPropertiesHeader}", shaderPropertiesVisitor.GetShaderString(2)); |
|||
configuredTextures = shaderPropertiesVisitor.GetConfiguredTexutres(); |
|||
|
|||
Debug.Log(resultShader); |
|||
|
|||
return Regex.Replace(resultShader, @"\r\n|\n\r|\n|\r", Environment.NewLine); |
|||
} |
|||
|
|||
protected abstract int[] surfaceInputs |
|||
{ |
|||
get; |
|||
} |
|||
|
|||
protected abstract int[] vertexInputs |
|||
{ |
|||
get; |
|||
} |
|||
|
|||
private void GenerateSurfaceShaderInternal( |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator nodeFunction, |
|||
ShaderGenerator shaderInputVisitor, |
|||
ShaderGenerator shaderOutputVisitor, |
|||
ShaderGenerator vertexShaderBlock, |
|||
ShaderGenerator definesVisitor, |
|||
GenerationMode mode) |
|||
{ |
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this, NodeUtils.IncludeSelf.Include, |
|||
new List<int>(surfaceInputs)); |
|||
|
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
{ |
|||
if (node is IGeneratesFunction) |
|||
{ |
|||
((IGeneratesFunction)node).GenerateNodeFunction(nodeFunction, mode); |
|||
} |
|||
|
|||
node.GeneratePropertyUsages(propertyUsages, mode); |
|||
} |
|||
|
|||
int vertInputIndex = 2; |
|||
int vertOutputIndex = 5; |
|||
|
|||
// always add everything because why not.
|
|||
/*shaderInputVisitor.AddShaderChunk("float4 vertex : POSITION; \\", true); |
|||
shaderInputVisitor.AddShaderChunk("half3 normal : NORMAL; \\", true); |
|||
shaderInputVisitor.AddShaderChunk("half4 tangent : TANGENT; \\", true); |
|||
shaderInputVisitor.AddShaderChunk("half4 color : COLOR; \\", true); |
|||
shaderInputVisitor.AddShaderChunk("half4 texcoord0 : TEXCOORD0; \\", true); |
|||
shaderInputVisitor.AddShaderChunk("float2 lightmapUV : TEXCOORD1;", true);*/ |
|||
|
|||
shaderInputVisitor.AddShaderChunk("half4 texcoord1 : TEXCOORD1;", true); |
|||
|
|||
// Need these for lighting
|
|||
/*shaderOutputVisitor.AddShaderChunk("float4 posWS : TEXCOORD0; \\", true); |
|||
shaderOutputVisitor.AddShaderChunk("half4 viewDir : TEXCOORD1; \\", true); |
|||
shaderOutputVisitor.AddShaderChunk("half4 fogCoord : TEXCOORD2; \\", true); |
|||
shaderOutputVisitor.AddShaderChunk("half3 normal : TEXCOORD3; \\", true); |
|||
shaderOutputVisitor.AddShaderChunk("half4 meshUV0 : TEXCOORD4; \\", true); |
|||
shaderOutputVisitor.AddShaderChunk("float4 hpos : SV_POSITION; \\", true);*/ |
|||
|
|||
bool requiresBitangent = activeNodeList.OfType<IMayRequireBitangent>().Any(x => x.RequiresBitangent()); |
|||
bool requiresTangent = activeNodeList.OfType<IMayRequireTangent>().Any(x => x.RequiresTangent()); |
|||
bool requiresViewDirTangentSpace = activeNodeList.OfType<IMayRequireViewDirectionTangentSpace>().Any(x => x.RequiresViewDirectionTangentSpace()); |
|||
bool requiresViewDir = activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection()); |
|||
bool requiresWorldPos = activeNodeList.OfType<IMayRequireWorldPosition>().Any(x => x.RequiresWorldPosition()); |
|||
bool requiresNormal = activeNodeList.OfType<IMayRequireNormal>().Any(x => x.RequiresNormal()); |
|||
bool requiresScreenPosition = activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition()); |
|||
bool requiresVertexColor = activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor()); |
|||
|
|||
foreach (var slot in GetInputSlots<MaterialSlot>()) |
|||
{ |
|||
if (surfaceInputs.Contains(slot.id)) |
|||
{ |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
if (slot.id == NormalSlotId) |
|||
{ |
|||
requiresBitangent = true; |
|||
requiresTangent = true; |
|||
definesVisitor.AddShaderChunk("#define _NORMALMAP 1", true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
for (int uvIndex = 0; uvIndex < ShaderGeneratorNames.UVCount; ++uvIndex) |
|||
{ |
|||
var channel = (UVChannel)uvIndex; |
|||
if (activeNodeList.OfType<IMayRequireMeshUV>().Any(x => x.RequiresMeshUV(channel))) |
|||
{ |
|||
if(uvIndex != 0) |
|||
{ |
|||
shaderInputVisitor.AddShaderChunk(string.Format("half4 texcoord{0} : TEXCOORD{1};", uvIndex, vertInputIndex), true); |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 meshUV{0} : TEXCOORD{1};", uvIndex, vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk(string.Format("o.meshUV{0} = v.texcoord{1};", uvIndex, uvIndex), true); |
|||
vertInputIndex++; |
|||
vertOutputIndex++; |
|||
} |
|||
shaderBody.AddShaderChunk(string.Format("half4 {0} = i.meshUV{1};", channel.GetUVName(), uvIndex), true); |
|||
} |
|||
} |
|||
|
|||
if (requiresViewDir || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceViewDirection + " = i.viewDir;", true); |
|||
} |
|||
|
|||
if (requiresWorldPos) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpacePosition + " = i.posWS;", true); |
|||
} |
|||
|
|||
if (requiresScreenPosition) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 screenPos : TEXCOORD{0};", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.screenPos = ComputeScreenPos(v.vertex);", true); |
|||
shaderBody.AddShaderChunk("float4 " + ShaderGeneratorNames.ScreenPosition + " = i.screenPos;", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresBitangent || requiresTangent || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half3 tangent : TEXCOORD{0}; \\", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.tangent = normalize(UnityObjectToWorldDir(v.tangent)); \\", true); |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceTangent + " = normalize(i.tangent.xyz);", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresBitangent || requiresNormal || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceNormal + " = normalize(i.normal);", true); |
|||
} |
|||
|
|||
if (requiresBitangent || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half3 binormal : TEXCOORD{0};", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.binormal = cross(o.normal, o.tangent) * v.tangent.w;", true); |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceBitangent + " = i.binormal;", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk( |
|||
"float3 " + ShaderGeneratorNames.TangentSpaceViewDirection + ";", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".x = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceTangent + ");", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".y = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceBitangent + ");", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".z = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceNormal + ");", true); |
|||
} |
|||
|
|||
if (requiresVertexColor) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 color : TEXCOORD{0};", vertOutputIndex), true); |
|||
shaderBody.AddShaderChunk("float4 " + ShaderGeneratorNames.VertexColor + " = i.color;", true); |
|||
vertInputIndex++; |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
GenerateNodeCode(shaderBody, propertyUsages, mode); |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator shaderBody, ShaderGenerator propertyUsages, GenerationMode generationMode) |
|||
{ |
|||
var nodes = ListPool<INode>.Get(); |
|||
|
|||
//Get the rest of the nodes for all the other slots
|
|||
NodeUtils.DepthFirstCollectNodesFromNode(nodes, this, NodeUtils.IncludeSelf.Exclude, new List<int>(surfaceInputs)); |
|||
for (var i = 0; i < nodes.Count; i++) |
|||
{ |
|||
var node = nodes[i]; |
|||
if (node is IGeneratesBodyCode) |
|||
(node as IGeneratesBodyCode).GenerateNodeCode(shaderBody, generationMode); |
|||
} |
|||
ListPool<INode>.Release(nodes); |
|||
|
|||
foreach (var slot in GetInputSlots<MaterialSlot>()) |
|||
{ |
|||
if (surfaceInputs.Contains(slot.id)) |
|||
{ |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
shaderBody.AddShaderChunk("o." + slot.shaderOutputName + " = " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true); |
|||
|
|||
if (slot.id == NormalSlotId) |
|||
shaderBody.AddShaderChunk("o." + slot.shaderOutputName + " += 1e-6;", true); |
|||
|
|||
if (slot.id == AlphaSlotId) |
|||
propertyUsages.AddShaderChunk("#define _ALPHAPREMULTIPLY_ON", true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text.RegularExpressions; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Serializable] |
|||
[Title("Master/Lightweight/Fast Blinn")] |
|||
public class LightweightFastBlinnMasterNode : AbstractMasterNode |
|||
{ |
|||
public const string AlbedoSlotName = "Diffuse"; |
|||
public const string SpecularSlotName = "Specular"; |
|||
public const string ShininessSlotName = "Shininess"; |
|||
public const string GlossinessSlotName = "Glossiness"; |
|||
public const string NormalSlotName = "Normal"; |
|||
public const string EmissionSlotName = "Emission"; |
|||
public const string AlphaSlotName = "Alpha"; |
|||
public const string VertexOffsetName = "VertexPosition"; |
|||
|
|||
public const int AlbedoSlotId = 0; |
|||
public const int SpecularSlotId = 1; |
|||
public const int ShininessSlotId = 3; |
|||
public const int GlossinessSlotId = 4; |
|||
public const int NormalSlotId = 5; |
|||
public const int EmissionSlotId = 6; |
|||
public const int AlphaSlotId = 7; |
|||
public const int VertexOffsetId = 8; |
|||
|
|||
[SerializeField] |
|||
private SurfaceMaterialOptions m_MaterialOptions = new SurfaceMaterialOptions(); |
|||
|
|||
public SurfaceMaterialOptions options |
|||
{ |
|||
get { return m_MaterialOptions; } |
|||
} |
|||
|
|||
public LightweightFastBlinnMasterNode() |
|||
{ |
|||
name = "LightweightFastBlinnMasterNode"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(VertexOffsetId, VertexOffsetName, VertexOffsetName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Vertex)); |
|||
AddSlot(new MaterialSlot(AlbedoSlotId, AlbedoSlotName, AlbedoSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(NormalSlotId, NormalSlotName, NormalSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(SpecularSlotId, SpecularSlotName, SpecularSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(ShininessSlotId, ShininessSlotName, ShininessSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(GlossinessSlotId, GlossinessSlotName, GlossinessSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(EmissionSlotId, EmissionSlotName, EmissionSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(AlphaSlotId, AlphaSlotName, AlphaSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
|
|||
// clear out slot names that do not match the slots
|
|||
// we support
|
|||
RemoveSlotsNameNotMatching( |
|||
new[] |
|||
{ |
|||
AlbedoSlotId, |
|||
NormalSlotId, |
|||
EmissionSlotId, |
|||
SpecularSlotId, |
|||
ShininessSlotId, |
|||
GlossinessSlotId, |
|||
AlphaSlotId, |
|||
VertexOffsetId |
|||
}); |
|||
} |
|||
|
|||
protected int[] surfaceInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
AlbedoSlotId, |
|||
NormalSlotId, |
|||
EmissionSlotId, |
|||
SpecularSlotId, |
|||
ShininessSlotId, |
|||
GlossinessSlotId, |
|||
AlphaSlotId, |
|||
}; |
|||
} |
|||
} |
|||
|
|||
protected int[] vertexInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
VertexOffsetId |
|||
}; |
|||
} |
|||
} |
|||
|
|||
void GenerateNodeFunctionsAndPropertyUsages( |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator nodeFunction, |
|||
GenerationMode mode, |
|||
int[] validNodeIds) |
|||
{ |
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this, NodeUtils.IncludeSelf.Include, |
|||
new List<int>(validNodeIds)); |
|||
|
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
{ |
|||
if (node is IGeneratesFunction) |
|||
(node as IGeneratesFunction).GenerateNodeFunction(nodeFunction, mode); |
|||
|
|||
node.GeneratePropertyUsages(propertyUsages, mode); |
|||
} |
|||
|
|||
var nodes = ListPool<INode>.Get(); |
|||
//Get the rest of the nodes for all the other slots
|
|||
NodeUtils.DepthFirstCollectNodesFromNode(nodes, this, NodeUtils.IncludeSelf.Exclude, new List<int>(vertexInputs)); |
|||
for (var i = 0; i < nodes.Count; i++) |
|||
{ |
|||
var node = nodes[i]; |
|||
if (node is IGeneratesBodyCode) |
|||
(node as IGeneratesBodyCode).GenerateNodeCode(shaderBody, mode); |
|||
} |
|||
ListPool<INode>.Release(nodes); |
|||
} |
|||
|
|||
void GenerateVertexShaderInternal( |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator nodeFunction, |
|||
ShaderGenerator vertexShaderBlock, |
|||
GenerationMode mode) |
|||
{ |
|||
GenerateNodeFunctionsAndPropertyUsages(vertexShaderBlock, propertyUsages, nodeFunction, mode, vertexInputs); |
|||
|
|||
var slot = FindInputSlot<MaterialSlot>(VertexOffsetId); |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
vertexShaderBlock.AddShaderChunk("v.vertex.xyz += " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true); |
|||
} |
|||
} |
|||
|
|||
public override string GetSubShader(GenerationMode mode, PropertyGenerator shaderPropertiesVisitor) |
|||
{ |
|||
var templateLocation = ShaderGenerator.GetTemplatePath("lightweightSubshaderFastBlinn.template"); |
|||
|
|||
if (!File.Exists(templateLocation)) |
|||
return string.Empty; |
|||
|
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this); |
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
node.GeneratePropertyBlock(shaderPropertiesVisitor, mode); |
|||
|
|||
var templateText = File.ReadAllText(templateLocation); |
|||
var shaderBodyVisitor = new ShaderGenerator(); |
|||
var shaderFunctionVisitor = new ShaderGenerator(); |
|||
var shaderPropertyUsagesVisitor = new ShaderGenerator(); |
|||
var shaderInputVisitor = new ShaderGenerator(); |
|||
var shaderOutputVisitor = new ShaderGenerator(); |
|||
var vertexShaderBlock = new ShaderGenerator(); |
|||
var definesVisitor = new ShaderGenerator(); |
|||
|
|||
GenerateSurfaceShaderInternal( |
|||
shaderPropertyUsagesVisitor, |
|||
shaderBodyVisitor, |
|||
shaderFunctionVisitor, |
|||
shaderInputVisitor, |
|||
shaderOutputVisitor, |
|||
vertexShaderBlock, |
|||
definesVisitor, |
|||
mode); |
|||
|
|||
GenerateVertexShaderInternal( |
|||
shaderPropertyUsagesVisitor, |
|||
shaderBodyVisitor, |
|||
shaderFunctionVisitor, |
|||
vertexShaderBlock, |
|||
mode); |
|||
|
|||
var tagsVisitor = new ShaderGenerator(); |
|||
var blendingVisitor = new ShaderGenerator(); |
|||
var cullingVisitor = new ShaderGenerator(); |
|||
var zTestVisitor = new ShaderGenerator(); |
|||
var zWriteVisitor = new ShaderGenerator(); |
|||
|
|||
m_MaterialOptions.GetTags(tagsVisitor); |
|||
m_MaterialOptions.GetBlend(blendingVisitor); |
|||
m_MaterialOptions.GetCull(cullingVisitor); |
|||
m_MaterialOptions.GetDepthTest(zTestVisitor); |
|||
m_MaterialOptions.GetDepthWrite(zWriteVisitor); |
|||
|
|||
GetDefines(definesVisitor); |
|||
|
|||
var resultShader = templateText.Replace("${ShaderPropertyUsages}", shaderPropertyUsagesVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ShaderFunctions}", shaderFunctionVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${VertexInputs}", shaderInputVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${VertexOutputs}", shaderOutputVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${PixelShaderBody}", shaderBodyVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${Tags}", tagsVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Blending}", blendingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Culling}", cullingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZTest}", zTestVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZWrite}", zWriteVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${LOD}", "" + m_MaterialOptions.lod); |
|||
|
|||
resultShader = resultShader.Replace("${Defines}", definesVisitor.GetShaderString(2)); |
|||
|
|||
resultShader = resultShader.Replace("${VertexShaderBody}", vertexShaderBlock.GetShaderString(3)); |
|||
|
|||
return resultShader; |
|||
} |
|||
|
|||
public void GetDefines(ShaderGenerator visitor) |
|||
{ |
|||
visitor.AddShaderChunk("#define _GLOSSYREFLECTIONS_ON", true); |
|||
visitor.AddShaderChunk("#define _SPECULARHIGHLIGHTS_ON", true); |
|||
} |
|||
|
|||
public override string GetFullShader(GenerationMode mode, string name, out List<PropertyGenerator.TextureInfo> configuredTextures) |
|||
{ |
|||
var templateLocation = ShaderGenerator.GetTemplatePath("shader.template"); |
|||
|
|||
if (!File.Exists(templateLocation)) |
|||
{ |
|||
configuredTextures = new List<PropertyGenerator.TextureInfo>(); |
|||
return string.Empty; |
|||
} |
|||
|
|||
var templateText = File.ReadAllText(templateLocation); |
|||
|
|||
var shaderPropertiesVisitor = new PropertyGenerator(); |
|||
var resultShader = templateText.Replace("${ShaderName}", name); |
|||
resultShader = resultShader.Replace("${SubShader}", GetSubShader(mode, shaderPropertiesVisitor)); |
|||
resultShader = resultShader.Replace("${ShaderPropertiesHeader}", shaderPropertiesVisitor.GetShaderString(2)); |
|||
configuredTextures = shaderPropertiesVisitor.GetConfiguredTexutres(); |
|||
|
|||
Debug.Log(resultShader); |
|||
|
|||
return Regex.Replace(resultShader, @"\r\n|\n\r|\n|\r", Environment.NewLine); |
|||
} |
|||
|
|||
private void GenerateSurfaceShaderInternal( |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator nodeFunction, |
|||
ShaderGenerator shaderInputVisitor, |
|||
ShaderGenerator shaderOutputVisitor, |
|||
ShaderGenerator vertexShaderBlock, |
|||
ShaderGenerator definesVisitor, |
|||
GenerationMode mode) |
|||
{ |
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this, NodeUtils.IncludeSelf.Include, |
|||
new List<int>(surfaceInputs)); |
|||
|
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
{ |
|||
if (node is IGeneratesFunction) |
|||
{ |
|||
((IGeneratesFunction)node).GenerateNodeFunction(nodeFunction, mode); |
|||
} |
|||
|
|||
node.GeneratePropertyUsages(propertyUsages, mode); |
|||
} |
|||
|
|||
int vertInputIndex = 2; |
|||
int vertOutputIndex = 5; |
|||
|
|||
shaderInputVisitor.AddShaderChunk("half4 texcoord1 : TEXCOORD1;", true); |
|||
|
|||
bool requiresBitangent = activeNodeList.OfType<IMayRequireBitangent>().Any(x => x.RequiresBitangent()); |
|||
bool requiresTangent = activeNodeList.OfType<IMayRequireTangent>().Any(x => x.RequiresTangent()); |
|||
bool requiresViewDirTangentSpace = activeNodeList.OfType<IMayRequireViewDirectionTangentSpace>().Any(x => x.RequiresViewDirectionTangentSpace()); |
|||
bool requiresViewDir = activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection()); |
|||
bool requiresWorldPos = activeNodeList.OfType<IMayRequireWorldPosition>().Any(x => x.RequiresWorldPosition()); |
|||
bool requiresNormal = activeNodeList.OfType<IMayRequireNormal>().Any(x => x.RequiresNormal()); |
|||
bool requiresScreenPosition = activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition()); |
|||
bool requiresVertexColor = activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor()); |
|||
|
|||
foreach (var slot in GetInputSlots<MaterialSlot>()) |
|||
{ |
|||
if (surfaceInputs.Contains(slot.id)) |
|||
{ |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
if (slot.id == NormalSlotId) |
|||
{ |
|||
requiresBitangent = true; |
|||
requiresTangent = true; |
|||
definesVisitor.AddShaderChunk("#define _NORMALMAP 1", true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
for (int uvIndex = 0; uvIndex < ShaderGeneratorNames.UVCount; ++uvIndex) |
|||
{ |
|||
var channel = (UVChannel)uvIndex; |
|||
if (activeNodeList.OfType<IMayRequireMeshUV>().Any(x => x.RequiresMeshUV(channel))) |
|||
{ |
|||
if(uvIndex != 0) |
|||
{ |
|||
shaderInputVisitor.AddShaderChunk(string.Format("half4 texcoord{0} : TEXCOORD{1};", uvIndex, vertInputIndex), true); |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 meshUV{0} : TEXCOORD{1};", uvIndex, vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk(string.Format("o.meshUV{0} = v.texcoord{1};", uvIndex, uvIndex), true); |
|||
vertInputIndex++; |
|||
vertOutputIndex++; |
|||
} |
|||
shaderBody.AddShaderChunk(string.Format("half4 {0} = i.meshUV{1};", channel.GetUVName(), uvIndex), true); |
|||
} |
|||
} |
|||
|
|||
if (requiresViewDir || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceViewDirection + " = i.viewDir;", true); |
|||
} |
|||
|
|||
if (requiresWorldPos) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpacePosition + " = i.posWS;", true); |
|||
} |
|||
|
|||
if (requiresScreenPosition) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 screenPos : TEXCOORD{0};", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.screenPos = ComputeScreenPos(v.vertex);", true); |
|||
shaderBody.AddShaderChunk("float4 " + ShaderGeneratorNames.ScreenPosition + " = i.screenPos;", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresBitangent || requiresTangent || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half3 tangent : TEXCOORD{0}; \\", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.tangent = normalize(UnityObjectToWorldDir(v.tangent)); \\", true); |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceTangent + " = normalize(i.tangent.xyz);", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresBitangent || requiresNormal || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceNormal + " = normalize(i.normal);", true); |
|||
} |
|||
|
|||
if (requiresBitangent || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half3 binormal : TEXCOORD{0};", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.binormal = cross(o.normal, o.tangent) * v.tangent.w;", true); |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceBitangent + " = i.binormal;", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk( |
|||
"float3 " + ShaderGeneratorNames.TangentSpaceViewDirection + ";", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".x = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceTangent + ");", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".y = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceBitangent + ");", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".z = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceNormal + ");", true); |
|||
} |
|||
|
|||
if (requiresVertexColor) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 color : TEXCOORD{0};", vertOutputIndex), true); |
|||
shaderBody.AddShaderChunk("float4 " + ShaderGeneratorNames.VertexColor + " = i.color;", true); |
|||
vertInputIndex++; |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
GenerateNodeCode(shaderBody, propertyUsages, mode); |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator shaderBody, ShaderGenerator propertyUsages, GenerationMode generationMode) |
|||
{ |
|||
var nodes = ListPool<INode>.Get(); |
|||
|
|||
//Get the rest of the nodes for all the other slots
|
|||
NodeUtils.DepthFirstCollectNodesFromNode(nodes, this, NodeUtils.IncludeSelf.Exclude, new List<int>(surfaceInputs)); |
|||
for (var i = 0; i < nodes.Count; i++) |
|||
{ |
|||
var node = nodes[i]; |
|||
if (node is IGeneratesBodyCode) |
|||
(node as IGeneratesBodyCode).GenerateNodeCode(shaderBody, generationMode); |
|||
} |
|||
ListPool<INode>.Release(nodes); |
|||
|
|||
foreach (var slot in GetInputSlots<MaterialSlot>()) |
|||
{ |
|||
if (surfaceInputs.Contains(slot.id)) |
|||
{ |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
shaderBody.AddShaderChunk("o." + slot.shaderOutputName + " = " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true); |
|||
|
|||
if (slot.id == NormalSlotId) |
|||
shaderBody.AddShaderChunk("o." + slot.shaderOutputName + " += 1e-6;", true); |
|||
|
|||
if (slot.id == AlphaSlotId) |
|||
propertyUsages.AddShaderChunk("#define _ALPHAPREMULTIPLY_ON", true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text.RegularExpressions; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Serializable] |
|||
[Title("Master/Lightweight/Unlit")] |
|||
public class LightweightUnlitMasterNode : AbstractMasterNode |
|||
{ |
|||
public const string ColorSlotName = "Color"; |
|||
public const string AlphaSlotName = "Alpha"; |
|||
public const string VertexOffsetName = "VertexPosition"; |
|||
|
|||
public const int ColorSlotId = 0; |
|||
public const int AlphaSlotId = 1; |
|||
public const int VertexOffsetId = 2; |
|||
|
|||
[SerializeField] |
|||
private SurfaceMaterialOptions m_MaterialOptions = new SurfaceMaterialOptions(); |
|||
|
|||
public SurfaceMaterialOptions options |
|||
{ |
|||
get { return m_MaterialOptions; } |
|||
} |
|||
|
|||
public LightweightUnlitMasterNode() |
|||
{ |
|||
name = "LightweightUnlitMasterNode"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(VertexOffsetId, VertexOffsetName, VertexOffsetName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Vertex)); |
|||
AddSlot(new MaterialSlot(ColorSlotId, ColorSlotName, ColorSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero, ShaderStage.Fragment)); |
|||
AddSlot(new MaterialSlot(AlphaSlotId, AlphaSlotName, AlphaSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero, ShaderStage.Fragment)); |
|||
|
|||
// clear out slot names that do not match the slots
|
|||
// we support
|
|||
RemoveSlotsNameNotMatching( |
|||
new[] |
|||
{ |
|||
ColorSlotId, |
|||
AlphaSlotId, |
|||
VertexOffsetId |
|||
}); |
|||
} |
|||
|
|||
protected int[] surfaceInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
ColorSlotId, |
|||
AlphaSlotId, |
|||
}; |
|||
} |
|||
} |
|||
|
|||
protected int[] vertexInputs |
|||
{ |
|||
get |
|||
{ |
|||
return new[] |
|||
{ |
|||
VertexOffsetId |
|||
}; |
|||
} |
|||
} |
|||
|
|||
void GenerateNodeFunctionsAndPropertyUsages( |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator nodeFunction, |
|||
GenerationMode mode, |
|||
int[] validNodeIds) |
|||
{ |
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this, NodeUtils.IncludeSelf.Include, |
|||
new List<int>(validNodeIds)); |
|||
|
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
{ |
|||
if (node is IGeneratesFunction) |
|||
(node as IGeneratesFunction).GenerateNodeFunction(nodeFunction, mode); |
|||
|
|||
node.GeneratePropertyUsages(propertyUsages, mode); |
|||
} |
|||
|
|||
var nodes = ListPool<INode>.Get(); |
|||
//Get the rest of the nodes for all the other slots
|
|||
NodeUtils.DepthFirstCollectNodesFromNode(nodes, this, NodeUtils.IncludeSelf.Exclude, new List<int>(vertexInputs)); |
|||
for (var i = 0; i < nodes.Count; i++) |
|||
{ |
|||
var node = nodes[i]; |
|||
if (node is IGeneratesBodyCode) |
|||
(node as IGeneratesBodyCode).GenerateNodeCode(shaderBody, mode); |
|||
} |
|||
ListPool<INode>.Release(nodes); |
|||
} |
|||
|
|||
void GenerateVertexShaderInternal( |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator nodeFunction, |
|||
ShaderGenerator vertexShaderBlock, |
|||
GenerationMode mode) |
|||
{ |
|||
GenerateNodeFunctionsAndPropertyUsages(vertexShaderBlock, propertyUsages, nodeFunction, mode, vertexInputs); |
|||
|
|||
var slot = FindInputSlot<MaterialSlot>(VertexOffsetId); |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
vertexShaderBlock.AddShaderChunk("v.vertex.xyz += " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true); |
|||
} |
|||
} |
|||
|
|||
public override string GetSubShader(GenerationMode mode, PropertyGenerator shaderPropertiesVisitor) |
|||
{ |
|||
var templateLocation = ShaderGenerator.GetTemplatePath("lightweightSubshaderUnlit.template"); |
|||
|
|||
if (!File.Exists(templateLocation)) |
|||
return string.Empty; |
|||
|
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this); |
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
node.GeneratePropertyBlock(shaderPropertiesVisitor, mode); |
|||
|
|||
var templateText = File.ReadAllText(templateLocation); |
|||
var shaderBodyVisitor = new ShaderGenerator(); |
|||
var shaderFunctionVisitor = new ShaderGenerator(); |
|||
var shaderPropertyUsagesVisitor = new ShaderGenerator(); |
|||
var shaderInputVisitor = new ShaderGenerator(); |
|||
var shaderOutputVisitor = new ShaderGenerator(); |
|||
var vertexShaderBlock = new ShaderGenerator(); |
|||
var definesVisitor = new ShaderGenerator(); |
|||
|
|||
GenerateSurfaceShaderInternal( |
|||
shaderPropertyUsagesVisitor, |
|||
shaderBodyVisitor, |
|||
shaderFunctionVisitor, |
|||
shaderInputVisitor, |
|||
shaderOutputVisitor, |
|||
vertexShaderBlock, |
|||
definesVisitor, |
|||
mode); |
|||
|
|||
GenerateVertexShaderInternal( |
|||
shaderPropertyUsagesVisitor, |
|||
shaderBodyVisitor, |
|||
shaderFunctionVisitor, |
|||
vertexShaderBlock, |
|||
mode); |
|||
|
|||
var tagsVisitor = new ShaderGenerator(); |
|||
var blendingVisitor = new ShaderGenerator(); |
|||
var cullingVisitor = new ShaderGenerator(); |
|||
var zTestVisitor = new ShaderGenerator(); |
|||
var zWriteVisitor = new ShaderGenerator(); |
|||
|
|||
m_MaterialOptions.GetTags(tagsVisitor); |
|||
m_MaterialOptions.GetBlend(blendingVisitor); |
|||
m_MaterialOptions.GetCull(cullingVisitor); |
|||
m_MaterialOptions.GetDepthTest(zTestVisitor); |
|||
m_MaterialOptions.GetDepthWrite(zWriteVisitor); |
|||
|
|||
GetDefines(definesVisitor); |
|||
|
|||
var resultShader = templateText.Replace("${ShaderPropertyUsages}", shaderPropertyUsagesVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ShaderFunctions}", shaderFunctionVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${VertexInputs}", shaderInputVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${VertexOutputs}", shaderOutputVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${PixelShaderBody}", shaderBodyVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${Tags}", tagsVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Blending}", blendingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Culling}", cullingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZTest}", zTestVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZWrite}", zWriteVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${LOD}", "" + m_MaterialOptions.lod); |
|||
|
|||
resultShader = resultShader.Replace("${Defines}", definesVisitor.GetShaderString(2)); |
|||
|
|||
resultShader = resultShader.Replace("${VertexShaderBody}", vertexShaderBlock.GetShaderString(3)); |
|||
|
|||
return resultShader; |
|||
} |
|||
|
|||
public void GetDefines(ShaderGenerator visitor) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public override string GetFullShader(GenerationMode mode, string name, out List<PropertyGenerator.TextureInfo> configuredTextures) |
|||
{ |
|||
var templateLocation = ShaderGenerator.GetTemplatePath("shader.template"); |
|||
|
|||
if (!File.Exists(templateLocation)) |
|||
{ |
|||
configuredTextures = new List<PropertyGenerator.TextureInfo>(); |
|||
return string.Empty; |
|||
} |
|||
|
|||
var templateText = File.ReadAllText(templateLocation); |
|||
|
|||
var shaderPropertiesVisitor = new PropertyGenerator(); |
|||
var resultShader = templateText.Replace("${ShaderName}", name); |
|||
resultShader = resultShader.Replace("${SubShader}", GetSubShader(mode, shaderPropertiesVisitor)); |
|||
resultShader = resultShader.Replace("${ShaderPropertiesHeader}", shaderPropertiesVisitor.GetShaderString(2)); |
|||
configuredTextures = shaderPropertiesVisitor.GetConfiguredTexutres(); |
|||
|
|||
Debug.Log(resultShader); |
|||
|
|||
return Regex.Replace(resultShader, @"\r\n|\n\r|\n|\r", Environment.NewLine); |
|||
} |
|||
|
|||
private void GenerateSurfaceShaderInternal( |
|||
ShaderGenerator propertyUsages, |
|||
ShaderGenerator shaderBody, |
|||
ShaderGenerator nodeFunction, |
|||
ShaderGenerator shaderInputVisitor, |
|||
ShaderGenerator shaderOutputVisitor, |
|||
ShaderGenerator vertexShaderBlock, |
|||
ShaderGenerator definesVisitor, |
|||
GenerationMode mode) |
|||
{ |
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this, NodeUtils.IncludeSelf.Include, |
|||
new List<int>(surfaceInputs)); |
|||
|
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
{ |
|||
if (node is IGeneratesFunction) |
|||
{ |
|||
((IGeneratesFunction)node).GenerateNodeFunction(nodeFunction, mode); |
|||
} |
|||
|
|||
node.GeneratePropertyUsages(propertyUsages, mode); |
|||
} |
|||
|
|||
int vertInputIndex = 2; |
|||
int vertOutputIndex = 5; |
|||
|
|||
shaderInputVisitor.AddShaderChunk("half4 texcoord1 : TEXCOORD1;", true); |
|||
|
|||
bool requiresBitangent = activeNodeList.OfType<IMayRequireBitangent>().Any(x => x.RequiresBitangent()); |
|||
bool requiresTangent = activeNodeList.OfType<IMayRequireTangent>().Any(x => x.RequiresTangent()); |
|||
bool requiresViewDirTangentSpace = activeNodeList.OfType<IMayRequireViewDirectionTangentSpace>().Any(x => x.RequiresViewDirectionTangentSpace()); |
|||
bool requiresViewDir = activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection()); |
|||
bool requiresWorldPos = activeNodeList.OfType<IMayRequireWorldPosition>().Any(x => x.RequiresWorldPosition()); |
|||
bool requiresNormal = activeNodeList.OfType<IMayRequireNormal>().Any(x => x.RequiresNormal()); |
|||
bool requiresScreenPosition = activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition()); |
|||
bool requiresVertexColor = activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor()); |
|||
|
|||
foreach (var slot in GetInputSlots<MaterialSlot>()) |
|||
{ |
|||
if (surfaceInputs.Contains(slot.id)) |
|||
{ |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
} |
|||
} |
|||
} |
|||
|
|||
for (int uvIndex = 0; uvIndex < ShaderGeneratorNames.UVCount; ++uvIndex) |
|||
{ |
|||
var channel = (UVChannel)uvIndex; |
|||
if (activeNodeList.OfType<IMayRequireMeshUV>().Any(x => x.RequiresMeshUV(channel))) |
|||
{ |
|||
if(uvIndex != 0) |
|||
{ |
|||
shaderInputVisitor.AddShaderChunk(string.Format("half4 texcoord{0} : TEXCOORD{1};", uvIndex, vertInputIndex), true); |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 meshUV{0} : TEXCOORD{1};", uvIndex, vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk(string.Format("o.meshUV{0} = v.texcoord{1};", uvIndex, uvIndex), true); |
|||
vertInputIndex++; |
|||
vertOutputIndex++; |
|||
} |
|||
shaderBody.AddShaderChunk(string.Format("half4 {0} = i.meshUV{1};", channel.GetUVName(), uvIndex), true); |
|||
} |
|||
} |
|||
|
|||
if (requiresViewDir || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceViewDirection + " = i.viewDir;", true); |
|||
} |
|||
|
|||
if (requiresWorldPos) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpacePosition + " = i.posWS;", true); |
|||
} |
|||
|
|||
if (requiresScreenPosition) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 screenPos : TEXCOORD{0};", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.screenPos = ComputeScreenPos(v.vertex);", true); |
|||
shaderBody.AddShaderChunk("float4 " + ShaderGeneratorNames.ScreenPosition + " = i.screenPos;", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresBitangent || requiresTangent || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half3 tangent : TEXCOORD{0}; \\", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.tangent = normalize(UnityObjectToWorldDir(v.tangent)); \\", true); |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceTangent + " = normalize(i.tangent.xyz);", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresBitangent || requiresNormal || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceNormal + " = normalize(i.normal);", true); |
|||
} |
|||
|
|||
if (requiresBitangent || requiresViewDirTangentSpace) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half3 binormal : TEXCOORD{0};", vertOutputIndex), true); |
|||
vertexShaderBlock.AddShaderChunk("o.binormal = cross(o.normal, o.tangent) * v.tangent.w;", true); |
|||
shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceBitangent + " = i.binormal;", true); |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
if (requiresViewDirTangentSpace) |
|||
{ |
|||
shaderBody.AddShaderChunk( |
|||
"float3 " + ShaderGeneratorNames.TangentSpaceViewDirection + ";", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".x = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceTangent + ");", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".y = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceBitangent + ");", true); |
|||
|
|||
shaderBody.AddShaderChunk( |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ".z = dot(" + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + "," + |
|||
ShaderGeneratorNames.WorldSpaceNormal + ");", true); |
|||
} |
|||
|
|||
if (requiresVertexColor) |
|||
{ |
|||
shaderOutputVisitor.AddShaderChunk(string.Format("half4 color : TEXCOORD{0};", vertOutputIndex), true); |
|||
shaderBody.AddShaderChunk("float4 " + ShaderGeneratorNames.VertexColor + " = i.color;", true); |
|||
vertInputIndex++; |
|||
vertOutputIndex++; |
|||
} |
|||
|
|||
GenerateNodeCode(shaderBody, propertyUsages, mode); |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator shaderBody, ShaderGenerator propertyUsages, GenerationMode generationMode) |
|||
{ |
|||
var nodes = ListPool<INode>.Get(); |
|||
|
|||
//Get the rest of the nodes for all the other slots
|
|||
NodeUtils.DepthFirstCollectNodesFromNode(nodes, this, NodeUtils.IncludeSelf.Exclude, new List<int>(surfaceInputs)); |
|||
for (var i = 0; i < nodes.Count; i++) |
|||
{ |
|||
var node = nodes[i]; |
|||
if (node is IGeneratesBodyCode) |
|||
(node as IGeneratesBodyCode).GenerateNodeCode(shaderBody, generationMode); |
|||
} |
|||
ListPool<INode>.Release(nodes); |
|||
|
|||
foreach (var slot in GetInputSlots<MaterialSlot>()) |
|||
{ |
|||
if (surfaceInputs.Contains(slot.id)) |
|||
{ |
|||
foreach (var edge in owner.GetEdges(slot.slotReference)) |
|||
{ |
|||
var outputRef = edge.outputSlot; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid); |
|||
if (fromNode == null) |
|||
continue; |
|||
|
|||
var remapper = fromNode as INodeGroupRemapper; |
|||
if (remapper != null && !remapper.IsValidSlotConnection(outputRef.slotId)) |
|||
continue; |
|||
|
|||
shaderBody.AddShaderChunk("o." + slot.shaderOutputName + " = " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true); |
|||
|
|||
if (slot.id == AlphaSlotId) |
|||
propertyUsages.AddShaderChunk("#define _ALPHAPREMULTIPLY_ON", true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 19892eaf92f3e2e49928945f6da04525 |
|||
timeCreated: 1478188276 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: TestGraph-PBRMetallic |
|||
m_Shader: {fileID: 4800000, guid: 02a3ca69ec995e94aa47105621a17e4c, type: 3} |
|||
m_ShaderKeywords: _GLOSSYREFLECTIONS_ON _METALLIC_SETUP _SPECULARHIGHLIGHTS_ON |
|||
m_LightmapFlags: 2 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture2D_Texture2D_2A5875FB_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 618126695341ad844ac048b062fd2688, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_30A72685_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_6C206BFC_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_87733D67_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_9508545D_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_AEB21289_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_C4394658_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 79b61ba99411748ae8fa11666dceaee5, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_FE1ED0E8_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- Vector1_Vector1_20D3DC06_Uniform: 0 |
|||
- Vector1_Vector1_4B0AEC3F_Uniform: 0.5 |
|||
- Vector1_Vector1_5370E8F3_Uniform: 0 |
|||
- Vector1_Vector1_69199BC_Uniform: 0 |
|||
- Vector1_Vector1_6E27ABB0_Uniform: 1 |
|||
- Vector1_Vector1_72A1F5A1_Uniform: 1 |
|||
- Vector1_Vector1_7EC3DCBC_Uniform: 1 |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 1 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 1 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 0.5 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 1 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- Color_Color_4467EDF0_Uniform: {r: 1, g: 0, b: 0, a: 0} |
|||
- Color_Color_5648C58E_Uniform: {r: 0, g: 0, b: 0, a: 0} |
|||
- Color_Color_8256B4E6_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- Color_Color_A536DDF7_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- Vector3_Vector3_D670D52C_Uniform: {r: 0, g: 0, b: 0, a: 0} |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 1, g: 1, b: 1, a: 1} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: TestGraph-PBRSpecular |
|||
m_Shader: {fileID: 4800000, guid: a96bafc6e4c6e7c4ca1fb43c905d7948, type: 3} |
|||
m_ShaderKeywords: _GLOSSYREFLECTIONS_ON _METALLIC_SETUP _SPECULARHIGHLIGHTS_ON |
|||
m_LightmapFlags: 2 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture2D_Texture2D_2A5875FB_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 618126695341ad844ac048b062fd2688, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_30A72685_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_6C206BFC_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_87733D67_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_9508545D_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_AEB21289_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_FE1ED0E8_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- Vector1_Vector1_20D3DC06_Uniform: 1 |
|||
- Vector1_Vector1_4B0AEC3F_Uniform: 0.5 |
|||
- Vector1_Vector1_5370E8F3_Uniform: 0.5 |
|||
- Vector1_Vector1_69199BC_Uniform: 0 |
|||
- Vector1_Vector1_72A1F5A1_Uniform: 1 |
|||
- Vector1_Vector1_7EC3DCBC_Uniform: 0.5 |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 1 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 1 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 0.5 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 1 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- Color_Color_4467EDF0_Uniform: {r: 1, g: 0, b: 0, a: 0} |
|||
- Color_Color_5648C58E_Uniform: {r: 0, g: 0, b: 0, a: 0} |
|||
- Color_Color_8256B4E6_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- Color_Color_A536DDF7_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- Color_Color_DF8C830F_Uniform: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 0} |
|||
- Vector3_Vector3_D670D52C_Uniform: {r: 0, g: 0, b: 0, a: 0} |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 1, g: 1, b: 1, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0b6bd1d9f8dca444aa8695ad2c1b7152 |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 093053a5cbe55cc48a60db27e2b28232 |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: Test-Unlit |
|||
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3} |
|||
m_ShaderKeywords: _ALPHABLEND_ON _GLOSSYREFLECTIONS_ON _METALLICSPECGLOSSMAP _METALLIC_SETUP |
|||
_NORMALMAP _SPECGLOSSMAP_BASE_ALPHA _SPECULARHIGHLIGHTS_ON |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: 3000 |
|||
stringTagMap: |
|||
RenderType: Transparent |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 10 |
|||
- _GlossMapScale: 0.5 |
|||
- _Glossiness: 0.5 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 2 |
|||
- _OcclusionStrength: 0.5 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 0.087 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 5 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 0 |
|||
m_Colors: |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 0.9632353, g: 0.9632353, b: 0.9632353, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: a94000a19a84e5c4f8816b53c83caa75 |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: d6c557b0ad00a7946b27400b33a390ac |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: Test-Legacy |
|||
m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3} |
|||
m_ShaderKeywords: _GLOSSYREFLECTIONS_ON _METALLICSPECGLOSSMAP _METALLIC_SETUP _NORMALMAP |
|||
_SPECULARHIGHLIGHTS_ON _SPECULAR_COLOR |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 0.5 |
|||
- _Glossiness: 0.5 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 0.5 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 0.5 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 1, g: 1, b: 1, a: 1} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: Test-PBRSpecular |
|||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} |
|||
m_ShaderKeywords: _GLOSSYREFLECTIONS_ON _NORMALMAP _SPECULARHIGHLIGHTS_ON _SPECULAR_SETUP |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture2D_Texture2D_2A5875FB_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 618126695341ad844ac048b062fd2688, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_87733D67_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 3f3b8bdf3ccd30c4fb97b62bd26ef1f6, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 2800000, guid: 70218f73fcdf828428151dfdd3104a8f, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- Vector1_Vector1_5370E8F3_Uniform: 0 |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 0.435 |
|||
- _Glossiness: 0.498 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 0 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 1 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 0 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- Color_Color_4467EDF0_Uniform: {r: 1, g: 0, b: 0, a: 0} |
|||
- Color_Color_8256B4E6_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 74be5c6f41091b447bed7d64251620ee |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 9d1779795c4cf814e8732dc4542ac9ae |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: Test-PBRMetallic |
|||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} |
|||
m_ShaderKeywords: _GLOSSYREFLECTIONS_ON _METALLIC_SETUP _NORMALMAP _SPECULARHIGHLIGHTS_ON |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture2D_Texture2D_2A5875FB_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 618126695341ad844ac048b062fd2688, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_87733D67_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 3f3b8bdf3ccd30c4fb97b62bd26ef1f6, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 2800000, guid: 6e8d12f68bae2294da814f9d4c81b29a, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- Vector1_Vector1_5370E8F3_Uniform: 0 |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 0 |
|||
- _Glossiness: 1 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 1 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 1 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- Color_Color_4467EDF0_Uniform: {r: 1, g: 0, b: 0, a: 0} |
|||
- Color_Color_8256B4E6_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 1, g: 1, b: 1, a: 1} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: TestGraph-FastBlinn |
|||
m_Shader: {fileID: 4800000, guid: fb10f96bca7384c4794179be4353d50e, type: 3} |
|||
m_ShaderKeywords: _GLOSSYREFLECTIONS_ON _METALLIC_SETUP _SPECULARHIGHLIGHTS_ON |
|||
m_LightmapFlags: 2 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture2D_Texture2D_2A5875FB_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 618126695341ad844ac048b062fd2688, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_30A72685_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_37BDC883_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_39EEECB4_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_6C206BFC_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_87733D67_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_9508545D_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_AEB21289_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_C4394658_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 79b61ba99411748ae8fa11666dceaee5, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture2D_Texture2D_FE1ED0E8_Uniform: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- Vector1_Vector1_20D3DC06_Uniform: 0 |
|||
- Vector1_Vector1_3982DF0C_Uniform: 1 |
|||
- Vector1_Vector1_4B0AEC3F_Uniform: 0.5 |
|||
- Vector1_Vector1_5370E8F3_Uniform: 0 |
|||
- Vector1_Vector1_69199BC_Uniform: 0 |
|||
- Vector1_Vector1_6E27ABB0_Uniform: 1 |
|||
- Vector1_Vector1_72A1F5A1_Uniform: 1 |
|||
- Vector1_Vector1_7EC3DCBC_Uniform: 1 |
|||
- Vector1_Vector1_99924D25_Uniform: 0.5 |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 1 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 1 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 0.5 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 1 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- Color_Color_4467EDF0_Uniform: {r: 1, g: 0, b: 0, a: 0} |
|||
- Color_Color_4F725450_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- Color_Color_5648C58E_Uniform: {r: 0, g: 0, b: 0, a: 0} |
|||
- Color_Color_8256B4E6_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- Color_Color_A536DDF7_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- Vector3_Vector3_D670D52C_Uniform: {r: 0, g: 0, b: 0, a: 0} |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 1, g: 1, b: 1, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: 637f2a949394cb043bbb7a28df1ed9c9 |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: TestGraph-Unlit |
|||
m_Shader: {fileID: 4800000, guid: c575d6799ba1a994a931fe22b1d3fe08, type: 3} |
|||
m_ShaderKeywords: _ALPHABLEND_ON _GLOSSYREFLECTIONS_ON _METALLICSPECGLOSSMAP _METALLIC_SETUP |
|||
_NORMALMAP _SPECGLOSSMAP_BASE_ALPHA _SPECULARHIGHLIGHTS_ON |
|||
m_LightmapFlags: 0 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture2D_Texture2D_9508545D_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 2800000, guid: e017404169662f041a969b0a924cc2ed, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _Cube: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicSpecGlossMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 2800000, guid: 5d84e1086e00e3347aaa0bbba206bb80, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 10 |
|||
- _GlossMapScale: 0.5 |
|||
- _Glossiness: 0.5 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 2 |
|||
- _OcclusionStrength: 0.5 |
|||
- _Parallax: 0.02 |
|||
- _ReflectionSource: 0 |
|||
- _Shininess: 0.087 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 5 |
|||
- _UVSec: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 0 |
|||
m_Colors: |
|||
- Color_Color_A536DDF7_Uniform: {r: 1, g: 1, b: 1, a: 1} |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecColor: {r: 0.9632353, g: 0.9632353, b: 0.9632353, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: ea0bef6a3bdc6474185c50a3a8939982 |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 8 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 0 |
|||
m_AmbientMode: 0 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 0.18381745, g: 0.22911131, b: 0.3040083, a: 1} |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 11 |
|||
m_GIWorkflowMode: 0 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_TemporalCoherenceThreshold: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 1 |
|||
m_EnableRealtimeLightmaps: 1 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 9 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_TextureWidth: 1024 |
|||
m_TextureHeight: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 0 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 500 |
|||
m_PVRBounces: 2 |
|||
m_PVRFilterTypeDirect: 0 |
|||
m_PVRFilterTypeIndirect: 0 |
|||
m_PVRFilterTypeAO: 0 |
|||
m_PVRFilteringMode: 1 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
|||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
|||
m_PVRFilteringAtrousPositionSigmaAO: 1 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_UseShadowmask: 1 |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &38610488 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 38610489} |
|||
- component: {fileID: 38610492} |
|||
- component: {fileID: 38610491} |
|||
- component: {fileID: 38610490} |
|||
m_Layer: 0 |
|||
m_Name: PBRSpecular |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &38610489 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 38610488} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: -1.5} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1220808772} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!23 &38610490 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 38610488} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: 0b6bd1d9f8dca444aa8695ad2c1b7152, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &38610491 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 38610488} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &38610492 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 38610488} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!1 &250933708 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 250933712} |
|||
- component: {fileID: 250933711} |
|||
- component: {fileID: 250933710} |
|||
- component: {fileID: 250933709} |
|||
m_Layer: 0 |
|||
m_Name: PBRMetallic |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!23 &250933709 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 250933708} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: d6c557b0ad00a7946b27400b33a390ac, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &250933710 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 250933708} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &250933711 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 250933708} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &250933712 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 250933708} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: -1.5, y: 0, z: -1.5} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1220808772} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &301674285 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 301674289} |
|||
- component: {fileID: 301674288} |
|||
- component: {fileID: 301674287} |
|||
- component: {fileID: 301674286} |
|||
m_Layer: 0 |
|||
m_Name: BlinnPhong |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!23 &301674286 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 301674285} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: 093053a5cbe55cc48a60db27e2b28232, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &301674287 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 301674285} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &301674288 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 301674285} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &301674289 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 301674285} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: -3, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1045077821} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1045077820 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1045077821} |
|||
m_Layer: 0 |
|||
m_Name: Handwritten |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &1045077821 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1045077820} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 1225949933} |
|||
- {fileID: 1117495945} |
|||
- {fileID: 301674289} |
|||
- {fileID: 1225352830} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 3 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1117495944 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1117495945} |
|||
- component: {fileID: 1117495948} |
|||
- component: {fileID: 1117495947} |
|||
- component: {fileID: 1117495946} |
|||
m_Layer: 0 |
|||
m_Name: PBRSpecular |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &1117495945 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1117495944} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1045077821} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!23 &1117495946 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1117495944} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: 74be5c6f41091b447bed7d64251620ee, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &1117495947 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1117495944} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &1117495948 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1117495944} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!1 &1220808771 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1220808772} |
|||
m_Layer: 0 |
|||
m_Name: Graph |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &1220808772 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1220808771} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 250933712} |
|||
- {fileID: 38610489} |
|||
- {fileID: 1898501007} |
|||
- {fileID: 1407590066} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1225352826 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1225352830} |
|||
- component: {fileID: 1225352829} |
|||
- component: {fileID: 1225352828} |
|||
- component: {fileID: 1225352827} |
|||
m_Layer: 0 |
|||
m_Name: Unlit |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!23 &1225352827 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225352826} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: a94000a19a84e5c4f8816b53c83caa75, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &1225352828 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225352826} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &1225352829 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225352826} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &1225352830 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225352826} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: -4.5, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1045077821} |
|||
m_RootOrder: 3 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1225949929 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1225949933} |
|||
- component: {fileID: 1225949932} |
|||
- component: {fileID: 1225949931} |
|||
- component: {fileID: 1225949930} |
|||
m_Layer: 0 |
|||
m_Name: PBRMetallic |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!23 &1225949930 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225949929} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: 9d1779795c4cf814e8732dc4542ac9ae, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &1225949931 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225949929} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &1225949932 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225949929} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &1225949933 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1225949929} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: -1.5, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1045077821} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1407590065 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1407590066} |
|||
- component: {fileID: 1407590069} |
|||
- component: {fileID: 1407590068} |
|||
- component: {fileID: 1407590067} |
|||
m_Layer: 0 |
|||
m_Name: Unlit |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &1407590066 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1407590065} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: -4.5, y: 0, z: -1.5} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1220808772} |
|||
m_RootOrder: 3 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!23 &1407590067 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1407590065} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: ea0bef6a3bdc6474185c50a3a8939982, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &1407590068 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1407590065} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &1407590069 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1407590065} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!1 &1641918147 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1641918149} |
|||
- component: {fileID: 1641918148} |
|||
m_Layer: 0 |
|||
m_Name: Directional Light |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!108 &1641918148 |
|||
Light: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1641918147} |
|||
m_Enabled: 1 |
|||
serializedVersion: 8 |
|||
m_Type: 1 |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_Intensity: 1 |
|||
m_Range: 10 |
|||
m_SpotAngle: 30 |
|||
m_CookieSize: 10 |
|||
m_Shadows: |
|||
m_Type: 2 |
|||
m_Resolution: -1 |
|||
m_CustomResolution: -1 |
|||
m_Strength: 1 |
|||
m_Bias: 0.05 |
|||
m_NormalBias: 0.4 |
|||
m_NearPlane: 0.2 |
|||
m_Cookie: {fileID: 0} |
|||
m_DrawHalo: 0 |
|||
m_Flare: {fileID: 0} |
|||
m_RenderMode: 0 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_Lightmapping: 4 |
|||
m_AreaSize: {x: 1, y: 1} |
|||
m_BounceIntensity: 1 |
|||
m_ColorTemperature: 6570 |
|||
m_UseColorTemperature: 0 |
|||
m_ShadowRadius: 0 |
|||
m_ShadowAngle: 0 |
|||
--- !u!4 &1641918149 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1641918147} |
|||
m_LocalRotation: {x: -0.008174582, y: 0.5575212, z: -0.47586018, w: 0.6801914} |
|||
m_LocalPosition: {x: 0, y: 3, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 31.298002, y: 63.729004, z: -50.198} |
|||
--- !u!1 &1898501006 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1898501007} |
|||
- component: {fileID: 1898501010} |
|||
- component: {fileID: 1898501009} |
|||
- component: {fileID: 1898501008} |
|||
m_Layer: 0 |
|||
m_Name: BlinnPhong |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &1898501007 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1898501006} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: -3, y: 0, z: -1.5} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1220808772} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!23 &1898501008 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1898501006} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: 637f2a949394cb043bbb7a28df1ed9c9, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!135 &1898501009 |
|||
SphereCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1898501006} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Radius: 0.5 |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &1898501010 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1898501006} |
|||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!1 &1913430569 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1913430573} |
|||
- component: {fileID: 1913430572} |
|||
- component: {fileID: 1913430571} |
|||
- component: {fileID: 1913430570} |
|||
m_Layer: 0 |
|||
m_Name: Main Camera |
|||
m_TagString: MainCamera |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!81 &1913430570 |
|||
AudioListener: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1913430569} |
|||
m_Enabled: 1 |
|||
--- !u!124 &1913430571 |
|||
Behaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1913430569} |
|||
m_Enabled: 1 |
|||
--- !u!20 &1913430572 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1913430569} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 1 |
|||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.3 |
|||
far clip plane: 1000 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: -1 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: 3 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 3 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 0 |
|||
m_AllowDynamicResolution: 0 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 1 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
--- !u!4 &1913430573 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1913430569} |
|||
m_LocalRotation: {x: -0.28235355, y: 0.21969044, z: -0.06659774, w: -0.9314383} |
|||
m_LocalPosition: {x: -0.42957377, y: 1.5467438, z: -3.389049} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|
|||
// Shader targeted for low end devices. Single Pass Forward Rendering. Shader Model 2 |
|||
Shader "ScriptableRenderPipeline/LightweightPipeline/NonPBR" |
|||
{ |
|||
// Keep properties of StandardSpecular shader for upgrade reasons. |
|||
Properties |
|||
{ |
|||
_Color("Color", Color) = (1,1,1,1) |
|||
_MainTex("Base (RGB) Glossiness / Alpha (A)", 2D) = "white" {} |
|||
|
|||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 |
|||
|
|||
_Shininess("Shininess", Range(0.01, 1.0)) = 1.0 |
|||
_GlossMapScale("Smoothness Factor", Range(0.0, 1.0)) = 1.0 |
|||
|
|||
_Glossiness("Glossiness", Range(0.0, 1.0)) = 0.5 |
|||
[Enum(Specular Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel("Smoothness texture channel", Float) = 0 |
|||
|
|||
_Cube ("Reflection Cubemap", CUBE) = "" {} |
|||
_ReflectionSource("Reflection Source", Float) = 0 |
|||
|
|||
[HideInInspector] _SpecSource("Specular Color Source", Float) = 0.0 |
|||
_SpecColor("Specular", Color) = (1.0, 1.0, 1.0) |
|||
_SpecGlossMap("Specular", 2D) = "white" {} |
|||
[HideInInspector] _GlossinessSource("Glossiness Source", Float) = 0.0 |
|||
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 |
|||
[ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0 |
|||
|
|||
[HideInInspector] _BumpScale("Scale", Float) = 1.0 |
|||
[NoScaleOffset] _BumpMap("Normal Map", 2D) = "bump" {} |
|||
|
|||
_Parallax("Height Scale", Range(0.005, 0.08)) = 0.02 |
|||
_ParallaxMap("Height Map", 2D) = "black" {} |
|||
|
|||
_EmissionColor("Emission Color", Color) = (0,0,0) |
|||
_EmissionMap("Emission", 2D) = "white" {} |
|||
|
|||
_DetailMask("Detail Mask", 2D) = "white" {} |
|||
|
|||
_DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {} |
|||
_DetailNormalMapScale("Scale", Float) = 1.0 |
|||
_DetailNormalMap("Normal Map", 2D) = "bump" {} |
|||
|
|||
[Enum(UV0,0,UV1,1)] _UVSec("UV Set for secondary textures", Float) = 0 |
|||
|
|||
// Blending state |
|||
[HideInInspector] _Mode("__mode", Float) = 0.0 |
|||
[HideInInspector] _SrcBlend("__src", Float) = 1.0 |
|||
[HideInInspector] _DstBlend("__dst", Float) = 0.0 |
|||
[HideInInspector] _ZWrite("__zw", Float) = 1.0 |
|||
} |
|||
|
|||
SubShader |
|||
{ |
|||
Tags { "RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline" } |
|||
LOD 300 |
|||
|
|||
Pass |
|||
{ |
|||
Tags { "LightMode" = "LightweightForward" } |
|||
|
|||
// Use same blending / depth states as Standard shader |
|||
Blend[_SrcBlend][_DstBlend] |
|||
ZWrite[_ZWrite] |
|||
|
|||
CGPROGRAM |
|||
#pragma target 3.0 |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON |
|||
#pragma shader_feature _ _SPECGLOSSMAP _SPECGLOSSMAP_BASE_ALPHA _SPECULAR_COLOR |
|||
#pragma shader_feature _NORMALMAP |
|||
#pragma shader_feature _EMISSION |
|||
#pragma shader_feature _ _REFLECTION_CUBEMAP _REFLECTION_PROBE |
|||
|
|||
#pragma multi_compile _ LIGHTWEIGHT_LINEAR |
|||
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON |
|||
#pragma multi_compile _ _SINGLE_DIRECTIONAL_LIGHT _SINGLE_SPOT_LIGHT _SINGLE_POINT_LIGHT |
|||
#pragma multi_compile _ LIGHTMAP_ON |
|||
#pragma multi_compile _ _LIGHT_PROBES_ON |
|||
#pragma multi_compile _ _HARD_SHADOWS _SOFT_SHADOWS _HARD_SHADOWS_CASCADES _SOFT_SHADOWS_CASCADES |
|||
#pragma multi_compile _ _VERTEX_LIGHTS |
|||
#pragma multi_compile _ _ATTENUATION_TEXTURE |
|||
#pragma multi_compile_fog |
|||
#pragma multi_compile_instancing |
|||
|
|||
#include "UnityCG.cginc" |
|||
#include "UnityStandardInput.cginc" |
|||
#include "LightweightPipelineCore.cginc" |
|||
#include "LightweightPipelineLighting.cginc" |
|||
|
|||
LightweightVertexOutput vert(LightweightVertexInput v) |
|||
{ |
|||
LightweightVertexOutput o = (LightweightVertexOutput)0; |
|||
|
|||
UNITY_SETUP_INSTANCE_ID(v); |
|||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|||
|
|||
o.uv01.xy = TRANSFORM_TEX(v.texcoord, _MainTex); |
|||
#ifdef LIGHTMAP_ON |
|||
o.uv01.zw = v.lightmapUV * unity_LightmapST.xy + unity_LightmapST.zw; |
|||
#endif |
|||
o.hpos = UnityObjectToClipPos(v.vertex); |
|||
|
|||
float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; |
|||
o.posWS.xyz = worldPos; |
|||
|
|||
o.viewDir.xyz = normalize(_WorldSpaceCameraPos - worldPos); |
|||
half3 normal = normalize(UnityObjectToWorldNormal(v.normal)); |
|||
|
|||
#if _NORMALMAP |
|||
half sign = v.tangent.w * unity_WorldTransformParams.w; |
|||
half3 tangent = normalize(UnityObjectToWorldDir(v.tangent)); |
|||
half3 binormal = cross(normal, tangent) * v.tangent.w; |
|||
|
|||
// Initialize tangetToWorld in column-major to benefit from better glsl matrix multiplication code |
|||
o.tangentToWorld0 = half3(tangent.x, binormal.x, normal.x); |
|||
o.tangentToWorld1 = half3(tangent.y, binormal.y, normal.y); |
|||
o.tangentToWorld2 = half3(tangent.z, binormal.z, normal.z); |
|||
#else |
|||
o.normal = normal; |
|||
#endif |
|||
|
|||
// TODO: change to only support point lights per vertex. This will greatly simplify shader ALU |
|||
#if defined(_VERTEX_LIGHTS) && defined(_MULTIPLE_LIGHTS) |
|||
half3 diffuse = half3(1.0, 1.0, 1.0); |
|||
// pixel lights shaded = min(pixelLights, perObjectLights) |
|||
// vertex lights shaded = min(vertexLights, perObjectLights) - pixel lights shaded |
|||
// Therefore vertexStartIndex = pixelLightCount; vertexEndIndex = min(vertexLights, perObjectLights) |
|||
int vertexLightStart = min(globalLightCount.x, unity_LightIndicesOffsetAndCount.y); |
|||
int vertexLightEnd = min(globalLightCount.y, unity_LightIndicesOffsetAndCount.y); |
|||
for (int lightIter = vertexLightStart; lightIter < vertexLightEnd; ++lightIter) |
|||
{ |
|||
int lightIndex = unity_4LightIndices0[lightIter]; |
|||
LightInput lightInput; |
|||
INITIALIZE_LIGHT(lightInput, lightIndex); |
|||
|
|||
half3 lightDirection; |
|||
half atten = ComputeLightAttenuationVertex(lightInput, normal, worldPos, lightDirection); |
|||
o.fogCoord.yzw += LightingLambert(diffuse, lightDirection, normal, atten); |
|||
} |
|||
#endif |
|||
|
|||
#if defined(_LIGHT_PROBES_ON) && !defined(LIGHTMAP_ON) |
|||
o.fogCoord.yzw += max(half3(0, 0, 0), ShadeSH9(half4(normal, 1))); |
|||
#endif |
|||
|
|||
UNITY_TRANSFER_FOG(o, o.hpos); |
|||
return o; |
|||
} |
|||
|
|||
half4 frag(LightweightVertexOutput i) : SV_Target |
|||
{ |
|||
half4 diffuseAlpha = tex2D(_MainTex, i.uv01.xy); |
|||
half3 diffuse = LIGHTWEIGHT_GAMMA_TO_LINEAR(diffuseAlpha.rgb) * _Color.rgb; |
|||
half alpha = diffuseAlpha.a * _Color.a; |
|||
|
|||
// Keep for compatibility reasons. Shader Inpector throws a warning when using cutoff |
|||
// due overdraw performance impact. |
|||
#ifdef _ALPHATEST_ON |
|||
clip(alpha - _Cutoff); |
|||
#endif |
|||
|
|||
half3 normal; |
|||
NormalMap(i, normal); |
|||
|
|||
half4 specularGloss; |
|||
SpecularGloss(i.uv01.xy, alpha, specularGloss); |
|||
|
|||
half3 viewDir = i.viewDir.xyz; |
|||
float3 worldPos = i.posWS.xyz; |
|||
|
|||
half3 lightDirection; |
|||
|
|||
#ifndef _MULTIPLE_LIGHTS |
|||
LightInput lightInput; |
|||
INITIALIZE_MAIN_LIGHT(lightInput); |
|||
half lightAtten = ComputeLightAttenuation(lightInput, normal, worldPos, lightDirection); |
|||
#ifdef _SHADOWS |
|||
lightAtten *= ComputeShadowAttenuation(i, _ShadowLightDirection.xyz); |
|||
#endif |
|||
|
|||
#ifdef LIGHTWEIGHT_SPECULAR_HIGHLIGHTS |
|||
half3 color = LightingBlinnPhong(diffuse, specularGloss, lightDirection, normal, viewDir, lightAtten) * lightInput.color; |
|||
#else |
|||
half3 color = LightingLambert(diffuse, lightDirection, normal, lightAtten) * lightInput.color; |
|||
#endif |
|||
|
|||
#else |
|||
half3 color = half3(0, 0, 0); |
|||
|
|||
#ifdef _SHADOWS |
|||
half shadowAttenuation = ComputeShadowAttenuation(i, _ShadowLightDirection.xyz); |
|||
#endif |
|||
int pixelLightCount = min(globalLightCount.x, unity_LightIndicesOffsetAndCount.y); |
|||
for (int lightIter = 0; lightIter < pixelLightCount; ++lightIter) |
|||
{ |
|||
LightInput lightData; |
|||
int lightIndex = unity_4LightIndices0[lightIter]; |
|||
INITIALIZE_LIGHT(lightData, lightIndex); |
|||
half lightAtten = ComputeLightAttenuation(lightData, normal, worldPos, lightDirection); |
|||
#ifdef _SHADOWS |
|||
lightAtten *= max(shadowAttenuation, half(lightIndex != _ShadowData.x)); |
|||
#endif |
|||
|
|||
#ifdef LIGHTWEIGHT_SPECULAR_HIGHLIGHTS |
|||
color += LightingBlinnPhong(diffuse, specularGloss, lightDirection, normal, viewDir, lightAtten) * lightData.color; |
|||
#else |
|||
color += LightingLambert(diffuse, lightDirection, normal, lightAtten) * lightData.color; |
|||
#endif |
|||
} |
|||
|
|||
#endif // _MULTIPLE_LIGHTS |
|||
|
|||
#ifdef _EMISSION |
|||
color += LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_EmissionMap, i.uv01.xy).rgb) * _EmissionColor; |
|||
#else |
|||
color += _EmissionColor; |
|||
#endif |
|||
|
|||
#if defined(LIGHTMAP_ON) |
|||
color += (DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv01.zw)) + i.fogCoord.yzw) * diffuse; |
|||
#elif defined(_VERTEX_LIGHTS) || defined(_LIGHT_PROBES_ON) |
|||
color += i.fogCoord.yzw * diffuse; |
|||
#endif |
|||
|
|||
#if _REFLECTION_CUBEMAP |
|||
// TODO: we can use reflect vec to compute specular instead of half when computing cubemap reflection |
|||
half3 reflectVec = reflect(-i.viewDir.xyz, normal); |
|||
color += texCUBE(_Cube, reflectVec).rgb * specularGloss.rgb; |
|||
#elif defined(_REFLECTION_PROBE) |
|||
half3 reflectVec = reflect(-i.viewDir.xyz, normal); |
|||
half4 reflectionProbe = UNITY_SAMPLE_TEXCUBE(unity_SpecCube0, reflectVec); |
|||
color += reflectionProbe.rgb * (reflectionProbe.a * unity_SpecCube0_HDR.x) * specularGloss.rgb; |
|||
#endif |
|||
|
|||
UNITY_APPLY_FOG(i.fogCoord, color); |
|||
|
|||
return OutputColor(color, alpha); |
|||
}; |
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags { "Lightmode" = "ShadowCaster" } |
|||
|
|||
ZWrite On ZTest LEqual |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
float4 vert(float4 pos : POSITION) : SV_POSITION |
|||
{ |
|||
float4 clipPos = UnityObjectToClipPos(pos); |
|||
#if defined(UNITY_REVERSED_Z) |
|||
clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); |
|||
#else |
|||
clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); |
|||
#endif |
|||
return clipPos; |
|||
} |
|||
|
|||
half4 frag() : SV_TARGET |
|||
{ |
|||
return 0; |
|||
} |
|||
ENDCG |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
Tags{"Lightmode" = "DepthOnly"} |
|||
|
|||
ZWrite On |
|||
|
|||
CGPROGRAM |
|||
#pragma target 2.0 |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
float4 vert(float4 pos : POSITION) : SV_POSITION |
|||
{ |
|||
return UnityObjectToClipPos(pos); |
|||
} |
|||
|
|||
half4 frag() : SV_TARGET |
|||
{ |
|||
return 0; |
|||
} |
|||
ENDCG |
|||
} |
|||
|
|||
// This pass it not used during regular rendering, only for lightmap baking. |
|||
Pass |
|||
{ |
|||
Tags{ "LightMode" = "Meta" } |
|||
|
|||
Cull Off |
|||
|
|||
CGPROGRAM |
|||
#define UNITY_SETUP_BRDF_INPUT SpecularSetup |
|||
#pragma vertex vert_meta |
|||
#pragma fragment frag_meta_ld |
|||
|
|||
#pragma shader_feature _EMISSION |
|||
#pragma shader_feature _SPECGLOSSMAP |
|||
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
#pragma shader_feature ___ _DETAIL_MULX2 |
|||
#pragma shader_feature EDITOR_VISUALIZATION |
|||
|
|||
#include "UnityStandardMeta.cginc" |
|||
#include "LightweightPipelineCore.cginc" |
|||
|
|||
fixed4 frag_meta_ld(v2f_meta i) : SV_Target |
|||
{ |
|||
UnityMetaInput o; |
|||
UNITY_INITIALIZE_OUTPUT(UnityMetaInput, o); |
|||
|
|||
o.Albedo = Albedo(i.uv); |
|||
|
|||
half4 specularColor; |
|||
SpecularGloss(i.uv.xy, 1.0, specularColor); |
|||
o.SpecularColor = specularColor; |
|||
|
|||
#ifdef _EMISSION |
|||
o.Emission += LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_EmissionMap, i.uv).rgb) * _EmissionColor; |
|||
#else |
|||
o.Emission += _EmissionColor; |
|||
#endif |
|||
|
|||
return UnityMetaFragment(o); |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
Fallback "Standard (Specular setup)" |
|||
CustomEditor "LightweightPipelineMaterialEditor" |
|||
} |
|
|||
#ifndef LIGHTWEIGHT_PIPELINE_CORE_INCLUDED |
|||
#define LIGHTWEIGHT_PIPELINE_CORE_INCLUDED |
|||
|
|||
#include "LightweightPipelineInput.cginc" |
|||
|
|||
#if defined(_HARD_SHADOWS) || defined(_SOFT_SHADOWS) || defined(_HARD_SHADOWS_CASCADES) || defined(_SOFT_SHADOWS_CASCADES) |
|||
#define _SHADOWS |
|||
#endif |
|||
|
|||
#if defined(_HARD_SHADOWS_CASCADES) || defined(_SOFT_SHADOWS_CASCADES) |
|||
#define _SHADOW_CASCADES |
|||
#endif |
|||
|
|||
#ifdef _SHADOWS |
|||
#include "LightweightPipelineShadows.cginc" |
|||
#endif |
|||
|
|||
#if defined(_SPECGLOSSMAP_BASE_ALPHA) || defined(_SPECGLOSSMAP) || defined(_SPECULAR_COLOR) |
|||
#define LIGHTWEIGHT_SPECULAR_HIGHLIGHTS |
|||
#endif |
|||
|
|||
#define _DieletricSpec half4(0.04, 0.04, 0.04, 1.0 - 0.04) // standard dielectric reflectivity coef at incident angle (= 4%) |
|||
|
|||
half SpecularReflectivity(half3 specular) |
|||
{ |
|||
#if (SHADER_TARGET < 30) |
|||
// SM2.0: instruction count limitation |
|||
// SM2.0: simplified SpecularStrength |
|||
return specular.r; // Red channel - because most metals are either monocrhome or with redish/yellowish tint |
|||
#else |
|||
return max(max(specular.r, specular.g), specular.b); |
|||
#endif |
|||
} |
|||
|
|||
half3 MetallicSetup(float2 uv, half3 albedo, half albedoAlpha, out half3 specular, out half smoothness, out half oneMinusReflectivity) |
|||
{ |
|||
half2 metallicGloss = MetallicSpecGloss(uv, albedoAlpha).ra; |
|||
half metallic = metallicGloss.r; |
|||
smoothness = metallicGloss.g; |
|||
|
|||
// We'll need oneMinusReflectivity, so |
|||
// 1-reflectivity = 1-lerp(dielectricSpec, 1, metallic) = lerp(1-dielectricSpec, 0, metallic) |
|||
// store (1-dielectricSpec) in unity_ColorSpaceDielectricSpec.a, then |
|||
// 1-reflectivity = lerp(alpha, 0, metallic) = alpha + metallic*(0 - alpha) = |
|||
// = alpha - metallic * alpha |
|||
half oneMinusDielectricSpec = _DieletricSpec.a; |
|||
oneMinusReflectivity = oneMinusDielectricSpec - metallic * oneMinusDielectricSpec; |
|||
specular = lerp(_DieletricSpec.rgb, albedo, metallic); |
|||
|
|||
return albedo * oneMinusReflectivity; |
|||
} |
|||
|
|||
half3 SpecularSetup(float2 uv, half3 albedo, half albedoAlpha, out half3 specular, out half smoothness, out half oneMinusReflectivity) |
|||
{ |
|||
half4 specGloss = MetallicSpecGloss(uv, albedoAlpha); |
|||
specular = specGloss.rgb; |
|||
smoothness = specGloss.a; |
|||
oneMinusReflectivity = 1.0h - SpecularReflectivity(specular); |
|||
return albedo * (half3(1, 1, 1) - specular); |
|||
} |
|||
|
|||
half4 OutputColor(half3 color, half alpha) |
|||
{ |
|||
#if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) |
|||
return LIGHTWEIGHT_LINEAR_TO_GAMMA(half4(color, alpha)); |
|||
#else |
|||
return half4(LIGHTWEIGHT_LINEAR_TO_GAMMA(color), 1); |
|||
#endif |
|||
} |
|||
|
|||
#endif |
|
|||
#ifndef LIGHTWEIGHT_INPUT_INCLUDED |
|||
#define LIGHTWEIGHT_INPUT_INCLUDED |
|||
|
|||
#define MAX_VISIBLE_LIGHTS 16 |
|||
|
|||
// Main light initialized without indexing |
|||
#define INITIALIZE_MAIN_LIGHT(light) \ |
|||
light.pos = _LightPosition; \ |
|||
light.color = _LightColor; \ |
|||
light.atten = _LightAttenuationParams; \ |
|||
light.spotDir = _LightSpotDir; |
|||
|
|||
// Indexing might have a performance hit for old mobile hardware |
|||
#define INITIALIZE_LIGHT(light, lightIndex) \ |
|||
light.pos = globalLightPos[lightIndex]; \ |
|||
light.color = globalLightColor[lightIndex]; \ |
|||
light.atten = globalLightAtten[lightIndex]; \ |
|||
light.spotDir = globalLightSpotDir[lightIndex] |
|||
|
|||
#if !(defined(_SINGLE_DIRECTIONAL_LIGHT) || defined(_SINGLE_SPOT_LIGHT) || defined(_SINGLE_POINT_LIGHT)) |
|||
#define _MULTIPLE_LIGHTS |
|||
#endif |
|||
|
|||
#if defined(UNITY_COLORSPACE_GAMMA) && defined(LIGHTWEIGHT_LINEAR) |
|||
// Ideally we want an approximation of gamma curve 2.0 to save ALU on GPU but as off now it won't match the GammaToLinear conversion of props in engine |
|||
//#define LIGHTWEIGHT_GAMMA_TO_LINEAR(gammaColor) gammaColor * gammaColor |
|||
//#define LIGHTWEIGHT_LINEAR_TO_GAMMA(linColor) sqrt(color) |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(sRGB) sRGB * (sRGB * (sRGB * 0.305306011h + 0.682171111h) + 0.012522878h) |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(linRGB) max(1.055h * pow(max(linRGB, 0.h), 0.416666667h) - 0.055h, 0.h) |
|||
#else |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(color) color |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(color) color |
|||
#endif |
|||
|
|||
|
|||
struct LightInput |
|||
{ |
|||
float4 pos; |
|||
half4 color; |
|||
float4 atten; |
|||
half4 spotDir; |
|||
}; |
|||
|
|||
sampler2D _AttenuationTexture; |
|||
|
|||
// Per object light list data |
|||
#ifdef _MULTIPLE_LIGHTS |
|||
half4 unity_LightIndicesOffsetAndCount; |
|||
half4 unity_4LightIndices0; |
|||
|
|||
// The variables are very similar to built-in unity_LightColor, unity_LightPosition, |
|||
// unity_LightAtten, unity_SpotDirection as used by the VertexLit shaders, except here |
|||
// we use world space positions instead of view space. |
|||
half4 globalLightCount; |
|||
half4 globalLightColor[MAX_VISIBLE_LIGHTS]; |
|||
float4 globalLightPos[MAX_VISIBLE_LIGHTS]; |
|||
half4 globalLightSpotDir[MAX_VISIBLE_LIGHTS]; |
|||
float4 globalLightAtten[MAX_VISIBLE_LIGHTS]; |
|||
#else |
|||
float4 _LightPosition; |
|||
half4 _LightColor; |
|||
float4 _LightAttenuationParams; |
|||
half4 _LightSpotDir; |
|||
#endif |
|||
|
|||
sampler2D _MetallicSpecGlossMap; |
|||
|
|||
half4 _DieletricSpec; |
|||
half _Shininess; |
|||
samplerCUBE _Cube; |
|||
half4 _ReflectColor; |
|||
|
|||
struct LightweightVertexInput |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float3 normal : NORMAL; |
|||
float4 tangent : TANGENT; |
|||
float2 texcoord : TEXCOORD0; |
|||
float2 lightmapUV : TEXCOORD1; |
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct LightweightVertexOutput |
|||
{ |
|||
float4 uv01 : TEXCOORD0; // uv01.xy: uv0, uv01.zw: uv1 |
|||
float4 posWS : TEXCOORD1; |
|||
#if _NORMALMAP |
|||
half3 tangentToWorld0 : TEXCOORD2; // tangentToWorld matrix |
|||
half3 tangentToWorld1 : TEXCOORD3; // tangentToWorld matrix |
|||
half3 tangentToWorld2 : TEXCOORD4; // tangentToWorld matrix |
|||
#else |
|||
half3 normal : TEXCOORD2; |
|||
#endif |
|||
half4 viewDir : TEXCOORD5; // xyz: viewDir |
|||
half4 fogCoord : TEXCOORD6; // x: fogCoord, yzw: vertexColor |
|||
float4 hpos : SV_POSITION; |
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
inline void NormalMap(LightweightVertexOutput i, out half3 normal) |
|||
{ |
|||
#if _NORMALMAP |
|||
half3 normalmap = UnpackNormal(tex2D(_BumpMap, i.uv01.xy)); |
|||
|
|||
// glsl compiler will generate underperforming code by using a row-major pre multiplication matrix: mul(normalmap, i.tangentToWorld) |
|||
// i.tangetToWorld was initialized as column-major in vs and here dot'ing individual for better performance. |
|||
// The code below is similar to post multiply: mul(i.tangentToWorld, normalmap) |
|||
normal = normalize(half3(dot(normalmap, i.tangentToWorld0), dot(normalmap, i.tangentToWorld1), dot(normalmap, i.tangentToWorld2))); |
|||
#else |
|||
normal = normalize(i.normal); |
|||
#endif |
|||
} |
|||
|
|||
inline void SpecularGloss(half2 uv, half alpha, out half4 specularGloss) |
|||
{ |
|||
#ifdef _SPECGLOSSMAP |
|||
specularGloss = tex2D(_SpecGlossMap, uv); |
|||
#if defined(UNITY_COLORSPACE_GAMMA) && defined(LIGHTWEIGHT_LINEAR) |
|||
specularGloss.rgb = LIGHTWEIGHT_GAMMA_TO_LINEAR(specularGloss.rgb); |
|||
#endif |
|||
#elif defined(_SPECGLOSSMAP_BASE_ALPHA) |
|||
specularGloss.rgb = LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_SpecGlossMap, uv).rgb) * _SpecColor.rgb; |
|||
specularGloss.a = alpha; |
|||
#else |
|||
specularGloss = _SpecColor; |
|||
#endif |
|||
} |
|||
|
|||
half4 MetallicSpecGloss(float2 uv, half albedoAlpha) |
|||
{ |
|||
half4 specGloss; |
|||
|
|||
#ifdef _METALLICSPECGLOSSMAP |
|||
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
specGloss.rgb = tex2D(_MetallicSpecGlossMap, uv).rgb; |
|||
specGloss.a = albedoAlpha; |
|||
#else |
|||
specGloss = tex2D(_MetallicSpecGlossMap, uv).rgba; |
|||
#endif |
|||
specGloss.a *= _GlossMapScale; |
|||
|
|||
#else // _METALLICSPECGLOSSMAP |
|||
|
|||
#if _METALLIC_SETUP |
|||
specGloss.r = _Metallic; |
|||
#else |
|||
specGloss.rgb = _SpecColor.rgb; |
|||
#endif |
|||
|
|||
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
specGloss.a = albedoAlpha * _GlossMapScale; |
|||
#else |
|||
specGloss.a = _Glossiness; |
|||
#endif |
|||
#endif |
|||
|
|||
return specGloss; |
|||
} |
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 97d910cfa5d2452e9ac7500b6cee25ab |
|||
timeCreated: 1503661223 |
|
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Inspector |
|||
{ |
|||
public class IMGUISlotEditorPresenter : ScriptableObject |
|||
{ |
|||
[SerializeField] |
|||
MaterialSlot m_Slot; |
|||
|
|||
public MaterialSlot slot |
|||
{ |
|||
get { return m_Slot; } |
|||
set { m_Slot = value; } |
|||
} |
|||
|
|||
public Vector4 value |
|||
{ |
|||
get { return m_Slot.currentValue; } |
|||
set |
|||
{ |
|||
if (value == slot.currentValue) |
|||
return; |
|||
slot.currentValue = value; |
|||
m_Slot.owner.onModified(m_Slot.owner, ModificationScope.Node); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7be91f540ac243ec9bf12002b0fb8c1d |
|||
timeCreated: 1504002750 |
|
|||
fileFormatVersion: 2 |
|||
guid: a0786fdde6014aa6b3222772757dbbb5 |
|||
timeCreated: 1503661346 |
|
|||
fileFormatVersion: 2 |
|||
guid: 99655571e90540559a9c31cfc126bb8d |
|||
timeCreated: 1504786938 |
|
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Inspector |
|||
{ |
|||
public abstract class AbstractNodeEditorPresenter : ScriptableObject |
|||
{ |
|||
public abstract INode node { get; set; } |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Inspector |
|||
{ |
|||
public sealed class StandardNodeEditorPresenter : AbstractNodeEditorPresenter |
|||
{ |
|||
[SerializeField] |
|||
AbstractMaterialNode m_Node; |
|||
|
|||
[SerializeField] |
|||
List<IMGUISlotEditorPresenter> m_SlotEditorPresenters; |
|||
|
|||
public override INode node |
|||
{ |
|||
get { return m_Node; } |
|||
set |
|||
{ |
|||
m_Node = (AbstractMaterialNode)value; |
|||
m_SlotEditorPresenters = new List<IMGUISlotEditorPresenter>(); |
|||
foreach (var slot in node.GetInputSlots<MaterialSlot>()) |
|||
{ |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector1 |
|||
|| slot.concreteValueType == ConcreteSlotValueType.Vector2 |
|||
|| slot.concreteValueType == ConcreteSlotValueType.Vector3 |
|||
|| slot.concreteValueType == ConcreteSlotValueType.Vector4) |
|||
{ |
|||
var slotEditorPresenter = CreateInstance<IMGUISlotEditorPresenter>(); |
|||
slotEditorPresenter.slot = slot; |
|||
m_SlotEditorPresenters.Add(slotEditorPresenter); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public IEnumerable<IMGUISlotEditorPresenter> slotEditorPresenters |
|||
{ |
|||
get { return m_SlotEditorPresenters; } |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2d08dfb360644031a5e64558d4a93263 |
|||
timeCreated: 1503663071 |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue