Matt Dean
7 年前
当前提交
2c7d3d45
共有 20 个文件被更改,包括 934 次插入 和 162 次删除
-
8MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightCore.cginc
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightFastBlinn.cginc
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightPBR.cginc
-
14MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/CGIncludes/LightweightShadows.cginc
-
2MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPBR.shader
-
17MaterialGraphProject/Assets/Test-Legacy.mat
-
17MaterialGraphProject/Assets/Test-PBR.mat
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderFastBlinn.template
-
244MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderPBR.template
-
30MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightPBRMasterNode.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightMetallicMasterNode.cs
-
94MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/ShaderTest.unity
-
331MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/GraphTest.shader
-
11MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/GraphTest.shader.meta
-
77MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/TestyTest.ShaderGraph
-
11MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/TestyTest.ShaderGraph.meta
-
101MaterialGraphProject/Assets/TestGraph-PBR.mat
-
10MaterialGraphProject/Assets/TestGraph-PBR.mat.meta
-
94MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightSpecularMasterNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightSpecularMasterNode.cs.meta
|
|||
Shader "GraphOutputTest" |
|||
{ |
|||
Properties |
|||
{ |
|||
Vector1_Vector1_4B0AEC3F_Uniform("Smoothness", Float) = 0.5 |
|||
Vector1_Vector1_5370E8F3_Uniform("Metallic / Specular", Float) = 0.5 |
|||
Color_Color_8256B4E6_Uniform("Color", Color) = (0,0,0,0) |
|||
|
|||
} |
|||
|
|||
SubShader |
|||
{ |
|||
Tags{ "RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline" } |
|||
|
|||
LOD 200 |
|||
|
|||
Pass |
|||
{ |
|||
Tags |
|||
{ |
|||
"LightMode" = "LightweightForward" |
|||
"RenderType" = "Opaque" |
|||
"Queue" = "Geometry" |
|||
} |
|||
|
|||
Blend One Zero |
|||
|
|||
Cull Back |
|||
|
|||
ZTest LEqual |
|||
|
|||
ZWrite On |
|||
|
|||
|
|||
CGPROGRAM |
|||
#pragma target 3.0 |
|||
#include "UnityCG.cginc" |
|||
|
|||
#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 LightweightVertexCustom |
|||
#pragma fragment LightweightFragmentPBR |
|||
//#pragma glsl |
|||
//#pragma debug |
|||
|
|||
|
|||
float Vector1_Vector1_4B0AEC3F_Uniform; |
|||
float Vector1_Vector1_5370E8F3_Uniform; |
|||
float4 Color_Color_8256B4E6_Uniform; |
|||
|
|||
//sampler2D _MainTex; |
|||
//float4 _MainTex_ST; |
|||
|
|||
struct vInput |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float4 normal : NORMAL; |
|||
float2 lightmapUV : TEXCOORD0; |
|||
float4 color : COLOR; |
|||
|
|||
float2 texcoord : TEXCOORD1; |
|||
|
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct vOutput |
|||
{ |
|||
float4 posWS : TEXCOORD0; |
|||
half4 viewDir : TEXCOORD1; |
|||
half4 fogCoord : TEXCOORD2; |
|||
half3 normal : TEXCOORD3; |
|||
float4 hpos : SV_POSITION; |
|||
|
|||
float4 uv01 : TEXCOORD4; |
|||
|
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
#include "UnityStandardInput.cginc" |
|||
|
|||
vOutput LightweightVertexCustom(vInput v) |
|||
{ |
|||
vOutput o = (vOutput)0; |
|||
|
|||
UNITY_SETUP_INSTANCE_ID(v); |
|||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|||
|
|||
o.uv01.xy = TRANSFORM_TEX(v.texcoord, _MainTex); |
|||
|
|||
//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; |
|||
} |
|||
|
|||
#include "CGIncludes/LightweightShadows.cginc" |
|||
#include "CGIncludes/LightweightBRDF.cginc" |
|||
#include "CGIncludes/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 o; |
|||
o.Albedo = float3(0.5, 0.5, 0.5); |
|||
o.Specular = float3(0, 0, 0); |
|||
o.Metallic = 0; |
|||
o.Normal = float3(.5, .5, 1); |
|||
o.Emission = 0; |
|||
o.Smoothness = 0; |
|||
o.Occlusion = 1; |
|||
o.Alpha = 1; |
|||
return o; |
|||
} |
|||
|
|||
void DefineSurface(vOutput i, inout SurfacePBR o) |
|||
{ |
|||
o.Albedo = Color_Color_8256B4E6_Uniform; |
|||
o.Specular = Vector1_Vector1_5370E8F3_Uniform; |
|||
o.Smoothness = Vector1_Vector1_4B0AEC3F_Uniform; |
|||
|
|||
} |
|||
|
|||
half3 MetallicSetup(SurfacePBR o, out half3 specular, out half smoothness, out half oneMinusReflectivity) |
|||
{ |
|||
smoothness = o.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 - o.Metallic * oneMinusDielectricSpec; |
|||
specular = lerp(_DieletricSpec.rgb, o.Albedo, o.Metallic); |
|||
|
|||
return o.Albedo * oneMinusReflectivity; |
|||
} |
|||
|
|||
half3 SpecularSetup(SurfacePBR o, out half3 specular, out half smoothness, out half oneMinusReflectivity) |
|||
{ |
|||
half4 specGloss = float4(o.Specular, o.Smoothness); |
|||
|
|||
#if defined(UNITY_COLORSPACE_GAMMA) && defined(LIGHTWEIGHT_LINEAR) |
|||
specGloss.rgb = LIGHTWEIGHT_GAMMA_TO_LINEAR(specGloss.rgb); |
|||
#endif |
|||
|
|||
specular = specGloss.rgb; |
|||
smoothness = specGloss.a; |
|||
oneMinusReflectivity = 1.0h - SpecularReflectivity(specular); |
|||
return o.Albedo * (half3(1, 1, 1) - specular); |
|||
} |
|||
|
|||
half4 LightweightFragmentPBR(vOutput i) : SV_Target |
|||
{ |
|||
SurfacePBR o = InitializeSurfacePBR(); |
|||
DefineSurface(i, o); |
|||
|
|||
//float2 uv = i.uv01.xy; |
|||
float2 lightmapUV = i.uv01.zw; |
|||
|
|||
half3 specColor; |
|||
half smoothness; |
|||
half oneMinusReflectivity; |
|||
//#ifdef _METALLIC_SETUP |
|||
//half3 diffColor = MetallicSetup(o, specColor, smoothness, oneMinusReflectivity); |
|||
//#else |
|||
half3 diffColor = SpecularSetup(o, specColor, smoothness, oneMinusReflectivity); |
|||
//#endif |
|||
|
|||
diffColor = PreMultiplyAlpha(diffColor, o.Alpha, oneMinusReflectivity, /*out*/ o.Alpha); |
|||
|
|||
// Roughness is (1.0 - smoothness)² |
|||
half perceptualRoughness = 1.0h - smoothness; |
|||
|
|||
// TODO - Actually handle normal |
|||
half3 normal; |
|||
CalculateNormal(i.normal, normal); |
|||
|
|||
// 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; |
|||
|
|||
#ifndef _MULTIPLE_LIGHTS |
|||
LightInput light; |
|||
INITIALIZE_MAIN_LIGHT(light); |
|||
half lightAtten = ComputeLightAttenuation(light, normal, i.posWS.xyz, lightDirection); |
|||
|
|||
//#ifdef _SHADOWS |
|||
lightAtten *= ComputeShadowAttenuation(i.normal, 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(i.normal, 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); |
|||
} |
|||
|
|||
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 |
|||
} |
|||
} |
|||
|
|||
|
|||
//FallBack "Diffuse" |
|||
CustomEditor "LegacyIlluminShaderGUI" |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 542ef8f442f720644896ebc5885e65f6 |
|||
timeCreated: 1505451746 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
77
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/TestyTest.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 02a3ca69ec995e94aa47105621a17e4c |
|||
timeCreated: 1505452895 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
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-PBR |
|||
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_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: 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} |
|||
- _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_5370E8F3_Uniform: 0 |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 1 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _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_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} |
|
|||
fileFormatVersion: 2 |
|||
guid: d6c557b0ad00a7946b27400b33a390ac |
|||
timeCreated: 1505335385 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
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 const string LightFunctionName = "Standard";
|
|||
//public const string SurfaceOutputStructureName = "SurfaceOutputStandard";
|
|||
|
|||
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; |
|||
} |
|||
|
|||
/*public override string GetSurfaceOutputName() |
|||
{ |
|||
return SurfaceOutputStructureName; |
|||
} |
|||
|
|||
public override string GetLightFunction() |
|||
{ |
|||
return LightFunctionName; |
|||
}*/ |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: bf358c1c084b6cf4b9a4a9cc49cd61f0 |
|||
timeCreated: 1478188276 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue