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 /
  • Help Room /
avatar image
0
Question by fireArchMage23 · Nov 24, 2015 at 03:45 PM · shaderinputerror message

What does this error mean?

I am working on a Unity shader and I got this error:

Vertex program 'vertex_main': unknown input semantics BINORMAL/0

What does it mean and how do I fix it?

Comment
Add comment · Show 4
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 Jessespike · Nov 24, 2015 at 05:39 PM 0
Share

I'd look at the structs. Specifically the binormal, what does it look like? Hard to tell without seeing the code. but my guess is there's a typo in the Input struct.

avatar image fireArchMage23 Jessespike · Nov 24, 2015 at 06:31 PM 0
Share

this is the struct that BINOR$$anonymous$$AL is located in:

struct Application2Vertex {

 float3 Position : POSITION; // vertex position in model/local coordinates
 float4 UV : TEXCOORD0; // texture coordinates
 float3 N : NOR$$anonymous$$AL; // vertex normal in model/local coordinates
 float3 T : TANGENT0;
 float3 B : BINOR$$anonymous$$AL0;

};

avatar image Jessespike fireArchMage23 · Nov 24, 2015 at 06:44 PM 0
Share

Try: TEXCOORD1 or TEXCOORD2 or something ins$$anonymous$$d.

 float3 B : TEXCOORD2;

I don't really know why you get this error, I think BINOR$$anonymous$$AL0 is an invalid semantic to use. I would assume TANGENT0 would cause an error too. $$anonymous$$aybe it depends on whether it's a surface shader or CG. Either way, TEXCOORDs should work, TEXCOORDS don't have to be texture coordinates, you can use them for anything.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by tanoshimi · Nov 24, 2015 at 07:24 PM

As the error states, Unity doesn't recognise the BINORMAL semantic you're using for the "B" member of the input to the vertex shader. As described here, vertex data must be described by one of the following semantics:

  • POSITION is the vertex position, typically a float4.

  • NORMAL is the vertex normal, typically a float3.

  • TEXCOORD0 is the first UV coordinate, typically a float2..float4.

  • TEXCOORD1 .. TEXCOORD3 are the 2nd..4th UV coordinates.

  • TANGENT is the tangent vector (used for normal mapping), typically a float4.

  • COLOR is the per-vertex color, typically a float4.

If you want the binormal, you can calculate that in the vertex shader from the NORMAL and TANGENT as:

 v2f vert (appdata v) {
     ...
     float3 binormal = cross( v.normal, v.tangent.xyz ) * v.tangent.w;
     ...
 }
Comment
Add comment · Show 5 · Share
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 fireArchMage23 · Nov 24, 2015 at 07:26 PM 0
Share

Will float3 B : TEXCOORD1; work just as well?

avatar image tanoshimi · Nov 24, 2015 at 07:49 PM 0
Share

The Application2Vertex structure that you're defining specifies what data Unity supplies to the shader pipeline in order to render objects on the screen. At the bare $$anonymous$$imum, it must contain an element with the POSITION semantic, because that's what defines where the vertex is in 3d space. The other semantics specify optional additional information.

If you write float3 B : TEXCOORD1; in your Application2Vertex structure, it'll work, but what that field will be populated with is the second set of UV coordinates assigned to each vertex (the first set uses TEXCOORD0) - is that really what you want?

avatar image fireArchMage23 tanoshimi · Nov 25, 2015 at 04:05 AM 0
Share

Not if it doesn't give me as good of a shader. So you would recommend adding the cross product you mentioned earlier within the vert2frag function?

avatar image tanoshimi fireArchMage23 · Nov 25, 2015 at 07:03 AM 0
Share

You haven't told us anything about what your shader is meant to do, and assessing how "good" it is is somewhat subjective anyway.... But if you want the binormal, that's how you calculate it.

Show more comments

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

40 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

Related Questions

I don't understand this build error 0 Answers

How to fix (NullReferenceException: Object reference not set to an instance of an object) in my case 0 Answers

Shader error upon build to Oculus Quest 2 1 Answer

how to remove unity system package from player setting 1 Answer

Error: 'failed to open source file: 'CoreRP/ShaderLibrary/Common.hlsl' what to do? 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