47 votes
Accepted

Physically based shading - ambient/indirect lighting

Real-time graphics deploys a variety of approximations to deal with the computational expense of simulating indirect lighting, trading off between runtime performance and lighting fidelity. This is an ...
Nathan Reed's user avatar
12 votes
Accepted

Why can't I utilize multiple CPU cores with OpenGL like Vulkan?

Because the fundamental foundation of OpenGL makes multi-CPU-core submission impossible. OpenGL, at its core, is a synchronous API. Every OpenGL command behaves "as if" it were executed and completed ...
Nicol Bolas's user avatar
  • 9,782
8 votes
Accepted

Double buffering always necessary?

Indeed there are/were 'just in time' renderers. For example, Dreamcast (PowerVR CLX2) had a mode where the 'frame buffer' only had to be a few rows of tiles in size. The system would be rendering ...
Simon F's user avatar
  • 4,241
6 votes

Physically based shading - ambient/indirect lighting

This is the main 'hard' problem remaining in real-time CG, and there is a lot of research ongoing into solving it. The biggest hurdle is that in raster graphics, each component of the scene is ...
russ's user avatar
  • 2,392
6 votes
Accepted

SSAO artefacts on iPhone (OpenGL ES)

Resolved by adding precision highp sampler2D to my shaders. About default precision settings on ES - https://www.khronos.org/files/opengles_shading_language.pdf ...
pronvit's user avatar
  • 231
5 votes
Accepted

OpenGL ES 3 - Uniform buffer object with float array

Let's review what the specification says about std140 layout of arrays: If the member is an array of scalars or vectors, the base alignment and array stride are ...
Nicol Bolas's user avatar
  • 9,782
5 votes

How to take consistent screenshots across multiple machines?

Nicol Bolas explains why you can't expect pixel-accurate reproductions, but that doesn't mean you can't test with screenshots. Don't compare the screenshots byte-for-byte. Instead, use a perceptual ...
Dan Hulme's user avatar
  • 6,810
4 votes
Accepted

What is causing this odd scaling behavior?

Are you calling glViewport when switching drawing to FBO ? This should be called when switching into a different resolution render target. I say this because case #1 is a symptom of incorrect ...
PaulHK's user avatar
  • 2,322
4 votes
Accepted

If I have more than enough memory, can it still be beneficial to use compressed textures?

Because memory bandwidth is not free. No matter how much RAM you have, it takes less time to read 1024 bytes than it does to read 1024 KB. Compressed textures, relative to 32-bpp, can offer ...
Nicol Bolas's user avatar
  • 9,782
3 votes
Accepted

OpenGL ES Frag Shader - Branching

I think the most efficient way might be either return float(shadowValue > shadowTexZ); or ...
Detheroc's user avatar
  • 1,436
3 votes

Loading compressed image to GPU and reading back decompressed on CPU

Desktop OpenGL requires implementations to convert pixel data between the internal format of the image and the format you specify in the pixel transfer command. OpenGL ES does not. Indeed, it is so ...
Nicol Bolas's user avatar
  • 9,782
3 votes
Accepted

Interlacing vertex buffer data with extra efficiency

Is it even possible to have opengl assume that the Z is always 0? Yes it is. Just set the component count to 2 in glVertexAttribPointer and the other 2 components (...
ratchet freak's user avatar
2 votes

Pixel density / color channel depth ratio for dithered gradients

There has been quite some research into this using Barten contrast sensitivity function. It is the current formula behind the Dolby Perceptual Quantizer as featured in SMPTE 2084 and HDR10. This, ...
troy_s's user avatar
  • 318
2 votes
Accepted

Any way to fake textureLod on GLES2?

One way would be to break out the mip levels of the cube into a bunch of separate textures, then implement the mip selection and trilinear filtering yourself, by branching based on the LOD value. ...
Nathan Reed's user avatar
2 votes
Accepted

Blending for Floating Point Texture

Section "17.3.8 Blending" of the OpenGL spec states: If the color buffer is fixed-point, the components of the source and destination values and blend factors are each clamped to [0, 1] or [-1, 1] ...
bernie's user avatar
  • 830
2 votes

How to take consistent screenshots across multiple machines?

What you want cannot reasonably be done. No graphics API defines byte-accurate results. Every implementation will have its own variances, which will be visible in the results. OpenGL provides no ...
Nicol Bolas's user avatar
  • 9,782
2 votes
Accepted

When unsetting a VAO, should you also unbind the associated VBOs?

No, you do not need to unbind the VBO's. VBO's are only added to the state of the VAO when that VAO is bound. So any previously bound VBO's will not alter the state of the VAO that you are going to ...
Reynolds's user avatar
  • 1,238
2 votes

Best practice for managing many shaders and merging multiple shaders into one?

I target mobile/tablet devices with my product this is less of a concern with desktop GPUs. unity and unreal allowing full flexibility on adding shaders & materials at-will Well, Unity and ...
wip's user avatar
  • 1,861
2 votes
Accepted

Efficiently drawing multiple instances of 3D objects

What you are looking for here is instanced rendering. Instanced rendering coupled with attribute divisors is a very powerful tool to render multiple copies of the same object using only one drawing ...
Reynolds's user avatar
  • 1,238
2 votes
Accepted

Alpha component in color buffer affects RGB components?

It looks like you're drawing with pre-multiplied alpha. This means that the red, green, and blue channels have been multiplied by the alpha channel. So your shader should look more like this: ...
user1118321's user avatar
  • 3,411
2 votes
Accepted

If a GPU supports OpenGL ES 3.2, does it also support OpenGl 3.0?

That looks like a typo. Most mobile GPUs don't support desktop GL of any version, so they probably meant OpenGL ES 3.0 (which is a valid version) And yes, ES 3.0 is backwards compatible with ES 3.2.
Nicol Bolas's user avatar
  • 9,782
1 vote
Accepted

Tiling in GLSL creates unwanted seams

Using texelFetch gives the correct result. Here is a shaderToy that shows an animated version. ...
pmw1234's user avatar
  • 3,219
1 vote
Accepted

How to pass only the needed portion of the data calculated in a fragment shader to another fragment shader?

I'm assuming that you don't know how many objects there will be or have any way to index them until the image processing operations are completed, i.e. you have some final pass that determines for ...
Nathan Reed's user avatar
1 vote
Accepted

What is wrong with my glDrawElement code

glDrawElements specifies the second argument to be the number of elements to be taken from the buffer of indices, not the number of vertices. The correct number would be the number of triangles times ...
Reynolds's user avatar
  • 1,238
1 vote
Accepted

Same specular lighting on both tris in a quad (for "low-poly" "flat shading" look)?

If I understand you correctly, the problem is that the provoking vertex isn't the same vertex between the two triangles in a quad, due to using triangle strips. You could switch to using an indexed ...
Nathan Reed's user avatar

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