Tag Info

19

Your understanding is close. Each 3D model is made out of vertexes. Each vertex usually defines the location of a point in space, a normal (used in lighting calculations) and 1 or more texture coordinates. These are generally designated as u for the horizontal part of the texture and v for the vertical. When an object is textured, these coordinates are used ...

13

This is the way I understand it. Could be totally wrong, but I'm sure someone will flame correct me if I'm wrong. The mathematical theory behind UVW texture mapping is similar to the theory behind UV texture mapping. See Bummzack's link here: What exactly is UV and UVW Mapping? to get a better explanation of what UV mapping is. Basically, you're mapping ...

13

You can't. All right, that was a bit harsh. Let me illustrate this with two examples. Let's get outside of the computer graphics world. Suppose you are given a piece of paper with the texture you gave us printed on it. There's a faintly printed millimeter grid in the paper as well. Now you get some scissors and some paste, and your task is to make a ...

11

First of all, for every 3D vertex there is infinite tangent and bi-tangent vectors. The below image explains why there is an infinite number of tangent spaces for each vertex, the tangent and bitangent can have any direction in the shown plane. So inorder to properly calculate the most useful1 tangent space, we want our tangent space to be aligned such ...

10

This is where I will use a 3D painting program. I primarily use Blender for my modeling, and it has a 3D painter built in. Being able to paint directly on the model in a 3D environment, makes the strokes continue across seams. I don't find the paint tools in Blender to be great, so I'll usually switch to something like GIMP once I've got a rough idea. Then ...

8

Texture mapping is a hard problem. For some primitives there is a mathematically sound way of finding the UV coordinates. This is only possible if we can think of a function F(u,v)->(x,y,z). An example of a figure where this is possible is the a cube. Here we can easily cut out a square for each of the surfaces. For a sphere this is also possible, here ...

8

I think you are right. You would really like to tile your bricks, because it saves a lot of memory space and is also quick in your GPU. Baking the lighting does need a unique texturing, because no place is the same. You could tile some parts of your texture, for example, on really straight long places. (I'm no UV wrapper, but I do think that is possible to ...

8

With full source (or even just a thorough explanation) of a perspective correct textured triangle rasterizer being too long for an answer, I'll gladly refer you to Chris Hecker's classic series of articles on the topic, including source: http://chrishecker.com/Miscellaneous_Technical_Articles From your link I assume you are using Flash as a platform, so I ...

7

You are correct UV's typically go from 0-1 though as David X mentioned this isn't a requirement. In your case the issue is the frequency of the SketchUp generated UV coordinates. For example if your Y axis (V coordinate) goes from 0 to 46 then that texture, if wrapping is enabled, will repeat 46 times in the V direction. Wrapping also makes it look smaller ...

7

UV interpolation needs to take into account the depth of the vertices. You need to perform perspective-correct interpolation, which involves dividing by the w coordinate of the interpolated homogeneous vector. The "folded plane" effect of affine interpolation becomes more pronounced at wide FOV or when the camera is close to an object, but it's not ...

6

This may be a winding issue. Are you sure that the texture coordinates are parsed in the right sense of rotation? However, this how you should debug you program. Draw in wire frame mode to find out how the rectangle is composed out of two triangles. The OpenGL command for this is glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);. Use a texture with a gradient ...

5

Consider a triangle. Each corner has a UV coordinate. You interpolate between these to get a set of UV coordinates for each pixel. (There's also perspective in play here but let's ignore that for the moment). Then, you fetch a texel from the texture from the coordinates U and V. Which is to say, a pixel from the texture coordinate x,y - same thing, ...

5

One example is for light maps. Usually texture space is maximized by overlapping faces which have the same diffuse texture, like the six sides of a crate. With light mapping this would mean that all six sides get the same light and shadow, not to mention it would almost assuredly confuse the light mapper because it can't tell which point in space it should ...

5

Alright, found my issue. Not sure if this applies to OpenGL but for my DirectX application I needed to invert the v coordinate for sampling the texture. u = u v = 1 - v;

4

I took a quick look at your example and your code. You're extremely close to solving this, so I don't mind helping with a question that looks suspiciously like homework ;). In data.js, you are assigning the same UV coordinates to the front and rear faces of the cube. The coordinates seem to be ([0,0], [0,0.5], [0.5,0.5], [0.5,0]). This means that you can ...

