Questions tagged [texture-mapping]

Texture mapping is a method for adding detail, surface texture (a bitmap or raster image), or color to a computer-generated graphic or 3D model.

971 questions
3
votes
1 answer

In Metal what are the correct blendFactors for classic Porter-Duff "over" compositing?

In a Metal app for iOS I need to render a translucent texture attached to a simple quad. I cannot figure out the correct colorAttachment rgb and alpha blend factors. My set up: 1) Red image created in Photoshop with 50% opacity. Saved as PNG with…
dugla
  • 12,774
  • 26
  • 88
  • 136
3
votes
0 answers

OpenGL textures: incorrect mapping onto 2D polygon

Have noticed an unexpected behavior of OpenGL (nVidia's card), when I try to map a texture on a 2D polygon. The image seems to be "broken" into 2 pieces: . Here's the source texture: The simplified code snippet: GLuint textId; glGenTextures( 1,…
3
votes
1 answer

How to copy CUDA generated PBO to Texture with Mipmapping

I'm trying to copy a PBO into a Texture with automipmapping enabled, but it seems only the top level texture is generated (in other words, no mipmapping is occuring). I'm building a PBO using //Generate a buffer ID called a PBO (Pixel Buffer…
John
  • 2,012
  • 2
  • 21
  • 33
3
votes
1 answer

Why are these UV mapping coordinates represented in 0-1 and pixels? Shouldn't they use only the 0-1 system?

Well, I've got many UV coordinates of a 3D model clearly in the range 0-1 and many coords in seemingly pixel values in the range 100-300. How do I know which one to interpret the coordinates as? Is there a standard or system for this? I notice that…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
3
votes
1 answer

Why do I have to calculate the transpose of the inverse of the model matrix in order to calculate the normal for the reflection texture?

I am following this tutorial to create a skybox/cubemap with environmental mapping. I am having some trouble understanding a calculation in the vertex shader: #version 330 core layout (location = 0) in vec3 position; layout (location = 1) in vec3…
Chin
  • 19,717
  • 37
  • 107
  • 164
3
votes
1 answer

How to eliminate distortion when rotating a texture

the background of my question is the following: I draw a simple texture mapped rectangle. The rectangle has always the same aspect as the texture. Becuase of that i simply use texture coordines (0,0), (0,1), (1,0), (1,1) at the corners to get the…
TosKen
  • 481
  • 5
  • 20
3
votes
2 answers

Texturing a model

I have coded a 3d-terrain engine with simplistic model engine on top of it. I use a rectangular heightmap for my terrain, so texturing those triangles is pretty straightforward. However, on texturing my model i am a bit stuck. I use a custom model…
sum1stolemyname
  • 4,506
  • 3
  • 26
  • 44
3
votes
1 answer

Perspective correct texture mapping in iOS Metal

I tried various ways of getting the interpolation work and generate a perspective correct image, but none of the suggested ways works. My current code is: struct VertexStruct { float4 normalizedPosition [[ position ]]; float4 texCoord; } vertex…
aledalgrande
  • 5,167
  • 3
  • 37
  • 65
3
votes
1 answer

Wrapping images around sphere

I've read many blogs/questions about this and didn't find the right answer. I'm creating an earth in three.js. But every time I'm mapping my texture and bump map it doesn't show. Also there aren't any console errors. It still shows my light on the…
Mariette Edel
  • 77
  • 1
  • 9
3
votes
1 answer

What does setting the GL color before doing a texture mapping operation do?

I am looking at some sample code in a book that creates a jittered antialiasing effect by repeatedly rendering a scene (at different offsets) onto a offscreen texture, then using that texture to repeatedly draw a quad in the main view with some…
Ben Zotto
  • 70,108
  • 23
  • 141
  • 204
3
votes
1 answer

Loading a texture by passing RGB floating point pixel data to glTexImage2D

I have a 2D floating point array with values mapped within the range 0.0f to 1.0f. I load it into OpenGL using a single channel i.e glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, width, height, 0, GL_RED, GL_FLOAT, data); which works fine. However, I'm…
ccoder83
  • 504
  • 6
  • 15
3
votes
1 answer

Looping a texture on a surface

I want to know how to loop a texture on the surface of an object. For a practical example, I'm trying to handle rendering world geometry, so that when I resize a world object twice the size of its texture, the texture will then appear twice - not…
Yattabyte
  • 1,280
  • 14
  • 28
3
votes
0 answers

WebGL texture coordinates for cylinders

I have a problem with computing texture-space coordinates for a cylinder in raw webgl (no frameworks used). I was able to create the cylinder's polygon list and normal vectors, but somehow I'm struggling with the u,v textures. What I intended to do…
WhiteBr0wnie_24
  • 149
  • 1
  • 1
  • 12
3
votes
1 answer

OpenGL Texture Mapping by Pixel Region

Suppose you have a simple Tileset for a game, like this: Now, when dealing with a simple GUI framework such as .NET, it would be rather easy to load that image, select portions of it, and then draw it tile-by-tile. However, when using OpenGL, this…
Krythic
  • 4,184
  • 5
  • 26
  • 67
3
votes
0 answers

Three.js: how to properly apply texture on TorusGeometry

I'm trying to create a three-dimensional compass, that also displays roll and pitch. In order to show the roll (in degrees), I need to apply a texture with numbers to a TorusMaterial. How can I get it on in such a way that the scale is (somewhat)…
Fabdrol
  • 728
  • 1
  • 7
  • 20