Comments (1)
Shader "Hidden/Hidden Image Illusion"
{
Properties
{
iChannel0 ("iChannel0", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
#define PI acos(-1.0)
#define TAU (PI * 2.0)
#define AA 16.
sampler2D iChannel0;
fixed4 frag (v2f i) : SV_Target
{
float iResolution = float2(500,500);
float2 uv = i.uv;
float shade = 0.0;
float total = 0.0;
for ( float x=0.; x<AA; x++ )
{
float2 uv2 = uv + float2(x/AA,0.0) / iResolution;
float barCount = 100.0;
//shade = cos(barCount * uv.x * TAU)*0.5+0.5;
float bar = step( frac ( uv2.x * barCount ), 0.5 );
float3 tex = tex2D(iChannel0, uv2).rgb;
float Y = dot(tex, float3(0.2126, 0.7152, 0.0722));
float strength = 0.1;
shade += lerp( bar, Y, strength );
total += 1.0f;
}
shade = shade / total;
//shade = shade * (1.0 - Y * strength);
float3 col = float3(1,1,1)*shade;
float p = abs ( frac( _Time.y * 0.3 ) * 2.0 - 1.0 );
if ( uv.y > 0.9 && uv.y < 0.94 )
{
if ( uv.x > (p - 0.01) && uv.x < (p+0.01) )
{
col = float3(1,0,0);
}
}
return float4(col,1.0);
}
ENDCG
}
}
}
from shaderman.
Related Issues (20)
- I want run this shader in Unity2019.3, but unfortunately it doesnot work. HOT 1
- Not work HOT 1
- No workee in Unity 2020.1.10f1 HOT 3
- Direct2D Support
- Shader doesnt convert HOT 1
- Hello,MyShader conver was wrong HOT 5
- Type mismatch on line (d3d11) HOT 1
- Syntax error unexpected end of file at line (on d3d11) HOT 1
- Tools menu not showing in 2019.4 HOT 1
- Broken Converter HOT 1
- Julia - Quaternion not converting
- Should update the main page/readMe to say that the "shaderman" menu item is in Unity's /windows/ menu, NOT in a "tools" menu.
- Shader not compiling in 2020.3.x
- Always an error no matter what (Token and TOK and more
- Every single shader broken in unity 2018.4.20.f1 HOT 1
- "mod()" conversion from Shadertoy to Unity is inaccurate.
- Generated shader is gibberish
- only work with a couple of shader
- There is a problem about converting mod to fmod
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shaderman.