4

A quad with the texture coordinates 0,0 on the one corner and 2,2 on the other corner, means the texture is tiled 4 times, 2 times in each direction. Now if you have the same quad with 4,4 on the other corner instead you have the texture tiled 16 times, 4 times in each direction. If you increase the texture coordinates without increasing the size of the ...

4

Another way would be to procedurally generate your textures. This approach comes with its advantages and disadvantages. Most important tradeoff is that you can't draw your textures in an editor but have to code them using noise functions. The huge gain in your situation is that you can texture your terrain completely orientation independent. This is done by ...

4

A simple method using only Photoshop: Crop the image vertically to remove anything that should be below the horizon (ie. not part of the sky dome) Scale up the height of the image to make it square Filter -> Distort -> Polar Coordinates

4

A line is a list of connected points. For each point you'll need to calculate the X-Texture coordinate of that point, the Y coordinate will always be 0 for the upper point and 1 for the lower point. After you have defined how long one texture segment is you can do so by stepping through all the segments you have generated and noting how much distance you ...

4

Actually every face of your mesh has UV coordinates through which UV mapping works. Let take an example of cube. Cube has 6 faces and every face has 4 coordinates. That means a Cube must have 24 coordinates for UV mapping. Now second part is to map coordinates with texture. Let's take an example of a square texture image having 6 different color boxes ( ...

3

For simple shapes, you can usually find sensible unwrapping approaches by looking to papercraft (those guys are experts at unfolding shapes. Albeit backwards.) For an octohedron, you might consider the model here: http://psmay.com/wp-content/uploads/2012/01/logihedron.pdf This sort of approach doesn't entirely cover your texture the way that your ...

3

Think origami. A UV map is like a flattened (unwrapped) 2D shell (skin) of your 3D mesh. If you were to cut out the map and fold it along the mesh lines, the result would be your 3d model. The U,V floating point values range from (0,0) to (1,1) The upper left corner of the UV map is (0,0) The lower right corner is (1,1) Each vertex in a mesh triangle/...

3

First off, make sure you're adding a material on your mesh, then add the texture, set it as "image or movie", and chose "Coordinates: UV":

3

So this doesn't provide details to every problem you'll encounter with your approach, but, if you want to map each vertex to the closest non-air voxel in order to scrape information from it (such as which texture to sample), here's a proof for the efficient method I came up with: For any given marching cubes vertex, we wish to select a voxel with which ...

3

In the past I've fixed this sort of problem using a dilation filter. Basically, the idea is to go over the lightmap after it's rendered and expand the borders of all the pieces by a few pixels, by copying the values of filled pixels into adjacent empty pixels. This can be done with a pixel shader in a full-screen pass or two over the lightmap.

3

Either use a geometry shader (or possibly some vertex/fragment shader magic) to generate the border from each vertex of the cube, or write a function that generates a new box with a fixed border size. By scaling a box, you scale the whole box. There's no magical way of scaling the border separately. And it's a box, which should be simple enough to generate. ...

3

It sounds like you just need plain rectangular UV coordinates. The inner radius is V = 1, and the outer radius is V = 0. That angular procession from the bottom up is from U = 1 to U = 0 (or the opposite depending on tech). The vertex locations can be arranged in a curve, but the texture coordinates don't have to be.

3

First of all, the process of finding the pixels that fall in a triangle is called rasterization. You might want to look up some articles on fast software rasterization, or better yet move the lightmap build process (or at least the rasterization part of it) to the GPU, as it'll be much, much faster. There are two possible solutions to the problem of cracks ...

3

An UV map is usually literally 2 extra floats per vertex, one for the U, and one for the V, how they are stored is dependent on the model format used and not really relevant to how you use them. How they are used in modern applications is typically completely defined in the fragment shader, a common use is to take the UV values and use them as the ...

3

If the only difference between the quads is their physical size in window coordinates ("one is bigger than the other on-screen"), and all other things (shader, textures, et cetera) are equal, then the only significant difference in the pipeline will be that the rasterizer must fill more fragments for the quad that is larger on-screen. This means that if the ...

Only top voted, non community-wiki answers of a minimum length are eligible