Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Bag in shader

Discussion in 'Shaders' started by etghumster, Apr 15, 2023.

  1. etghumster

    etghumster

    Joined:
    Apr 2, 2023
    Posts:
    4
    Parse error: syntax error, unexpected TVAL_ID (13)
    Version 2021.3.23f1



    Code (CSharp):
    1. Shader "Custom\Pixelate" {
    2.     Properties{
    3.         _CellSize("Cell Size", Vector) = (0.02,0.02,0,0)
    4.     }
    5.     SubShader {
    6.         LOD 200
    7.         Tags { "QUEUE" = "Transparent" "RenderType" = "Opaque" }
    8.         GrabPass {
    9.             "_PixelationGrabTexture"
    10.         }
    11.             LOD 200
    12.             GpuProgramID 9664
    13.             Program "vp" {
    14.                 SubProgram "d3d11 " {
    15.                     "vs_4_0
    16.                  
    17.                    #version 330
    18.                    #extension GL_ARB_explicit_attrib_location : require
    19.                    #extension GL_ARB_explicit_uniform_location : require
    20.                  
    21.                    #define HLSLCC_ENABLE_UNIFORM_BUFFERS 1
    22.                    #if HLSLCC_ENABLE_UNIFORM_BUFFERS
    23.                    #define UNITY_UNIFORM
    24.                    #else
    25.                    #define UNITY_UNIFORM uniform
    26.                    #endif
    27.                    #define UNITY_SUPPORTS_UNIFORM_LOCATION 1
    28.                    #if UNITY_SUPPORTS_UNIFORM_LOCATION
    29.                    #define UNITY_LOCATION(x) layout(location = x)
    30.                    #define UNITY_BINDING(x) layout(binding = x, std140)
    31.                    #else
    32.                    #define UNITY_LOCATION(x)
    33.                    #define UNITY_BINDING(x) layout(std140)
    34.                    #endif
    35.                    layout(std140) uniform UnityPerDraw {
    36.                        mat4x4 unity_ObjectToWorld;
    37.                        vec4 unused_0_1[6];
    38.                    };
    39.                    layout(std140) uniform UnityPerFrame {
    40.                        vec4 unused_1_0[17];
    41.                        mat4x4 unity_MatrixVP;
    42.                        vec4 unused_1_2[2];
    43.                    };
    44.                    in  vec4 in_POSITION0;
    45.                    out vec4 vs_TEXCOORD0;
    46.                    vec4 u_xlat0;
    47.                    vec4 u_xlat1;
    48.                    void main()
    49.                    {
    50.                        u_xlat0 = in_POSITION0.yyyy * unity_ObjectToWorld[1];
    51.                        u_xlat0 = unity_ObjectToWorld[0] * in_POSITION0.xxxx + u_xlat0;
    52.                        u_xlat0 = unity_ObjectToWorld[2] * in_POSITION0.zzzz + u_xlat0;
    53.                        u_xlat0 = u_xlat0 + unity_ObjectToWorld[3];
    54.                        u_xlat1 = u_xlat0.yyyy * unity_MatrixVP[1];
    55.                        u_xlat1 = unity_MatrixVP[0] * u_xlat0.xxxx + u_xlat1;
    56.                        u_xlat1 = unity_MatrixVP[2] * u_xlat0.zzzz + u_xlat1;
    57.                        u_xlat0 = unity_MatrixVP[3] * u_xlat0.wwww + u_xlat1;
    58.                        gl_Position = u_xlat0;
    59.                        u_xlat1.xyz = u_xlat0.xwy * vec3(0.5, 0.5, -0.5);
    60.                        vs_TEXCOORD0.zw = u_xlat0.zw;
    61.                        vs_TEXCOORD0.xy = u_xlat1.yy + u_xlat1.xz;
    62.                        return;
    63.                    }"
    64.                 }
    65.             }
    66.             Program "fp" {
    67.                 SubProgram "d3d11 " {
    68.                     "ps_4_0
    69.                  
    70.                    #version 330
    71.                    #extension GL_ARB_explicit_attrib_location : require
    72.                    #extension GL_ARB_explicit_uniform_location : require
    73.                  
    74.                    #define HLSLCC_ENABLE_UNIFORM_BUFFERS 1
    75.                    #if HLSLCC_ENABLE_UNIFORM_BUFFERS
    76.                    #define UNITY_UNIFORM
    77.                    #else
    78.                    #define UNITY_UNIFORM uniform
    79.                    #endif
    80.                    #define UNITY_SUPPORTS_UNIFORM_LOCATION 1
    81.                    #if UNITY_SUPPORTS_UNIFORM_LOCATION
    82.                    #define UNITY_LOCATION(x) layout(location = x)
    83.                    #define UNITY_BINDING(x) layout(binding = x, std140)
    84.                    #else
    85.                    #define UNITY_LOCATION(x)
    86.                    #define UNITY_BINDING(x) layout(std140)
    87.                    #endif
    88.                    layout(std140) uniform PGlobals {
    89.                        vec4 unused_0_0[2];
    90.                        vec4 _CellSize;
    91.                    };
    92.                    uniform  sampler2D _PixelationGrabTexture;
    93.                    in  vec4 vs_TEXCOORD0;
    94.                    layout(location = 0) out vec4 SV_Target0;
    95.                    vec2 u_xlat0;
    96.                    void main()
    97.                    {
    98.                        u_xlat0.xy = vs_TEXCOORD0.xy / vs_TEXCOORD0.ww;
    99.                        u_xlat0.xy = u_xlat0.xy / _CellSize.xy;
    100.                        u_xlat0.xy = roundEven(u_xlat0.xy);
    101.                        u_xlat0.xy = u_xlat0.xy * _CellSize.xy;
    102.                        SV_Target0 = texture(_PixelationGrabTexture, u_xlat0.xy);
    103.                        return;
    104.                    }"
    105.                 }
    106.            
    107.         }
    108.    
    109. }
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,864
    As I answered in another thread, this is a compiled shader. You need to get the original source for it to work.
     
  3. etghumster

    etghumster

    Joined:
    Apr 2, 2023
    Posts:
    4
    Where i can see original source, or need create new?
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,255
    From whomever original wrote the shader. If you do not know who that is, or don't know how to contact them, then yes, you'll have to write a new shader from scratch.
     
  5. etghumster

    etghumster

    Joined:
    Apr 2, 2023
    Posts:
    4
    THX