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 ...
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 ...
7
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 ...
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 ...
6
votes
How to implement a realtime 2D light renderer with fog/colored light on the GPU?
If your wall geometry is vector graphics you can simply extrude the segment away from the light position. This means 2 triangles per draw call, all the extrusion offsets can can be handled in the ...
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 ...
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 ...
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 ...
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 ...
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 ...
3
votes
Accepted
OpenGL ES Frag Shader - Branching
I think the most efficient way might be either
return float(shadowValue > shadowTexZ);
or
...
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 (...
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 ...
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] ...
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, ...
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.
...
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 ...
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 ...
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 ...
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 ...
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:
...
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.
1
vote
Accepted
Tiling in GLSL creates unwanted seams
Using texelFetch gives the correct result. Here is a shaderToy that shows an animated version.
...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
opengl-es × 38opengl × 17
shader × 5
texture × 5
glsl × 4
fragment-shader × 4
webgl × 3
real-time × 3
gpu × 2
vulkan × 2
performance × 2
compression × 2
mobile × 2
android × 2
raytracing × 1
rendering × 1
algorithm × 1
lighting × 1
image-processing × 1
mesh × 1
projections × 1
physically-based × 1
shading × 1
color-science × 1
optimisation × 1