8
votes
Accepted
What are Jittering and Dithering
Jittering and dithering are both techniques of adding noise to reduce visible artefacts (such as banding) in an image. They solve different kinds of artefacts so they are used in different situations. ...
5
votes
Accepted
Threads per compute shader group
There shouldn't be any performance penalty inherent in using a 3D group over a 2D one, the dimensions are just an aid for programmers to map invocations on to memory locations (since you can read or ...
5
votes
Accepted
Register pressure in Compute Shader
Lowering register pressure doesn't necessarily give you any performance boost though. I recently went through this exercise myself on GCN architectures (for a simple ray tracer) and reduced register ...
4
votes
Accepted
Special directional light type
Alan Wolfe is pretty spot on, but I will sum up any way :)
render the back-faces of your "unit"-sized-box, [-1;1]
sample the zbuffer and transform into light-local coordinates (see our slides for a ...
4
votes
Accepted
Path tracing - cannot converge diffuse sampling + oversaturation
One point: the Lambert BRDF is not $N\cdot L$, it's just the albedo divided by pi. The $N \cdot L$ factor comes from the $\cos \theta$ in the rendering equation. So, when sampling with a cosine-...
4
votes
Accepted
How to pass a 2D array to a function
Unsized arrays aren't implemented in HLSL. You can pass fixed-size arrays into functions like
void foo(float2 x[2][4])
{
...
}
(Note the brackets go after the ...
3
votes
Question about function for color
The actual color of a pixel, outputted on a monitor, does not linearly depend on the applied voltage signal for that pixel. For CRT monitors, the actual color is approximately proportional to the ...
3
votes
Accepted
Changing sin frequency smoothly in shader
You could go the calculus way and have an explicit rate of change that is outside your shader
float frequency = getFrequency();
sineTime += frequency * deltaTime;
...
3
votes
Accepted
Unexpected results from Mitchell-Netravali
Mitchell–Netravali has negative lobes, which are generally not recommended for small sample counts from what I understand; you tend to end up with both the positive and negative areas undersampled. ...
3
votes
Accepted
Artifacts in omni light shadow mapping
I finally found the cause of the problem. There appears to be a problem with the shadow map of both the omni light and spotlight. While debugging, I noticed by accident that the light-view-to-light-...
2
votes
Accepted
Special Texture Stretching without deformation
The Nine Patches algorithm is a really nice and powerful solution if you are using textures but I ended up by using a fully procedural solution.
I am just drawing a round box like this.
...
2
votes
UV Coordinate Interpolation in Compute Shader
You seem to do things more complicatedly than you need to, as adressed in the comments. What you actually want to do is simple the opposite of the normal render flow. Rather than drawing your mesh in ...
2
votes
Special directional light type
I would start by looking into deferred decals (you can start here for example, this blogpost has a lot of useful links)
If you understand how the positions are calculated and compared with the volume ...
2
votes
Closest sphere on segment
Your actual result is correct in terms of what you can achieve in a single-pass with a fragment shader. It calculates the distance of the fragment's world position to the line segment. That distance ...
2
votes
Accepted
Using array of textures in DX12
I think what you want for this is to create a descriptor table which lists your textures. The individual textures would be created and uploaded as ordinary Texture2Ds. You'd set up the root signature ...
2
votes
Accepted
How do I tell what kind of shader an hlsl shader is by looking at the code?
The real work horse shader looks to be the compute shader near the bottom of the list in this file.
The other shaders which has fragment and vertex code in it is in this file.
One of the first things ...
1
vote
Question about function for color
Gamma correction originated as a way of correcting the output of a CRT to be a better fit for the human visual system. Modern monitors don't need to do it, but, they followed the CRT and there were ...
1
vote
Porting from DXR/HLSL to Vulkan Ray Tracing Extension/GLSL
According to this document, one should be able to extract those values through
gl_RayTminEXT and gl_RayTmaxEXT GLSL built-ins for intersection shader.
Further comments are welcome.
1
vote
Accepted
Black squares in bloom effect
I managed to solve the problem by putting a saturate on the color input.
...
1
vote
Accepted
1
vote
Accepted
Calculating UV coordinates for sampling texture atlas
Assuming normalized texture coordinates and a grid of 8x8 (which is 64 tiles not 16 like I said in the comments) then tileOffset will need to be a vec2 for the x and y offsets.
Also, assuming texture ...
1
vote
Question about function for color
Welcome to the world of 8-bit graphics! Other answers here are excellent, and most of what you need to know is described well on Wikipedia but let me take you on a human-friendly journey of ...
1
vote
Accepted
Pathtracing - many bounces reduce shadows
To follow up my question and provide partial answer:
First of all, I'd like to thank lightxbulb for providing comments which helped me to find solution.
So here is a basic image, 4 light bounces with ...
1
vote
Accepted
Importance sampling GGX NDF - fireflies and bright final result
I've made a few changes in my code, so let's start with basic image that I had problem we that we'll state as a problem at the beginning:
After changing part of the code from:
...
1
vote
Accepted
Worsening sampling quality of raytracing with increasing distance from world origin
Problem was that perspective matrix had very short Z_NEAR and Z_FAR values (0.01f and 200.0f). By changing it to much higher range (10.0f, 20000.0f), problem with jaggies and artifacts disappears.
1
vote
Accepted
What is a tbuffer and what is their use case?
Keep in mind, that I'm still learning and I have no professional capacity in terms of graphics programming. So you might want to continue research with provided resources.
t*#*: A register for a ...
1
vote
Accepted
Reading from buffer versus calculating on the fly performance
My question is, though i am aware cos() and sin() is fast, how do they compare to simply getting the value precomputed in a buffer instead?
This will depend on your shader code and GPU model.
GPUs ...
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
Accepted
R16_FLOAT, SampleCmp and CheckFormatSupport
Because I was using the CheckFormatSupport wrong. The second parameter is supposed to be an input.
Here is what it should be like.
...
1
vote
Precision problem on AMD
In HLSL, you can use the built-in fmod function for this.
I'm not sure what's going wrong with your implementation, though. It looks mathematically correct. It's ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hlsl × 64shader × 20
glsl × 16
raytracing × 10
texture × 10
directx11 × 9
compute-shader × 8
directx12 × 8
pixel-shader × 8
uv-mapping × 6
unity × 6
rendering × 5
directx × 5
pathtracing × 4
lighting × 4
opengl × 3
c++ × 3
brdf × 3
gpu × 3
antialiasing × 3
deferred-rendering × 3
mathematics × 2
image-processing × 2
sampling × 2
performance × 2