Tag Info

New answers tagged

0

Simply calculate UVs (0,0 point is left bottom, 1,1 point is right top) assuming you v got sprite texture dimensions sp in pixels just divide it by texture size: SpriteDimensions sp; //that you must know Vector2f[] UVList = new Vector2f[4]; UVList[0] = new Vector2f(sp.x / tex_width, sp.y / tex_height); // 0,0 UVList[1] = new Vector2f(sp.x / tex_width, ...


1

Well, i'd probably start by taking a look at the blender unwrapping code, since blender is some open souce flavor; it appears to start here: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/uvedit/uvedit_unwrap_ops.c I know the have a "pack lightmaps" command in their uv unwrap menu, but I wasn't able to locate it in unknown ...


1

How do I know how to map lets say (3,4) to (u,v)? First of all, your assumption is wrong. You don't transform position coordinates to uv coordinates, your vertice already has a uv coordinate. Like the following: Where (100,125) is the position of the first vertex (in pixels) and (0,0) is the UV coordinate. Mapping that point to the texture is a ...


0

Each of the vertexes of the triangle will have a u,v coordinate assigned. When the triangle is projected onto the screen each point that is displayed on screen will have a set of barycentric coordinates. Then to get the texture coordinate you just take the average of the texture coordinates weighted by the barycentric coordinates. In openGL this is done ...



Top 50 recent answers are included