Skip to main content
Share Your Experience: Take the 2024 Developer Survey
30 votes
Accepted

What are screen space derivatives and when would I use them?

First, it helps to know that GPUs always evaluate fragment/pixel shaders on 2x2 blocks of pixels at a time. (Even if only some of those pixels ultimately need to be drawn, while others are outside the ...
DMGregory's user avatar
  • 135k
11 votes
Accepted

How is this lantern glow effect achieved?

My best guess right now is that it's a billboarded transparent sprite, which is animated to give it a pulsing effect. Exactly that. This is simple enough even for older hardware. There's also some ...
Mario's user avatar
  • 8,497
7 votes
Accepted

How does the following code generate a full screen quad?

it doesn't generate a quad, instead it generates a fullscreen triangle. The outputs end up as: ...
ratchet freak's user avatar
6 votes
Accepted

Signed Distance Fields: How are different colour channels used to improve output of sharp corners?

I have solved this exact problem for my master's thesis over a year ago and have already talked about it here. Yesterday, I released an open source program with my multi-channel distance field ...
Detheroc's user avatar
  • 186
5 votes
Accepted

Doing legacy DirectX Coding on Windows 10

You can continue to use the legacy DirectX SDK for Direct3D 9 on Windows 10, but there are a number of caveats: First, there is no Direct3D 9 Debug support on Windows 8.0, Windows 8.1, or Windows 10. ...
Chuck Walbourn's user avatar
5 votes
Accepted

Sine-based Tiled Procedural Bump

I would guess that they've scaled and shifted their outputs into the range from 0f to 1f (0-255) for the purpose of that greyscale height visualisation. They probably omitted that adjustment from the ...
DMGregory's user avatar
  • 135k
5 votes

How do I render my DirectX C++ engine to a C# Panel?

So like Josh has described above I have written an Engine in a DLL and used p/invoke in C# to use it. If anyone is interested here is the code: DLL Header.h ...
Arjan Singh's user avatar
5 votes
Accepted

DirectX 12 using Visual studio 2015 on Windows 7 SP1

According to Microsoft itself the latest DirectX version supported on Windows 7 SP1 is "DX11.1". Even on Windows 8 you don't have access to DX12. I guess that's what causing the problem. No matter ...
Ali1S232's user avatar
  • 8,677
5 votes
Accepted

Why are committed resources better than placed resources?

You will get contradicting suggestions from their own: http://developer2.download.nvidia.com/assets/gameworks/downloads/regular/GDC17/DX12CaseStudies_GDC2017_FINAL.pdf Page 14: "Sub-allocation ...
macrod's user avatar
  • 66
4 votes
Accepted

How can I access the members of XMVECTOR?

DirectXMath's XMVECTOR is an opaque platform-optimal type that you can only manipulate via free functions, on x86 something akin to a ...
Lars Viklund's user avatar
  • 4,104
4 votes
Accepted

Transform texture coordinates when using shader

I just stumbled back on this question, so I figure I should supply an answer. :) The shader code I wrote in the question is almost right. I forgot that to convert a point with these transformations, ...
Scott Oliver's user avatar
4 votes

How to read rendered textures back without killing performance

So, fundamentally, the problem here is that to coerce from OpenGL to Direct3D requires bouncing from GPU memory back to system memory and back to GPU memory once more. You might seriously consider ...
MaulingMonkey's user avatar
4 votes
Accepted

Color Correction in DirectX

Color correction is commonly done through post processing shaders. Basically first you render the scene to a framebuffer, then draw a fullscreen quad that has a shader that takes that framebuffer and ...
Aaro's user avatar
  • 128
4 votes

Why would a game developer choose Direct3D instead of something with more cross-platform support?

This is a rather broad question & the specific answer will vary from one situation to the next. Here are some general reasons: It takes less time, money & expertise to develop & support a ...
Pikalek's user avatar
  • 12.4k
4 votes

Why would a game developer choose Direct3D instead of something with more cross-platform support?

The answers in this thread all make good points that play into this decision, but a few more things to consider: Windows comes with DirectX built-in and the driver certification includes Direct3D ...
Chuck Walbourn's user avatar
4 votes

Special Texture Stretching without deformation

So, essentially what you're looking for is 9 Slice Scaling. However that's only good for stretching out a texture so the edges and corners remain undeformed (sort of). The corners are 1:1 in both ...
Draco18s no longer trusts SE's user avatar
4 votes

Are DirectX coordinates spaced out in meters?

They are just Units The units in DirectX (or OpenGL for that matter) does not correspond to any physical measure. For consistency and your mental health, you can define them to be whatever unit you ...
Theraot's user avatar
  • 27k
4 votes
Accepted

HLSL MipMap sampling in pixel shader

Sample calculates the mip level to sample based on screen space derivatives of the texture coordinates provided. Derivatives of texture coordinates can be computed as follows: ...
János Turánszki's user avatar
4 votes
Accepted

How do game engines implement multiple rendering platforms?

Most game engines will have a layer between their rendering abstraction and the actual rendering API. In Unreal and Qt this is called the Rendering Hardware Interface, or RHI. I'm not sure if the ...
Jherico's user avatar
  • 201
4 votes

Can I use DirectXTK12 commercially?

From the license posted in the DirectXTK12 repo: microsoft/DirectXTK12 is licensed under the MIT License: A short and simple permissive license with conditions only requiring preservation of ...
Pikalek's user avatar
  • 12.4k
4 votes
Accepted

Why do a lot of games use DirectX9

The vast majority of game developers today don't deal with graphic APIs like DirectX, OpenGL, Mantle or Vulkan directly. They delegate that to a library or game engine, so they can focus on the fun ...
Philipp's user avatar
  • 120k
3 votes
Accepted

Get the difference between 2 matrices

Your problem is that you're trying to compare floating-point numbers for equality. The matrix inversion and multiplication, however, will inevitable introduce slight rounding errors that will make ...
Ilmari Karonen's user avatar
3 votes
Accepted

DirectX 12: Problem with render target

Start graphics debugging (ALT+F5) your program with visual studio directX graphics diagnostic and capture a frame, then double click on the thumbnail of frame and view your event list and your ...
Pooya Eimandar's user avatar
3 votes
Accepted

How do multiple shaders in a DirectX Engine work?

Might be misunderstanding your question but from the screenshot, it looks like you have a common library of functions to use with your three different shaders: BasicEffect [VS, PS] Brdf [VS, PS] ...
Haywire Spark's user avatar

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