Hi all,
I’m using some mesh parameters to forward some values to a CG shader. I need to use as much parameters as possible since this way I can avoid the use of an indirection texture.
Now, I’m looking at appdata_full definition in the file: UnityCG.cginc:
Because the struct appdata_full has more to do with the graphics libraries that are being used than with Unity itself. It is mainly used to guide data between the various shader stages (for example: between vertex and fragment shader).
(I think it’s a float4 in appdata_full because that maps directly to the semantics defined by DirectX, and I’m guessing it has to do with what the rasterization hardware supports.)
Unity probably only lets you set Vector2 texture coordinates, because you don’t need to set more, to be able to use 2D Textures.
Unfortunately I’m using static batching over my meshes. All of them needs to share a unique material. If I use setVector I’ll force Unity to instantiate a new material. I need to encode the parameters as vertices’s parameters in order to use static batching and support different parameters values for each GameObject.
@Heisenbug I would love to know if the OP eventually found out a way of passing the 4 floats to a float4 texture, or if someone else has any ideas - so I avoid asking a duplicate of the exact same question.