Can't get my scripted mesh working right.

So, I was looking for a way to get a curve as customizable as possible, although the mesh looks good, its material seem to be bugged and the lights don’t look well either.


The light reflecting on it looks pretty weird shaped, and there’s also this pink mesh that stays at (0, 0, 0) position even if I move the object.
zigzagrealisticasianporcupine

The way i’m making this mesh is by changing its MeshFilter.mesh (or sharedMesh when its running in EditMode) i get the MeshFilter’s mesh and define it’s values.

I already tried changing the ui values, but it doesn’t help. I can’t find a solution for this anywhere, i’m really frying my brain at this point. If anyone could help me with it, i’d be really thankful!



By sharing vertices at a corner the lighting will never be correct at that corner. UV and lighting (normals) are shared on a per vertex basis, so at a 90-degree bend you need to add the vertex twice: once for the horizontal part, once for the vertical part. This applies everywhere except in between coplanar faces if you want the lighting to look right.

You’re welcome to look at some examples in my makegeo package.

MakeGeo is presently hosted at these locations:

https://bitbucket.org/kurtdekker/makegeo

2 Likes

Thank you very much! Didn’t got time to test it out, but I certainly will, once again, thank you for your help, it really means a lot!

1 Like