Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JuiceArt · Sep 28, 2017 at 04:21 AM · strange ioc

UnityObjectToClipPos: o matching function, when develop in Linux Unity

(Some trouble with Topics: there are no Items in the list) Hello, I am trying to migrate my project to Linux Unity. On Windows everything works fine, but Linux version gives an error in my shader:

 'UnityObjectToClipPos' : no matching overloaded function found
 Compiling Vertex program

Could You, please, advice something ?

Here is my shader code:

 // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
 
 Shader "Custom/TransformSystem"
 {
     Properties
     {
             _MainTex ("Texture", 2D) = "white" {}
             _ShiftY("ShiftY",Int) = 0
             _Swing_Left("Swing_Left", Range(0.1, 1.0)) = 1.0
             _Swing_Right("Swing_Right", Range(0.1, 1.0)) = 1.0
             _NF("NF",Float) = 1
             _MiddlePos("MiddlePos",Float) = 0.5
             _LeftShift("LeftShift", Vector) = (0,0,0,0)
             _MiddleShift("MiddleShift", Vector) = (0,0,0,0)
             _RightShift("RightShift", Vector) = (0,0,0,0)
     }
     SubShader
     {
         // No culling or depth
         Cull Off ZWrite Off ZTest Always
 
         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;
             }
             
             static const float startShift = 0.0f;
             static const float numSize = 0.094f;
             static const float scaleFactor = 1.5f;
 
             sampler2D _MainTex;
             int _ShiftY;
             float _MiddlePos;
             float _Swing_Left;
             float _Swing_Right;
             float _NF;
             float _Ky;
             Vector _LeftShift;
             Vector _MiddleShift;
             Vector _RightShift;
     
             float getDistance(float2 pixelPos, float2 cornerPos)
             {
                         float xDist = cornerPos[0] - pixelPos[0];
                         float yDist = cornerPos[1] - pixelPos[1];
                         float distSqr = xDist * xDist + yDist * yDist;
                         if(distSqr ==0.0f)
                             distSqr = 0.001f;
                         return  sqrt(xDist * xDist + yDist * yDist );
             }
 
             int biggerFlag = 0;
             float2 gePixelShiftLeft(float2 pixelPos)
             {
             float4 weights = float4(0,0,0,0);
 
             if(pixelPos[0] <=_MiddlePos)
             {
 
                 float2 dp0 = float2(pixelPos[0], 0);
                 float2 dp1 = float2(_MiddlePos, pixelPos[1]);
                 float2 dp2 = float2(pixelPos[0],1);
                 float2 dp3 = float2(0,pixelPos[1]);
 
                 //dp0
 
                 float2 weights_dp0 = float2(0,0);
                 weights_dp0[0] = 1.0f / getDistance(dp0, float2(0.0f, 0.0f));
                 weights_dp0[1] = 1.0f / getDistance(dp0, float2(_MiddlePos, 0.0f));
                 weights_dp0 /= (weights_dp0[0] + weights_dp0[1]);
 
                 //return weights_dp0;
                 float2 shift_dp0 = float2(0,0);
                 shift_dp0[0] = _LeftShift[0] * weights_dp0[0] + _MiddleShift[2] * weights_dp0[1];
                 shift_dp0[1] = _LeftShift[1] * weights_dp0[0] + _MiddleShift[1] * weights_dp0[1];
                 //return shift_dp0;
                 //return float2( shift_dp0[0], 0);
                 //dp1
 
                 float2 weights_dp1 = float2(0,0);
                 weights_dp1[0] = 1.0f / getDistance(dp1, float2(_MiddlePos, 0.0f));
                 weights_dp1[1] = 1.0f / getDistance(dp1, float2(_MiddlePos, 1.0f));
                 weights_dp1 /= (weights_dp1[0] + weights_dp1[1]);
 
                 float2 shift_dp1 = float2(0,0);
                 shift_dp1[0] =  _MiddleShift[2] * weights_dp1[0] + _MiddleShift[0] * weights_dp1[1];
                 shift_dp1[1] =  _MiddleShift[1] * weights_dp1[0] + _MiddleShift[3] * weights_dp1[1];
                 //dp2
 
                 float2 weights_dp2 = float2(0,0);
                 weights_dp2[0] = 1.0f / getDistance(dp2, float2(_MiddlePos, 1.0f));
                 weights_dp2[1] = 1.0f / getDistance(dp2, float2(0.0f, 1.0f));
                 weights_dp2 /= (weights_dp2[0] + weights_dp2[1]);
 
                 float2 shift_dp2 = float2(0,0);
                 shift_dp2[0] = _MiddleShift[0] * weights_dp2[0] + _LeftShift[2] * weights_dp2[1];
                 shift_dp2[1] = _MiddleShift[3] * weights_dp2[0] + _LeftShift[3] * weights_dp2[1];
                 //return shift_dp2;
                 //dp3
 
                 float2 weights_dp3 = float2(0,0);
                 weights_dp3[0] = 1.0f / getDistance(dp3, float2(0.0f, 1.0f));
                 weights_dp3[1] = 1.0f / getDistance(dp3, float2(0.0f, 0.0f));
                 weights_dp3 /= (weights_dp3[0] + weights_dp3[1]);
 
                 float2 shift_dp3 = float2(0,0);
                 shift_dp3[0] = _LeftShift[0] * weights_dp3[0]  + _LeftShift[2] * weights_dp3[1];
                 shift_dp3[1] = _LeftShift[1] * weights_dp3[0]  + _LeftShift[3] * weights_dp3[1];
 
                 if(shift_dp3[0] > -2)
                     biggerFlag = 1;
                 else
                     biggerFlag = 0;
 
                 //return shift_dp3;
 
                 weights[0] = 1.0f / getDistance(pixelPos, float2(0.0f, 0.0f));
                 weights[1] = 1.0f / getDistance(pixelPos, float2(_MiddlePos, 0.0f));
                 weights[2] = 1.0f / getDistance(pixelPos, float2(_MiddlePos, 1.0f));
                 weights[3] = 1.0f / getDistance(pixelPos, float2(0.0f, 1.0f));
 
                 weights /= (weights[0] + weights[1] + weights[2] + weights[3]);
 
                 //return float2(weights[0], weights[1]);
 
                 float weight_dp0 = pixelPos[1];
                 float weight_dp1 =pixelPos[0];
                 float weight_dp2 = 1 -  pixelPos[1];
                 float weight_dp3 = _MiddlePos -  pixelPos[0];
 
                 //return float2(weight_dp1, weight_dp3);
 
                 float2 shift = float2(0,0);
                 shift[0] = shift_dp1[0] * weight_dp1 + shift_dp3[0] * weight_dp3;
                 shift[1] = shift_dp0[1] * weight_dp0 + shift_dp2[1] * weight_dp2;
 
 
             
                 float2 sign2 = float2( shift[0] / abs(shift[0]),  shift[1] / abs(shift[1]));
 
                 float2 shift_save = shift;
 
                 float test_value = (-1.0f * _Swing_Left);
                 float shifted_functon_value = test_value + test_value * test_value / 2;
                 float additional_function_mul_y = -0.5f / shifted_functon_value;
 
                 float my_k_x= 1.0f+ 2 / (shift_dp3[0] - shift_dp1[0] );
                 //my_k_x = 1;
 
                 shift[0] = ((shift[0] * _Swing_Left + shift[0] * shift[0] * _Swing_Left * _Swing_Left / 2) * additional_function_mul_y ) * my_k_x;
 
                 //if(shift_save[0]  < -1.0f )
                 //    shift[0]  = 1.01f;
 
                 return shift;
             }
 
 
             return float2(0,0);
 
             }
 
 
 
             float2 gePixelShiftRight(float2 pixelPos)
             {
 
             if(pixelPos[0] > _MiddlePos)
             {
 
                 float2 dp0 = float2(pixelPos[0], 0);
                 float2 dp1 = float2(1, pixelPos[1]);
                 float2 dp2 = float2(pixelPos[0],1);
                 float2 dp3 = float2(_MiddlePos,pixelPos[1]);
 
                 //dp0
 
                 float2 weights_dp0 = float2(0,0);
                 weights_dp0[0] = 1.0f / getDistance(dp0, float2(_MiddlePos, 0.0f));
                 weights_dp0[1] = 1.0f / getDistance(dp0, float2(1.0f, 0.0f));
                 weights_dp0 /= (weights_dp0[0] + weights_dp0[1]);
 
                 //return weights_dp0;
                 float2 shift_dp0 = float2(0,0);
                 shift_dp0[0] = _MiddleShift[0] * weights_dp0[0] + _RightShift[2] * weights_dp0[1];
                 shift_dp0[1] = _MiddleShift[1] * weights_dp0[0] + _RightShift[1] * weights_dp0[1];
                 //return shift_dp0;
                 //return float2( shift_dp0[0], 0);
                 //dp1
 
                 float2 weights_dp1 = float2(0,0);
                 weights_dp1[0] = 1.0f / getDistance(dp1, float2(1.0f, 0.0f));
                 weights_dp1[1] = 1.0f / getDistance(dp1, float2(1.0f, 1.0f));
             
                 weights_dp1 /= (weights_dp1[0] + weights_dp1[1]);
 
                 float2 shift_dp1 = float2(0,0);
                 shift_dp1[0] =  _RightShift[2] * weights_dp1[0] + _RightShift[0] * weights_dp1[1];
                 shift_dp1[1] =  _RightShift[1] * weights_dp1[0] + _RightShift[3] * weights_dp1[1];
 
 
                 if(shift_dp1[0] < 2)
                     biggerFlag = 1;
                 else
                     biggerFlag = 0;
 
                 //dp2
 
                 float2 weights_dp2 = float2(0,0);
                 weights_dp2[0] = 1.0f / getDistance(dp2, float2(1.0f, 1.0f));
                 weights_dp2[1] = 1.0f / getDistance(dp2, float2(_MiddlePos, 1.0f));
                 weights_dp2 /= (weights_dp2[0] + weights_dp2[1]);
 
                 float2 shift_dp2 = float2(0,0);
                 shift_dp2[0] = _RightShift[0] * weights_dp2[0] + _MiddleShift[2] * weights_dp2[1];
                 shift_dp2[1] = _RightShift[3] * weights_dp2[0] + _MiddleShift[3] * weights_dp2[1];
 
                 //dp3
 
                 float2 weights_dp3 = float2(0,0);
                 weights_dp3[0] = 1.0f / getDistance(dp3, float2(_MiddlePos, 1.0f));
                 weights_dp3[1] = 1.0f / getDistance(dp3, float2(_MiddlePos, 0.0f));
                 weights_dp3 /= (weights_dp3[0] + weights_dp3[1]);
 
                 float2 shift_dp3 = float2(0,0);
                 shift_dp3[0] = _MiddleShift[0] * weights_dp3[0]  + _MiddleShift[2] * weights_dp3[1];
                 shift_dp3[1] = _MiddleShift[1] * weights_dp3[0]  + _MiddleShift[3] * weights_dp3[1];
 
                 //return shift_dp3;
 
                 float weight_dp0 = pixelPos[1];
                 float weight_dp1 =pixelPos[0] -_MiddlePos;
                 float weight_dp2 = 1 -  pixelPos[1];
                 float weight_dp3 = 1 -  pixelPos[0];
 
                 //return float2(weight_dp1, weight_dp3);
 
                 float2 shift = float2(0,0);
                 shift[0] = shift_dp1[0] * weight_dp1 + shift_dp3[0] * weight_dp3;
                 shift[1] = shift_dp0[1] * weight_dp0 + shift_dp2[1] * weight_dp2;
             
                 float2 sign2 = float2( shift[0] / abs(shift[0]),  shift[1] / abs(shift[1]));
 
                 float2 shift_save = shift;
 
                 float test_value = (1.0f * _Swing_Right);
                 float shifted_functon_value = -test_value + test_value * test_value / 2;
                 float additional_function_mul_y = 0.5f / shifted_functon_value;
 
                 float my_k_x= 1.0f- 2 / (shift_dp1[0] - shift_dp3[0] );
                 //my_k_x = 1;
                 shift[0] = ((-shift[0] * _Swing_Right + shift[0] * shift[0] * _Swing_Right * _Swing_Right / 2) * additional_function_mul_y ) * my_k_x;
 
                 //if(shift_save[0]  > 1.0f )
                 //    shift[0]  = 1.01f;
 
                 return shift;
             }
 
 
             return float2(0,0);
 
             }
 
             fixed4 frag (v2f i) : SV_Target
             {
                 fixed4 col;
                 float2 new_uv ;
 
                 if(i.uv[0] <= _MiddlePos)
                 {
                 float2 shift = gePixelShiftLeft(i.uv);
                 float2 shift_to_test = gePixelShiftLeft(i.uv +float2(0.01f,0.0f));
 
                 new_uv = i.uv + shift;
                 col = tex2D(_MainTex, new_uv);
 
                 if(shift_to_test[0] < shift[0] - 0.0035f )
                 if(biggerFlag ==0)
                     {
                      col = fixed4(0,0,0,1);
                     }    
 
                     // col = fixed4(shift[0] +2,0,0,1);
                     //if(biggerFlag ==1)
                     // col = fixed4(0,1,0,1);
                 //    else
                 //     col = fixed4(0,0,1,1);
                             
                 }
                 else
                 {
                 float2 shift = gePixelShiftRight(i.uv);
                     float2 shift_to_test = gePixelShiftRight(i.uv +float2(0.001f,0.0f));
                 new_uv = i.uv + shift;
                 col = tex2D(_MainTex, new_uv);
 
                 if(shift_to_test[0] < shift[0] - 0.001f )
                     if(biggerFlag ==0)
                     {
                      col = fixed4(0,0,0,1);
                     }    
                 }
 
 
                 if(new_uv[0] > 1.0f || new_uv[1] > 1.0f || new_uv[0] < 0.0f || new_uv[1] < 0.0f )
                     col = fixed4(0,0,0,0);
 
 
                 return col;
             }
 
             
             ENDCG
         }
     }
 }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

69 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Avoiding Bloom Pop 1 Answer

Enabling disabling objects via raycast 0 Answers

How to create an Animated 2D Line to help the user aim and shoot? 0 Answers

Compiler failed to execute. 1 Answer

How to make a script slow down to a stop 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges