# Tag Info

13

(XYZ) can be the RGB colour you want to tint your scene by. For the above scene it can be a red colour (1.0, 0.0, 0.0) or something similar with a strong red component. Bear in mind that since you are applying the colour in a multiplicative way it will act as a filter suppressing original colour components. So if your scene is mostly green but you apply (i....

8

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. Jittering moves sample positions in space to reduce artefacts caused by regular sampling. Dithering changes the way colours are rounded (when reducing ...

7

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 matrix, and then the projection matrix. In this manner, you know the correct multiplication order by just reading the variable name and you do not have to think ...

7

The shader language is bound to the APIs/engines that support it (glsl to openGL & WebGL and hlsl to D3D). There are tools to translate from one to the other but they aren't perfect. This means the main reason to pick one over the other is which platform you will be working on. However by the end of the year a new binary shader representation will come ...

6

Extending Kostas Anagnostou's answer, a commonly used formula for desaturation is float value = 0.3 * InputR + 0.59 * InputG + 0.11 * InputB; This accomodates the fact that different color hues are perceived with a different intensity by a human observer. Further following the example, you would then define some tint color that is multiplied with the ...

6

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} \tfrac{1}{2} \cos \theta + \tfrac{1}{2} \\ \tfrac{1}{2} \sin \theta + \tfrac{1}{2} \\ 0 \end{bmatrix}$$ I did a quick test and generated something that looks ...

5

So I followed Alan Wolfe suggestion (in comment to my question) And turned out he was right. I was using SamplerState.LinearWrap and that was the issue. When I changed this to AnisotropicWrap it looked much better. Below are some examples of different sampling types and how they affect texture: graphicsDevice.SamplerStates[0] = SamplerState.PointWrap; ...

5

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 on the outside (and for graphics pipe devs its often so, not for modeler). For a mathematician it is more natural to think from local coordinates out. There are ...

4

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 fast way to do that). early-out of the pixelshader if outside of the box, i.e. if any coordinate in the local-position is outside of -1;1. then do the dot-...

4

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 there. Results:

4

The HLSL shader language is used in DirectX family APIs and GLSL for the OpenGL family APIs. This means that the choice of graphics API will limit the shader language as well, so if cross platform is a concern then GLSL will be the choice. However, this comes with some caveats as well. One difference is that in OpenGL the shading language is compiled on ...

4

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 pressure so that it increased occupancy from 2 to 4, which had no impact on performance. It's generally a good idea to reduce the pressure if you need to hide ...

4

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 write wherever you like). The group size affects which invocations can access the same block of groupshared memory, so it forces all warps from the same group ...

3

You could go the calculus way and have an explicit rate of change that is outside your shader float frequency = getFrequency(); sineTime += frequency * deltaTime; (sineTime could be a float that is scoped right outside of your render loop, so that it retains its value) And if you pass sineTime into your shader you can just do float s = sin(sineTime);

3

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. Also, negative lobes do produce a sharpening or ringing effect that looks like what you're seeing. I'd try a nonnegative filter, such as a cut-off Gaussian or a ...

3

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-projection (lview_to_lprojection) 00 and 11 matrix entries were not equal. Due to the aspect ratio of 1, both matrix entries must be equal. Furthermore, due to ...

3

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 go to properties -> HLSL Compiler -> General, and switch Shader Model to the one you want which was newest one for me (5.0)

3

Choose the color RGB of your colorful glasses and choose how transparent they are by choosing an alpha value A. Then alpha composite the glasses on top of the input image: OutputR = R * A + InputR * (1-A) OutputG = G * A + InputG * (1-A) OutputB = B * A + InputB * (1-A)

3

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. Additionally you have not set a raster state or blend state. It is good practice to set these and can be helpful early on to set the winding order in the ...

3

You have to use the appropriate register type for the resource: b registers for constant buffers, t for textures, and u for UAVs. AFAIK, it is not possible to bind a UAV to a texture slot, or otherwise mismatch registers and resources. However, a resource can have multiple views, so it is possible to have a resource bound as a UAV in one shader and as a ...

3

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-weighted distribution the $N \cdot L$s and pis will cancel out and you should just be accumulating $\frac{1}{N} \sum L_i * \text{albedo}$. It looks like in your code ...

3

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 parameter name, not after the type—just like declaring a variable.) However, having different array sizes that can be passed into the same function won't work in HLSL the way it would in C/C++. ...

3

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 applied voltage raised to the power of a so-called gamma value, which depends on the monitor. This gamma value typically lies between 2.2 and 2.5 for CRT monitors. (...

2

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 then you should be able to apply the same logic in the lighting phase.

2

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, the vector if you look at the code. Look at that garbage. Those are supposed to be the indices... Well at least I know how to use the debugger now, thanks guys ...

2

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. float udRoundBox( vec3 p, vec3 b, float r ) { return length(max(abs(p)-b,0.0))-r; } You can simply avoid the 3rd dimension if you don't need it. This method comes from ...

2

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 world space and mapping the texture into it, you draw it in texture space and map its vertices onto it and let your graphics hardware worry about interpolation. ...

2

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 is different for each fragment so the stretched black ellipsoid is the correct output. A fragment shader has only local information about the current fragment ...

2

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 of your shader to bind your Texture2D[] in HLSL to a contiguous range of SRV descriptors from a descriptor heap. Then, when you create the SRVs for your ...

1

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-sized U image and then the quarter-sized V image after that (also with a strange gap of half the image size between the Y and the UV data). This doesn't work ...

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