0
Fixed
Andrei Nadin 4 years ago • updated by Thibaud Troalen 2 months ago 11
I am trying to use View Direction but no matter what I do , I get this error

Shader error in 'Custom/ViewDirProblem': Program 'vert', undefined variable "viewDirection" at line 190

It seems to be broken along with reflected 

Answer

Answer
Fixed
This has been fixed in Beta 0.34
ah, now that you ask, it seems it might be user stupidity, :(

I am trying to do a shader where I increase the Y of a vert based in the grazing angle. So was looking to use View Direction to work out when the angle was low, perp the Vertex Offset between 0 and 0.5. If I plug View Direction into emission no errors but if I try and feed it into a series of nodes that ends up in Vertex Offset I get this problem.
Unless there is another way to solve this, I tried using the distance between view position and the world position but I need it very fine grained, it is for line markings on a sports field, The line is quite thin and I am trying to make it kind of 'curl' up in the distance to give me more pixels visible.
Yeah, vert offsetting is a bit messy when using some of the built-in vector. I will have to fix that down the line!
Answer
Fixed
This has been fixed in Beta 0.34

Sorry to resurrect the topic but the issue came back in 1.37. Example here :


/*SF_DATA;ver:1.37;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,cgin:,lico:0,lgpr:1,limd:1,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:True,enco:False,rmgx:True,imps:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,atcv:False,rfrpo:False,rfrpn:Refraction,coma:15,ufog:False,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:1,fgcg:0.6947262,fgcb:0.3676471,fgca:1,fgde:0.00013,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False,fsmp:False;n:type:ShaderForge.SFN_Final,id:4013,x:33691,y:32714,varname:node_4013,prsc:2|diff-5312-OUT,emission-9222-OUT;n:type:ShaderForge.SFN_Tex2d,id:4617,x:32736,y:32592,ptovrint:True,ptlb:Base Color,ptin:_MainTex,varname:_MainTex,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2d,id:158,x:32388,y:33271,ptovrint:False,ptlb:EmissionMap,ptin:_EmissionMap,varname:_EmissionMap,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Color,id:1318,x:32824,y:33491,ptovrint:False,ptlb:EmissionColor,ptin:_EmissionColor,varname:_EmissionColor,prsc:2,glob:False,taghide:False,taghdr:True,tagprd:False,tagnsco:False,tagnrm:False,c1:1,c2:1,c3:1,c4:1;n:type:ShaderForge.SFN_Multiply,id:9222,x:33226,y:33399,varname:node_9222,prsc:2|A-8801-OUT,B-1318-RGB;n:type:ShaderForge.SFN_Add,id:8801,x:32854,y:33197,varname:node_8801,prsc:2|A-158-RGB,B-6081-OUT;n:type:ShaderForge.SFN_ValueProperty,id:6081,x:32502,y:33568,ptovrint:False,ptlb:EmissionAdd,ptin:_EmissionAdd,varname:_EmissionAdd,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.02;n:type:ShaderForge.SFN_Desaturate,id:5312,x:33179,y:32740,varname:node_5312,prsc:2|COL-4617-RGB,DES-9009-OUT;n:type:ShaderForge.SFN_Slider,id:9009,x:32684,y:32850,ptovrint:False,ptlb:Albedo Desat,ptin:_AlbedoDesat,varname:_AlbedoDesat,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:-1,max:1;proporder:4617-9009-158-1318-6081;pass:END;sub:END;*/


Plus I still get mul(UNITY_MATRIX_VP,..) instead of UnityObjectToClipPos(...).

Can you make a new thread with a clean repro case?