Hot answers tagged

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. ...
Dan Hulme's user avatar
  • 6,770
7 votes

Is there a objective reason for matrix naming conventions?

I think the naming order is intuitive because it is in reading order (left to right), e.g., worldViewProjection means that your point/direction is first multiplied by the world matrix, then the view ...
vgs's user avatar
  • 311
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 ...
JarkkoL's user avatar
  • 3,626
5 votes

Is there a objective reason for matrix naming conventions?

The order is arbitrary, but if you want to be compatible with physics textbooks then your notation is mostly set. The difference is that you seem to think that its more natural to observe the systen ...
joojaa's user avatar
  • 8,407
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 ...
russ's user avatar
  • 2,382
5 votes
Accepted

Jitter texture generation

The texture is probably generated by picking a random angle per pixel, and populating the image with its sine and cosine, remapped into [0, 1]: $$\theta \sim [0, 2\pi] \quad \to \quad \begin{bmatrix} ...
Nathan Reed's user avatar
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 ...
Mikkel Gjoel's user avatar
4 votes
Accepted

Error with tube lighting

Found the solution, it turns out the lightVec is not the vector of light from the tube but rather the direction the tube will point. Therefore i will need to pass it a light rotation value to be used ...
Josh Nuttall's user avatar
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-...
Nathan Reed's user avatar
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 ...
Nathan Reed's user avatar
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; ...
Sebastián Mestre's user avatar
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. ...
Nathan Reed's user avatar
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-...
Matthias's user avatar
  • 1,064
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
Accepted

Hlsl - registers type

You have to use the appropriate register type for the resource: b registers for constant buffers, t for textures, and ...
Nathan Reed's user avatar
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 ...
Matthias's user avatar
  • 1,064
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
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. ...
MaT's user avatar
  • 1,229
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 ...
Christian Rau's user avatar
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 ...
moradin's user avatar
  • 121
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 ...
Isolin's user avatar
  • 438
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 ...
Nathan Reed's user avatar
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 ...
pmw1234's user avatar
  • 3,132
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: ...
DirectX_Programmer's user avatar
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.
DirectX_Programmer's user avatar
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 ...
DirectX_Programmer's user avatar
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 ...
Varaquilex's user avatar
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
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. ...
ACskyline's user avatar
  • 115

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