• 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 Nestle23 · Oct 17, 2017 at 08:21 PM · shader

New to shaders, undeclared identifier error.

I'm using free lights 2D from asset store, and while it works fine during play mode, it gets me two errors when I try to make a build.

Shader error in 'Light2D/Light Auto Points': undeclared identifier 'PATH_TRACKING_SAMPLES' at Assets/Light2D/Resources/Shaders/LightBase.cginc(93) (on d3d9)

Shader error in 'Light2D/Light Auto Points': undeclared identifier 'PATH_TRACKING_SAMPLES' at Assets/Light2D/Resources/Shaders/LightBase.cginc(93) (on d3d11)

usually, google solves all my problems but not this one :( Can any of you even point me into a direction that I should take to understand any of it with no shaders knowledge?

here is the script

 #ifndef LIGHT_BASE_INCLUDED
 #define LIGHT_BASE_INCLUDED
 
 #pragma glsl_no_auto_normalization
 
 struct light2d_fixed_data_t {
     float4 vertex : POSITION;
     float2 texcoord : TEXCOORD0;
     float4 color : COLOR0;
     float2 texcoord1 : TEXCOORD1;
 };
 
 struct light2d_fixed_v2f {
     float4 vertex : SV_POSITION;
     half2 texcoord : TEXCOORD0;
     half4 color : COLOR0;
     #ifdef PERSPECTIVE_CAMERA
     half2 texcoord1 : TEXCOORD1;
     float4 projVertex : COLOR1;
     float zDistance : TEXCOORD2;
     #else
     half2 thisPos : TEXCOORD2;
     half2 centerPos : TEXCOORD1;
     #endif
     half2 aspect : TEXCOORD3;
 };
             
 uniform sampler2D _ObstacleTex;
 uniform sampler2D _MainTex;
 uniform half _ObstacleMul;
 uniform half _EmissionColorMul;
 uniform float2 _ExtendedToSmallTextureScale;
 #ifdef UNITY_HALF_TEXEL_OFFSET
 uniform half2 _PosOffset;
 #endif
 
 light2d_fixed_v2f light2d_fixed_vert (light2d_fixed_data_t v)
 {
     light2d_fixed_v2f o;
     o.vertex = UnityObjectToClipPos(v.vertex);
     o.texcoord = v.texcoord;
 
     #ifdef PERSPECTIVE_CAMERA
     o.texcoord1 = v.texcoord1;
     o.projVertex = o.vertex;
     o.zDistance = mul(unity_ObjectToWorld, v.vertex).z;
     #else
     float4 vPos = ComputeScreenPos(o.vertex);
     o.thisPos = (vPos.xy/vPos.w - 0.5)*_ExtendedToSmallTextureScale + 0.5;
     float4 cPos = ComputeScreenPos(mul(UNITY_MATRIX_VP, float4(v.texcoord1, 0, 1)));
     o.centerPos = (cPos.xy/cPos.w - 0.5)*_ExtendedToSmallTextureScale + 0.5;
     #ifdef UNITY_HALF_TEXEL_OFFSET
     o.thisPos += _PosOffset;
     o.centerPos += _PosOffset;
     #endif
     #endif
 
     o.color = v.color;
     o.aspect = half2(_ScreenParams.x/_ScreenParams.y, 1);
 
     return o;
 }
 
 half4 light2_fixed_frag (light2d_fixed_v2f i) : COLOR
 {
     half4 tex = tex2D(_MainTex, i.texcoord);
 
     #ifdef PERSPECTIVE_CAMERA
     half4 vPos = ComputeScreenPos(i.projVertex);
     half2 thisPos = (vPos.xy/vPos.w - 0.5)*_ExtendedToSmallTextureScale + 0.5;
     half4 cPos = ComputeScreenPos(mul(UNITY_MATRIX_VP, float4(i.texcoord1, i.zDistance, 1)));
     half2 centerPos = (cPos.xy/cPos.w - 0.5)*_ExtendedToSmallTextureScale + 0.5;
     #ifdef UNITY_HALF_TEXEL_OFFSET
     thisPos += _PosOffset;
     centerPos += _PosOffset;
     #endif
     #else
     half2 thisPos = i.thisPos;
     half2 centerPos = i.centerPos;
     #endif
 
     half sub = 1.0/PATH_TRACKING_SAMPLES;
     half len = length((thisPos - centerPos)*i.aspect);
     half m = _ObstacleMul*sub*len;
             
     half4 col = i.color*tex*tex.a*i.color.a;
 
     half pos = 0;
     
     for(int i = 0; i < PATH_TRACKING_SAMPLES; i++)
     {
         pos += sub; 
         half4 obstacle = tex2D(_ObstacleTex, lerp(centerPos, thisPos, pos));
         col *= saturate(1 - (1 - obstacle)*obstacle.a*m);
     }
 
     col.rgb *= _EmissionColorMul;
 
     return col;//half4(half3((thisPos - centerPos).x*20), 1);//tex2D(_ObstacleTex, thisPos);
 }
 
 #endif





Comment
Add comment · Show 3
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
avatar image antiNT · Oct 26, 2017 at 02:05 PM 0
Share

I have the exact same error, can somebody help ??

avatar image Hellium · Oct 26, 2017 at 02:08 PM 0
Share

Try to add this at the top of your file:

 #define PATH_TRAC$$anonymous$$ING_SA$$anonymous$$PLES 1

And replace 1 by a value of your choice (except 0)

avatar image antiNT Hellium · Oct 26, 2017 at 08:50 PM 0
Share

It didn't work...

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

115 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 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

How to force the compilation of a shader in Unity? 5 Answers

Dissolve object on Gameobject Destory 1 Answer

Creating a fogless version of a built-in shader 1 Answer

Grab Pass in Shader Graph 1 Answer

Shader with reflection does not work on android 1 Answer


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