31

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 that ...


13

Assuming atan2 returns an angle in radian between -pi and pi (π) you do something like: n = Normalize(sphere_surface_point - sphere_center); u = atan2(n.x, n.z) / (2*pi) + 0.5; v = n.y * 0.5 + 0.5; Where sphere_surface_point is the point on the sphere surface. / (2*pi) is there to convert the returned angle to a value between -0.5 and 0.5 Add 0.5 to ...


13

Typical UV mapping is what's called an affine transformation. That means the mapping of each triangle between 3D space and texture space can include rotation, translation, scaling/squash, and skew (ie. anything we can do with a homogeneous matrix multiplication) The thing about affine transformations is that they're uniform across their whole domain - the ...


9

Think origami. A UV map is like a flattened (unwrapped) 2D skin of your 3D mesh (shell). 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 of ...


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 caused ...


7

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 ...


7

I am one of the developers of the itSeez3D application you linked in your post. Accidentally stumbled upon your question. @Kevin van der Velden provided an entirely relevant reference here, I would not say it took us five years, but definitely not less than a year :) There are several problems with the simplistic approach you're describing. First of all, ...


5

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 ...


5

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


5

Going by WebGL Caps it looks like 4k textures are a very safe bet (which is why everyone is using them) but 8k textures still have a ways to go. Ideally you'll want to have a 4k fallback option if your users don't support 8k textures. That being said, your car shouldn't need an 8k texture, it's likely that your UV mapping could use some optimization. Make ...


5

It looks like you're trying to use (rotated) vertex positions as UV coordinates. When you're using this to look up into a 2D texture, only the x & y values are used and the z is ignored, giving you a planar projection: The effect is like shining your texture onto the object using an orthographic projector, along one directional axis. Portions of your ...


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

Yes, it can. But certain devices will suffer. For example, iOS PVRTC texture compression doesn't work without square textures. I think Unity makes them square, so you end up with your textures taking up a bunch more RAM to accommodate PVRTC. See Unity Documentation: 2D Textures for more details.


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 ( ...


4

Inside the GPU pipeline, each vertex represents a unique combination of: a position (so we know where to draw this corner of the adjacent polygon(s) on the screen) a normal vector (which way the surface is facing at this point, so we can light & shade the attached polygons accordingly) texture coordinates (so we know which part of the texture to sample ...


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

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

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

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

You could define a set of textures (grass, dirt, rock) and use those. Let's say using these three layers (rock at the bottom, dirt on top and grass topmost), you can define three alpha channels to define how much of each texture is visible. Start with a simple noise map for your alpha channels and maybe take the slope of terrain into account. The more slope, ...


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

An .obj model file may come with a companion file with the extension .mtl. Such a file is a material library that contains entries mapping from a material name to properties, including texture filenames to use for things like diffuse and specular. In your obj-file, there are mtllib a.mtl directives to indicate the material library to use, and usemtl aaaa ...


3

So you're not using a modelling program- thus you'll have to provide the cube/texture information yourself from code. Let's start out simple with one textured triangle. VertexPositionTextures contains Vertex (location of points in space) and texture (where does that point match to a point on an image). Keep in mind that the location for the texture is on a ...


3

Basically, there is Vertex data, which is stored in one or more VBOs. Typical (3D) vertex has like: vec3 pos, vec2 uv, mat3 tbn (or vec3 normal) - maybe some other modifiers, possibly several different uv coords or something like that. Anyways, no matter if you store those to 1 or multiple VBOs, IBO will index all the buffers with same index. So, each pos/...


3

The only possibilty you have is to add the vertex twice, if no collision is generated, this will have almost no performance impact, if you do want collision, subclass the UProceduralmeshComponent yourself and override GetPhysicsTriMeshData to fill the collision array with non-duplicated vertices


3

If we take as the requirements: no distortion no constraints on seam placement OK to overlap faces then we can use a pretty simplistic approach, independently rotating each face into a 2D plane and more or less leaving it wherever it ends up. // Iterate over each face (here assuming triangles) for(int index = 0; index < triangles.length; index += 3) { ...


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