23 votes
Accepted

Why do we have graphics frameworks like OpenGL and DirectX, when games could just draw pixels directly?

Speed is the most common reason why this is not done. In fact you can do what you propose, if you make your own operating system, its just going to be very slow for architectural reasons. So the ...
joojaa's user avatar
  • 8,397
19 votes

When is a compute shader more efficient than a pixel shader for image filtering?

John has already written a great answer so consider this answer an extension of his. I'm currently working a lot with compute shaders for different algorithms. In general, I've found that compute ...
bernie's user avatar
  • 820
14 votes

Why do we have graphics frameworks like OpenGL and DirectX, when games could just draw pixels directly?

work on any 32-bit color GPU (even old ones)? Bit of history here: this is how games were done on PC up until graphical accelerators started to become available in the mid-90s. It did indeed work on ...
pjc50's user avatar
  • 241
14 votes

Why do we have graphics frameworks like OpenGL and DirectX, when games could just draw pixels directly?

Just to add to joojaa's answer, things are still being drawn pixel by pixel. You're just generating the pixels using a vertex shader/assembler/rasterizer, then texturing and lighting them using a ...
russ's user avatar
  • 2,372
9 votes
Accepted

Tweaking a glow shader to make it look better

Sigma and kernel size of Gaussian filter Regarding how to choose the sigma and the kernel size (pixels) of the Gaussian: you set the sigma based on how wide of a blur you want (judging it visually) ...
Nathan Reed's user avatar
  • 24.8k
6 votes
Accepted

Can (and how so) shaders paint screen pixels beyond those that occupied by the shaded mesh?

When you use linewidth or line antialiasing or pointwidth or pointsprites, OpenGL creates for you a small rectangle instead of the line or point, with texture coordinates. Nowadays you can even ...
Fabrice NEYRET's user avatar
6 votes
Accepted

Gpu derivatives. How it's done across 2x2 boundary?

In Vulkan the shader only looks at each 2x2 and won't attempt to look beyond the neighbourhood: http://vulkan-spec-chunked.ahcox.com/ch15s05.html $$dPdx_{0,0}=dPdx_{1, 0} = P_{1,0}−P_{0,0}\\ dPdx_{2,...
ratchet freak's user avatar
5 votes

When is a compute shader more efficient than a pixel shader for image filtering?

I stumbled on this blog: Compute Shader Optimizations for AMD Given what tricks can be done in compute shader (that are specific only to compute shaders) I was curious if parallel reduction on ...
maxest's user avatar
  • 66
5 votes
Accepted

Moires patterns despite using mipmaps

Two things come to mind: When generating your smaller mip map levels try to avoid using a simple 2x2 box filter because, though cheap and cheerful, they do a really poor job of removing high ...
Simon F's user avatar
  • 4,171
5 votes

Advice on how to create GLSL 2D soft smoke/cloud shader

There is good glsl source of noise (simplex noise) online to make real time noise. In addition to this, to make effect of moving fog/smoke like in this video you can make 3D FBM function. This is my ...
mdkdy's user avatar
  • 2,119
5 votes
Accepted

Advice on how to create GLSL 2D soft smoke/cloud shader

Noise functions are definitely your friend here—FBM would be one good candidate. You’re right that it can look too uniform on its own, but if you blend multiple layers of it together, using different ...
Noah Witherspoon's user avatar
3 votes
Accepted

HLSL Deferred Rendering

A very novice mistake, I was compiling with the old HLSL compiler. But why would that be the default? Very strange. For anybody wondering, just right click the HLSL file in the solution explorer and ...
phatgreen's user avatar
  • 141
3 votes

Trouble Finding Simple 2D DirecX11/HLSL Issue

You have not set a viewport with RSSetViewports. You need to set this to the pixel dimensions of your render target. Without this the viewport will be set to 0,0,0,0 meaning no pixels will be touched. ...
icStatic's user avatar
  • 131
3 votes

Can (and how so) shaders paint screen pixels beyond those that occupied by the shaded mesh?

One good way you can arrange for a circle (or other shape) to be drawn for each vertex in a mesh is to use geometry instancing. This is a GPU feature that allows multiple instances (copies) of a mesh ...
Nathan Reed's user avatar
  • 24.8k
2 votes
Accepted

Trouble Finding Simple 2D DirecX11/HLSL Issue

I can't believe it has taken me this long to find this... So the array I was giving the Index Buffer Desc that contains the data was the wrong one... It was a blank one that I forgot I didn't need, ...
phatgreen's user avatar
  • 141
2 votes

Moires patterns despite using mipmaps

SOLUTION I managed to solve my problem by increacing size of texture 2048x2048px so there would be generated more mipmaps. Also it seems like changing my SamplerState form anisotropic to something ...
bartosz.baczek's user avatar
2 votes

How can I implement GIMP's "Colorize" function?

It appears to me that in the image, the saturation of the original image is 0 since it is grayscale. (Unless I've misunderstood the question.) When the saturation is 0, the hue is undefined, but it ...
user1118321's user avatar
  • 3,401
1 vote
Accepted

What's the intuition behind color burn and other blend modes?

In general, notice that there is no particular reason for a blend mode or other color processing formula in an image manipulation program to be reasonable “from first principles” at all. All we care ...
Kevin Reid's user avatar
1 vote

Rendering light balls: Where to do perspective calculations?

First of all a small introduction about the matrices you need. viewMatrix: This matrix is a 4x4 matrix which stores the position and orientation of your camera with respect to the world origin. ...
Thomas's user avatar
  • 1,136
1 vote

Is there a tool capable of drawing a triangular linear gradient fill?

Most 2D graphics programs are able to do linear gradients with arbitrary orientations. If you don't mind a little work, it is possible to set this up to imitate the 2D linear interpolation across a ...
Nathan Reed's user avatar
  • 24.8k
1 vote

Using original vertices coordinates after clipping

A vertex consists of not just the position, but all of the values passed from the vertex processing stage to the rasterizer. So if a vertex gets clipped, the new vertices generated in that process ...
Nicol Bolas's user avatar
  • 9,697
1 vote

Convert RGB image to YUV420 using a hlsl shader

The problem here is that you're not storing the YUV values of a pixel at the same place in the result image. What you seem to be doing is first storing the full size Y image and after that the quarter-...
Christian Rau's user avatar
1 vote

Trouble Finding Simple 2D DirecX11/HLSL Issue

Your indices are wrong, they should start at 0. Correct indices: unsigned int quadIndices[] = { 0, 1, 2, 2, 1, 3 };
Jason Allen's user avatar
1 vote
Accepted

Methods for grid traversal in a glsl pixel shader?

why not building a bounding box (or spheres) hierarchy ? (but for a shadertoy implementation, the lack of dynamic loop length might spoil the gain ).
Fabrice NEYRET's user avatar

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