add emissive and color scale.

This commit is contained in:
hecomi
2020-03-15 23:58:44 +09:00
parent 9dc63e7c9c
commit 7bf645f500
6 changed files with 16 additions and 23 deletions
@@ -2,8 +2,11 @@
#define UDD_PARAMS_CGINC #define UDD_PARAMS_CGINC
sampler2D _MainTex; sampler2D _MainTex;
fixed4 _Color; half4 _Color;
sampler2D _CursorTex; half _ColorScale;
half _Radius;
half _Width;
half _Thickness;
half4 _CursorPositionScale; half4 _CursorPositionScale;
#define _CursorX _CursorPositionScale.x #define _CursorX _CursorPositionScale.x
@@ -7,6 +7,7 @@ Properties
_MainTex ("Albedo (RGB)", 2D) = "white" {} _MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0, 1)) = 0.5 _Glossiness ("Smoothness", Range(0, 1)) = 0.5
_Metallic ("Metallic", Range(0, 1)) = 0.0 _Metallic ("Metallic", Range(0, 1)) = 0.0
_Emissive ("Emissive", Range(0, 10)) = 0.0
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0 [KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0 [Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30 [PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
@@ -38,9 +39,7 @@ SubShader
half _Glossiness; half _Glossiness;
half _Metallic; half _Metallic;
half _Radius; half _Emissive;
half _Width;
half _Thickness;
void vert(inout appdata_full v) void vert(inout appdata_full v)
{ {
@@ -55,6 +54,7 @@ SubShader
o.Metallic = _Metallic; o.Metallic = _Metallic;
o.Smoothness = _Glossiness; o.Smoothness = _Glossiness;
o.Alpha = c.a; o.Alpha = c.a;
o.Emission = c.rgb * _Emissive;
} }
ENDCG ENDCG
@@ -4,6 +4,7 @@
Properties Properties
{ {
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)
_ColorScale ("ColorScale", Range(0.0, 10.0)) = 1.0
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0 [KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0 [Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
@@ -24,10 +25,6 @@ CGINCLUDE
#include "./uDD_Common.cginc" #include "./uDD_Common.cginc"
half _Radius;
half _Width;
half _Thickness;
v2f vert(appdata v) v2f vert(appdata v)
{ {
v2f o; v2f o;
@@ -39,7 +36,7 @@ v2f vert(appdata v)
fixed4 frag(v2f i) : SV_Target fixed4 frag(v2f i) : SV_Target
{ {
return uddGetScreenTexture(i.uv); return uddGetScreenTexture(i.uv) * _Color * _ColorScale;
} }
ENDCG ENDCG
@@ -4,6 +4,7 @@
Properties Properties
{ {
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)
_ColorScale ("ColorScale", Range(0.0, 10.0)) = 1.0
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
_Mask ("Mask", Range(0, 1)) = 0.1 _Mask ("Mask", Range(0, 1)) = 0.1
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0 [KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
@@ -28,9 +29,6 @@ CGINCLUDE
#include "./uDD_Common.cginc" #include "./uDD_Common.cginc"
fixed _Mask; fixed _Mask;
half _Radius;
half _Width;
half _Thickness;
v2f vert(appdata v) v2f vert(appdata v)
{ {
@@ -45,7 +43,7 @@ fixed4 frag(v2f i) : SV_Target
{ {
fixed4 tex = uddGetScreenTexture(i.uv); fixed4 tex = uddGetScreenTexture(i.uv);
fixed alpha = pow((tex.r + tex.g + tex.b) / 3.0, _Mask); fixed alpha = pow((tex.r + tex.g + tex.b) / 3.0, _Mask);
return fixed4(tex.rgb * _Color.rgb, alpha * _Color.a); return fixed4(tex.rgb * _Color.rgb * _ColorScale, alpha * _Color.a);
} }
ENDCG ENDCG
@@ -4,6 +4,7 @@
Properties Properties
{ {
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)
_ColorScale ("ColorScale", Range(0.0, 10.0)) = 1.0
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0 [KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0 [Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
@@ -30,9 +31,6 @@ CGINCLUDE
#include "./uDD_Common.cginc" #include "./uDD_Common.cginc"
#include "Tessellation.cginc" #include "Tessellation.cginc"
half _Radius;
half _Width;
half _Thickness;
Texture2D _DispTex; Texture2D _DispTex;
SamplerState sampler_DispTex; SamplerState sampler_DispTex;
half _DispFactor; half _DispFactor;
@@ -150,7 +148,7 @@ DsOutput domain(
fixed4 frag(DsOutput i) : SV_Target fixed4 frag(DsOutput i) : SV_Target
{ {
return uddGetScreenTexture(i.f2TexCoord); return uddGetScreenTexture(i.f2TexCoord) * _Color * _ColorScale;
} }
ENDCG ENDCG
@@ -4,6 +4,7 @@
Properties Properties
{ {
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)
_ColorScale ("ColorScale", Range(0.0, 10.0)) = 1.0
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0 [KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0 [Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
@@ -26,10 +27,6 @@ CGINCLUDE
#include "./uDD_Common.cginc" #include "./uDD_Common.cginc"
half _Radius;
half _Width;
half _Thickness;
v2f vert(appdata v) v2f vert(appdata v)
{ {
v2f o; v2f o;
@@ -41,7 +38,7 @@ v2f vert(appdata v)
fixed4 frag(v2f i) : SV_Target fixed4 frag(v2f i) : SV_Target
{ {
return fixed4(uddGetScreenTexture(i.uv).rgb, 1.0) * _Color; return fixed4(uddGetScreenTexture(i.uv).rgb * _ColorScale, 1.0) * _Color;
} }
ENDCG ENDCG