0
Completed

UVs as Vec2/3/4

karl 9 years ago updated by Freya Holmér (Developer) 8 years ago 2

Unity 5.2 (or 5.1, not sure) adds the ability to set and get UVs as Vector2, Vector3, or Vector4 lists. It would be nice if ShaderForge could provide an option to read texcoord attributes as a fixed4 in particular.

Answer

Answer
Completed

This has now been added to 1.34!

In case anyone else absolutely needs vec4 attributes, here's a workaround I came up with. Just create a vec4 property node and name it "TEMP_UV3_CHANNEL", and treat it like a UV3 node. Also make sure to put a UV node in your canvas somewhere set to input 2 (don't connect it to anything).


Then once you've built your shader compile it and select the compiled asset in Unity and run "Tools/ShaderForge/Replace UV3 Channel". This will crap out a new shader next to the original with correct UV3 attributes.


https://gist.github.com/karl-/e13ff3a6e74a3a69ba49

Answer
Completed

This has now been added to 1.34!