Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

vert function return value missing semantics

Discussion in 'Shaders' started by Gigiga, Feb 25, 2015.

  1. Gigiga

    Gigiga

    Joined:
    Jan 21, 2014
    Posts:
    4
    Hey Guys,
    I'm new to Unity and no Scripting pro. I've bought the SuperSunPack in the Asset Store, but when i'm importing one of the prefabs it has no textures. The shader shows an error message called: 'vert': function return value missing semantics. I'm unable to solve that problem on my own and the support hasn't answered for days now. I would really appreciate help.

    I'm not sure if i'm allowed to post the shader code here since it's a bougth pack. But i'll upload the two code segments that are thought to be false. If it's not okay to upload them, please tell me and i will remove them asap.

    Code (CSharp):
    1. v2f vert (appdata_full v)
    2. {
    3. v2f o;
    4. o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    5. o.uv.xy = TRANSFORM_TEX(v.texcoord.xy,_MainTex);
    6. float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
    7. float dotProduct = 1 - saturate ( dot(v.normal, viewDir) );
    8. o.color = (1-smoothstep(1 - _rimWidth, 1.0, dotProduct) * _rimSize);
    9. o.color -= smoothstep(1 - _rimWidth, 0.03, dotProduct) * _rimSize;
    10. o.color = o.color;
    11. o.color *= _RimColor;
    12. return o;
    13. }
    Code (CSharp):
    1. v2f vert (appdata_full v)
    2. {
    3. v2f o;
    4. o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    5. o.uv.xy = TRANSFORM_TEX(v.texcoord.xy,_MainTex);
    6. float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
    7. float dotProduct = 1 - saturate ( dot(v.normal, viewDir) );
    8. o.color = smoothstep(1 - _rimWidth, 1.0, dotProduct) * _rimSize;
    9. o.color *= _RimColor;
    10. return o;
    11. }
    Here are some Screenshots:
    SuperSun2.png SuperSun3.png SuperSun1.png
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,588
    My best guess is that a semantic is missing in the v2f definition. A semantic is a string attached to a shader input or output that conveys information about the intended use of a parameter. More details...

    The v2f definition is probably somewhere around the vert function, look for something like this:
    Code (csharp):
    1. struct v2f
    2. {
    3.     float4 vertex : POSITION;
    4.     ...
    5. }
    6.  
    The word after that colon, in this case POSITION, is referred to as semantic. Check if there is any parameter without such semantic and try to add one that makes sense.