Hot answers tagged

79 votes

Sharp Corners with Signed Distance Fields Fonts

EDIT: Please see my other answer with a concrete solution. I have actually solved this exact problem over a year ago for my master's thesis. In the Valve paper, they show that you can AND two ...
Detheroc's user avatar
  • 1,436
50 votes

Sharp Corners with Signed Distance Fields Fonts

Sorry about the long wait, but it has become obvious that although the article I have promised is basically complete, the publishing process will take some time. Therefore, I have instead prepared an ...
Detheroc's user avatar
  • 1,436
32 votes

How does hardware texture compression work?

"How (hardware) texture compression works" is a large topic. Hopefully I can provide some insights without duplicating the content of Nathan's answer. Requirements Texture compression ...
Simon F's user avatar
  • 4,161
30 votes
Accepted

How can virtual texturing actually be efficient?

Overview The main reason for Virtual Texturing (VT), or Sparse Virtual Textures, as it is sometimes called, is as a memory optimization. The gist of the thing is to only move into video memory the ...
glampert's user avatar
  • 1,439
27 votes
Accepted

How does hardware texture compression work?

As Simon's comment alluded to, one major difference between hardware texture compression and other commonly used image compression is that the former does not use entropy coding. Entropy coding is the ...
Nathan Reed's user avatar
  • 24.7k
22 votes
Accepted

How are mipmap levels computed in Metal?

Mip selection is pretty well standardized across devices today—with the exception of some of the nitty-gritty details of anisotropic filtering, which is still up to the individual GPU manufacturers to ...
Nathan Reed's user avatar
  • 24.7k
19 votes
Accepted

How does Texture Cache work in Tile Based Rendering GPU

Whether it's a tile based GPU or not doesn't really affect the texture cache architecture. The memory layout of texture will look like some flavor of Morton order or Hilbert curve in all GPUs. As a ...
Christophe's user avatar
17 votes
Accepted

How does Texture Cache work considering multiple shader units

At the top level, a GPU is subdivided into a number of shader cores. A small GPU in a notebook or tablet may have only a few cores while a high-end desktop GPU may have dozens. In addition to the ...
Nathan Reed's user avatar
  • 24.7k
16 votes
Accepted

How does mip-mapping work with non-power-of-2 textures?

