Shader Forge还是正式在2018.3不能使用了。。。
无奈之下只能开始使用Shader Graph。
第一个效果:
Fresnel + HighLight 提示
关于Shader源码的查看,CopyShader菜单就可以了,然后在VS中粘贴。
代码如下:有很多LightWeight的引用,不能在非LWRP环境中使用。
Shader "Unlit Master"
{
Properties
{
}
SubShader
{
Tags{ "RenderPipeline" = "LightweightPipeline"}
Tags
{
"RenderPipeline"="HDRenderPipeline"
"RenderType"="Opaque"
"Queue"="Geometry+0"
}
Pass
{
Name "StandardUnlit"
Tags{"LightMode" = "LightweightForward"}
// Material options generated by graph
Blend One Zero
Cull Back
ZTest LEqual
ZWrite On
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
// -------------------------------------
// Lightweight Pipeline keywords
#pragma shader_feature _SAMPLE_GI
// -------------------------------------
// Unity defined keywords
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile_fog
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vert
#pragma fragment frag
// Defines generated by graph
// Lighting include is needed because of GI
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/UnlitInput.hlsl"
CBUFFER_START(UnityPerMaterial)
CBUFFER_END
struct VertexDescriptionInputs
{
float3 ObjectSpacePosition;
};
struct SurfaceDescriptionInputs
{
};
struct VertexDescription
{
float3 Position;
};
VertexDescription PopulateVertexData(VertexDescriptionInputs IN)
{
VertexDescription description = (VertexDescription)0;
description.Position = IN.ObjectSpacePosition;
return description;
}
struct SurfaceDescription
{
float3 Color;
float Alpha;
float AlphaClipThreshold;
};
SurfaceDescription PopulateSurfaceData(SurfaceDescriptionInputs IN)
{
SurfaceDescription surface = (SurfaceDescription)0;
surface.Color = IsGammaSpace() ? float3(1, 0.01415092, 0.01415092) : SRGBToLinear(float3(1, 0.01415092, 0.01415092));
surface.Alpha = 1;
surface.AlphaClipThreshold = 0;
return surface;
}
struct GraphVertexInput
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 texcoord1 : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct GraphVertexOutput
{
float4 position : POSITION;
// Interpol