Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba5ebe8094 | ||
|
|
1e2ac40507 |
@@ -1,6 +1,8 @@
|
||||
#ifndef UDD_COMMON_CGINC
|
||||
#define UDD_COMMON_CGINC
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
inline void uddInvertUV(inout float2 uv)
|
||||
{
|
||||
#ifdef INVERT_X
|
||||
@@ -11,4 +13,14 @@ inline void uddInvertUV(inout float2 uv)
|
||||
#endif
|
||||
}
|
||||
|
||||
inline fixed4 uddGetTexture(sampler2D tex, float2 uv)
|
||||
{
|
||||
uddInvertUV(uv);
|
||||
fixed4 c = tex2D(tex, uv);
|
||||
if (!IsGammaSpace()) {
|
||||
c.rgb = GammaToLinearSpace(c.rgb);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -35,8 +35,7 @@ SubShader
|
||||
|
||||
void surf(Input IN, inout SurfaceOutputStandard o)
|
||||
{
|
||||
uddInvertUV(IN.uv_MainTex);
|
||||
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
|
||||
fixed4 c = uddGetTexture(_MainTex, IN.uv_MainTex) * _Color;
|
||||
o.Albedo = c.rgb;
|
||||
o.Metallic = _Metallic;
|
||||
o.Smoothness = _Glossiness;
|
||||
|
||||
@@ -43,8 +43,7 @@ v2f vert(appdata v)
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
uddInvertUV(i.uv);
|
||||
return tex2D(_MainTex, i.uv) * _Color;
|
||||
return uddGetTexture(_MainTex, i.uv) * _Color;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
@@ -48,8 +48,7 @@ v2f vert(appdata v)
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
uddInvertUV(i.uv);
|
||||
fixed4 tex = tex2D(_MainTex, i.uv);
|
||||
fixed4 tex = uddGetTexture(_MainTex, i.uv);
|
||||
fixed alpha = pow((tex.r + tex.g + tex.b) / 3.0, _Mask);
|
||||
return fixed4(tex.rgb * _Color.rgb, alpha);
|
||||
}
|
||||
|
||||
@@ -46,8 +46,7 @@ v2f vert(appdata v)
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
uddInvertUV(i.uv);
|
||||
return fixed4(tex2D(_MainTex, i.uv).rgb, 1.0) * _Color;
|
||||
return fixed4(uddGetTexture(_MainTex, i.uv).rgb, 1.0) * _Color;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
@@ -29,7 +29,7 @@ TODOs
|
||||
-----
|
||||
- [x] Mouse cursor
|
||||
- [ ] Monitor selector
|
||||
- [ ] Support linear color
|
||||
- [x] Support linear color
|
||||
|
||||
Please request new features you want to issues.
|
||||
|
||||
@@ -38,5 +38,6 @@ Version
|
||||
-------
|
||||
| Data | Version | Description |
|
||||
| ---------- | ------- | --------------------------------- |
|
||||
| 2016/10/27 | 0.0.3 | Support lienar color. |
|
||||
| 2016/10/27 | 0.0.2 | Add mouse cursor / shader family. |
|
||||
| 2016/10/27 | 0.0.1 | Initial commit. |
|
||||
|
||||
Reference in New Issue
Block a user