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 ...
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 ...
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 ...
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 ...
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) ...
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 ...
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,...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
...
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 ...
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, ...
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
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-...
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 };
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 ).
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pixel-shader × 25hlsl × 8
shader × 7
rendering × 5
texture × 4
glsl × 3
directx11 × 3
opengl × 2
transformations × 2
lighting × 2
image-processing × 2
gpu × 2
color × 2
performance × 2
compute-shader × 2
pixel-graphics × 2
artifacts × 2
deferred-rendering × 2
pixels × 2
raytracing × 1
3d × 1
algorithm × 1
geometry × 1
webgl × 1
real-time × 1