您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

44 行
1.2 KiB

Shader "Hidden/Custom/LWtest/HalftoneOpaque"
{
Properties
{
_Pattern ("Pattern", 2D) = "grey" {}
[IntRange]_Steps ("Steps", Range(1, 10)) = 4
}
HLSLINCLUDE
#include "../../../../../../../PostProcessing/PostProcessing/Shaders/StdLib.hlsl"
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
TEXTURE2D_SAMPLER2D(_Pattern, sampler_MainTex);
float _Blend;
float _Scale;
float _Steps;
float4 Frag(VaryingsDefault i) : SV_Target
{
float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
float luminance = 1 + dot(color.rgb, float3(0.2126729, 0.7151522, 0.0721750)) * 0.25;
float3 pattern = SAMPLE_TEXTURE2D(_Pattern, sampler_MainTex, i.texcoord * (_ScreenParams.xy * _Scale * luminance)).rgb;
color.rgb = round(((pattern.rrr)-_Blend) + (color * _Steps)) / _Steps;
return color;
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment Frag
ENDHLSL
}
}
}