当前位置:网站首页>Unity surface shader with template buffer
Unity surface shader with template buffer
2022-06-12 06:05:00 【VR technology Xiaoguang】
Shader "Custom/StencilStandard"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_NormalMap("NormalMap", 2D) = "bump" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
[IntRange] _StencilRef("Stencil Reference Value", Range(0,255)) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
Stencil{
Ref[_StencilRef]
Comp Equal
}
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _NormalMap;
struct Input
{
float2 uv_MainTex;
float2 uv_NormalMap;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
float3 normal = UnpackNormal(tex2D(_NormalMap, IN.uv_NormalMap));
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
o.Normal = normal;
}
ENDCG
}
FallBack "Diffuse"
}
边栏推荐
- TCP and UDP introduction
- Why don't databases use hash tables?
- 软件项目架构简单总结
- Login authentication filter
- Who is more fierce in network acceleration? New king reappeared in CDN field
- Un mois de DDD hépatique.
- Jackson - how to convert the array string with only one map object to list < map >
- Solution to the problem of the 80th fortnight competition of leetcode
- Storing texture2d to hard disk JPG file with script under unity3d
- Execute sh script to prompt "[[: not found" solution. The difference between Bash and sh
猜你喜欢

(UE4 4.27) customize primitivecomponent

Leetcode-1260. 2D mesh migration

TCP and UDP introduction

(UE4 4.27) customize globalshader

Sensor bringup 中的一些问题总结

Analysis of memory management mechanism of (UE4 4.26) UE4 uobject

2D human pose estimation for pose estimation - pifpaf:composite fields for human pose estimation

UE4 4.27 modify the mobile forward pipeline to support cluster multi light source culling

Makefile文件编写快速掌握

Front desk display LED number (number type on calculator)
随机推荐
Database experiment I: data definition experiment guide
cv2.fillPoly coco annotator segment坐标转化为mask图像
Leetcode-1706. Where does the club fall
How to split a row of data into multiple rows in Informix database
Es6-es11 learning
Sensor bringup 中的一些问题总结
json-c常用API
Leetcode-553. Optimal division
Research Report on water sports shoes industry - market status analysis and development prospect forecast
数据库实验三:数据查询
User login (medium)
Leetcode simple problem: converting an integer to the sum of two zero free integers
Image processing: image[:,:,:: -1], image[:,: -1,:], image[:,: -1,:]
Storing texture2d to hard disk JPG file with script under unity3d
(UE4 4.27) customize primitivecomponent
Liunx Foundation
Redis队列
Leetcode-1604. Warning people who use the same employee card more than or equal to three times within one hour
The application could not be installed: INSTALL_ FAILED_ TEST_ ONLY
A month's worth of DDD will help you master it