Writing plugins for Blender

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Brandano
Posts: 0
Joined: Mon Apr 19, 2004 6:03 pm

Post by Brandano »

Oh, i had my run-in with sticky coordinates when writing an importer. With sticky coordinates for one vertex in the mesh you have one correspondent UV coordinate pair. This means that the object can only be 'shrink wrapped' with a texture and yiou can't have UV seams unless you duplicate the vertex, but if you do you must pay attention to keep the same vertex normal on both copies, or the smoothing of the mesh will be messed up. When generating primitives Blender can create a set of sticky coordinates for them, and these aer used for procedural textures. However, Blender doesn't provide tools to edit these (tho I have an idea for a python script to do that). In order to see an image mapped on an object with sticky coordinates you shouldmake sure that the material definition, in the map input tab you have selected stick.
The other set of UV coordinates that Blender uses is instead defined 'per face', where you have a set of UV coordinates for each vertex in a face. This means that the same vertex can have several UV coordinates without the need to duplicate it, and makes setting up edge seams much easier. This also is the only UV coordinate mode where you can actually edit the coordinates with Blender tools, and most likely the one you want to work on for an exporter. It should be possible to convert an object that has been UV mapped like this to an equivalent 'sticky' mapped version (the other way round is trivial) by cycling the vertices, and for each vertex check each of the faces it's connected to for distinct UV coordinates, duplicating the vertex as needed and amending the face in case the vertex is on an UV seam. Naturally it's better to snap the UV values to pixels to avoid seams where the UV values differ only by a very small amount. This is probably what I will have to do on my NIF exporter if I can get round to coding on it again.

Post Reply