I'm doing something in Unity where I need to specify the position and orientation of vertices with two Vector4
s, and they're not just position and normal vectors. I've already written my custom shader and now I need to make mesh objects that can be fed into it.
So how do I make my custom mesh? Should I inherit from the mesh class? Will I still be able to use the normal mesh filter and mesh renderer components or should I replace those too? I am comfortable coding the data structure for my new mesh, the question is interfacing with the Unity rendering pipeline and sending the data to my shader in the right way.
Mesh
, though. Just create a class that builds your mesh programmtically. TheMesh
class can already accept any data - that data is usually just provided in a model. I've been using my class to build procedural meshes that can unfold themselves and then be folded (like origami) back into their shape. Unity's existingMesh
,MeshFilter
, andMeshRenderer
are more than sufficient - you just need to feed them appropriate vertices and normals (and UVs, should you choose to). \$\endgroup\$