Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
19 votes
Accepted

Performance of Compute Shaders vs. Fragment Shaders for Deferred Rendering

After more analysis, the TL;DR here is that, yes, the slowdown is due to memory locality, and yes the pixel order is to blame. More interestingly, by writing the shader differently, we can greatly ...
geometrian's user avatar
  • 1,990
7 votes
Accepted

Unlit objects in deferred rendering

Typically in a deferred engine, you would render unlit objects directly to the color buffer, bypassing the lighting system entirely. You would likely also output zeroes to the G-buffer so that ...
Nathan Reed's user avatar
5 votes
Accepted

Why is this not a proper solution to handling transparency in deferred rendering?

PaulHK is right in what he said: you have to consider that there may be more than 2 transparent objects behind each other. Also, the idea of deferred shading is to render the geometry only once to be ...
Tare's user avatar
  • 1,566
4 votes
Accepted

GBuffer: Framebuffer with different texture format types?

You have a bit of a misunderstanding there. The paragraph you quoted doesn't actually say anything about framebuffer objects yet. It just talks about a single texture. While we usually understand a ...
Christian Rau's user avatar
4 votes
Accepted

Supporting multiple camera types in a deferred renderer without specializing the shaders or in the shaders

Projective transformations (represented by 4×4 projection matrices) are invertible. You can go from NDC coordinates back to view space using the inverse of the projection matrix, in the same way that ...
Nathan Reed's user avatar
4 votes
Accepted

How much precision do I need in my G-Buffer?

First of all, you don't need position in the G-buffer at all. The position of a pixel can be reconstructed from the depth buffer, knowing the camera setup and the pixel's screen-space xy position. So ...
Nathan Reed's user avatar
4 votes

Screenspace Normals - Creation, Normal Maps, and Unpacking

How are screenspace normals created, and is this step before or after using normal maps or bump maps? They are created after using normal maps. In deferred rendering, you write to the various buffers ...
aces's user avatar
  • 1,353
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
3 votes

Screenspace Normals - Creation, Normal Maps, and Unpacking

I'm trying to condense my Deferred Rendering G-Buffer. So I have some questions about getting 2-component Screenspace Normals. I know Frostbite and Killzone (the only two AAA company's G-Buffers I ...
Fred Garnier's user avatar
2 votes
Accepted

How to use shadow mapping and deferred rendering to create a large amount of lights?

Deferred rendering does not have an asymptic complexity of O(lights+fragments). It has a complexity of O(fragments+visibleFragments*lights). What you are doing in deferred rendering is preventing ...
Sebastián Mestre'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
1 vote

Is fragment shader run on fragments that are outside of rasterized geometry?

Broadly speaking, the way to deal with this is to check the depth value for that position on the screen. If the value is the value you cleared the depth buffer to, then you didn't write anything to ...
Nicol Bolas's user avatar
  • 9,832
1 vote

GLSL Debugging Volumetric light

This question is a bit too broad to answer, but I'll try. Right now you have a screenshot and you are not really sure whether it's correct or not, and if it turns out it is not, it will be difficult ...
Julien Guertault's user avatar
1 vote

Why is this not a proper solution to handling transparency in deferred rendering?

A fundamental assumption of deferred shading is that there will be only one surface, and therefore only one depth, at a given pixel. An effect that contradicts that assumption will require some sort ...
Julien Guertault's user avatar
1 vote

Supporting multiple camera types in a deferred renderer without specializing the shaders or in the shaders

For completeness (and in addition to Nathan Reed's answer), I explicitly add the inverse projection matrices for perspective and orthographic cameras. Perspective Camera $$\begin{align} \mathrm{T}_{...
Matthias's user avatar
  • 1,074
1 vote
Accepted

Volumetric Obscurance : line integrals

This is based on the formula for a sphere that expresses its surface $z$ as a function of $x, y$: $$z(x, y) = \pm\sqrt{r^2 - x^2 - y^2}$$ So, if $x, y$ is the vector from the sphere's center to your ...
Nathan Reed's user avatar

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