The rule is that to compute the next mipmap size, you divide by two and round down to the nearest integer (unless it rounds down to 0, in which case, it's 1 instead). For example, a 57x43 image would ...
Nathan Reed's user avatar
  • 24.7k
16 votes

How is anisotropic filtering typically implemented in modern GPUs?

The texture filtering hardware takes several samples of the various mipmap levels (the maximum amount of samples is indicated by the anisotropic filtering level, though the exact amount of samples ...
yuriks's user avatar
  • 1,130
16 votes
Accepted

Is using many texture maps bad for caching?

Just adding to imallett's answer, it is true that increasing the number of accesses to different texture data in a shader will increase pressure on the GPU cache(s), but there are several other ...
Simon F's user avatar
  • 4,161
16 votes
Accepted

Are lookup textures still used for anything?

Yes, lookup textures are still used. For example, pre-integrated BRDFs (for ambient lighting, say), or arbitrarily complicated curves baked down to a 1D texture, or a 3D lookup texture for color ...
John Calsbeek's user avatar
15 votes
Accepted

Performance of vector graphics versus bitmap or raster graphics

As TheBuzzSaw said, it does depend on lots of things, including implementations of the rasterized graphics vs the vector graphics. Here are some high performance vector graphics methods that are ...
Alan Wolfe's user avatar
  • 7,721
14 votes

How can virtual texturing actually be efficient?

Virtual Texturing is the logical extreme of texture atlases. A texture atlas is a single giant texture that contains textures for individual meshes inside it: Texture atlases became popular due to ...
RichieSams's user avatar
  • 3,702
13 votes

Changing image so it would look like through colorful glasses

(XYZ) can be the RGB colour you want to tint your scene by. For the above scene it can be a red colour (1.0, 0.0, 0.0) or something similar with a strong red component. Bear in mind that since you ...
Kostas Anagnostou's user avatar
12 votes
Accepted

Algorithms for down sampling an image?

When Sean and I wrote stb_image_resize we chose Mitchell for downsizing. Mitchell is similar to Cubic, you can read about the cubic class of sampling filters in Mitchell Netravali 1988. They are all ...
Jorge Rodriguez's user avatar
12 votes
Accepted

Is it good practice to use all the available texture units?

Modern hardware doesn't really have the concept of texture binding points as exposed by OpenGL. Rather, the shader unit uses a descriptor (which is just some kind of fat pointer) which can potentially ...
yuriks's user avatar
  • 1,130
12 votes
Accepted

How to do texturing with OpenGL direct state access?

You still have to bind the desired texture to the texture unit to use it for rendering. In your current code, you're not specifying which texture to use for rendering, so the GL driver doesn't know ...
Nathan Reed's user avatar
  • 24.7k
12 votes
Accepted

Help me grasp Anisotropic Filtering (AF)

To understand the nature of anisotropic filtering, you need to have a firm understanding of what texture mapping really means. The term "texture mapping" means to assign positions on an object to ...
Nicol Bolas's user avatar
  • 9,577
11 votes
Accepted

Is modifying a texture (painting on it) considered a "state change"?

Updating an area of memory in the graphics device (a texture, buffer, and the like) is not quite the same as changing a rendering state. What makes a render state change expensive is the amount of ...
glampert's user avatar
  • 1,439
10 votes
Accepted

Perspective Correct Texture Mapping

You are on the right track but what you need to do is to calculate u/w and v/w, and also 1/w for each vertex, which you interpolate linearly in screen space in your rasterizer. Then for every pixel ...
JarkkoL's user avatar
  • 3,596
10 votes
Accepted

Seamless Textures

For these types of algorithms, you usually have to rely on multiple forms of texture synthesis. That doesn't mean you have to generate the whole texture from scratch. For example, you could regenerate ...
aces's user avatar
  • 1,353
9 votes

How is anisotropic filtering typically implemented in modern GPUs?

The API requirements can be found in any of the specs or extensions. Here is one: https://www.opengl.org/registry/specs/EXT/texture_filter_anisotropic.txt All GPU vendors likely deviate from the spec ...
ap_'s user avatar
  • 2,194
9 votes
Accepted

16bit half-float linear HDR images as (diffuse/albedo) textures?

In film production, we almost never use 8-bit textures for color/albedo, because of banding, etc. (JPEG is especially problematic since by spec, it's sRGB rather than linear values.) We either use '...
Larry Gritz's user avatar
8 votes
Accepted

Help me find out what this texture mapping technique is called

What you see in the image called a UV map. That is, it is simply texture coordinates to be looked up encoded in a image. Same thing happens in all texture lookup in 3D there is a underlying sampler ...
joojaa's user avatar
  • 8,377
8 votes

Is using many texture maps bad for caching?

The answer depends on what you mean. Modern hardware (e.g. with bindless textures) really doesn't care too much how many textures are "bound". The real question is how many you use. Textures ...
geometrian's user avatar
  • 1,920
8 votes

Performance of vector graphics versus bitmap or raster graphics

There might be. Less technical answer: If you're building a website or another application where you have nothing to do with the graphics programming then the answer is probably yes. The underlying ...
ShaneC's user avatar
  • 80
8 votes
Accepted

Is a cubic Lagrange interpolation tensor product the same as bicubic interpolation?

It turns out that no, while you can use bicubic Lagrange interpolation for bicubic texture sampling, it isn't the highest quality option, and probably not actually likely to be used. Cubic hermite ...
Alan Wolfe's user avatar
  • 7,721
8 votes
Accepted

Sine-based Tiled Procedural Bump

As you are taking the mean of a number of sine waves, your colour values will range from -1 to 1. From your example image, it looks like only the top half of this range of values (from 0 to 1) is ...
trichoplax is on Codidact now's user avatar
8 votes

16bit half-float linear HDR images as (diffuse/albedo) textures?

Yes, it's possible in some extreme cases for HDR lighting and tonemapping to expose banding issues in color textures. In those cases, having a higher bit depth for the textures could be useful. ...
Nathan Reed's user avatar
  • 24.7k

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