Coder Social home page Coder Social logo

Shader doesnt convert about shaderman HOT 1 OPEN

smkplus avatar smkplus commented on September 16, 2024
Shader doesnt convert

from shaderman.

Comments (1)

smkplus avatar smkplus commented on September 16, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.