Hallucinations re: the rendering of Cyberpunk 2077

Last modified on December 18, 2020

Two curses befall rendering engineers. First, we lose the functionality to gape at actuality with out being constantly reminded of how fascinatingly exhausting it's to resolve mild transport and mannequin supplies.

2nd, in the event you provoke enjoying any recreation, it's probably you may perhaps per likelihood't chorus from making an attempt to reverse its rendering expertise (which is particularly infuriating for multiplayer titles - shut taking pictures at me, I'm acceptable right here to gape how rocks stable shadows!).

So after I purchased Cyberpunk 2077 I needed to gape on the process by which it renders a physique. Or not it's reasonably uncomplicated to raise RenderDoc captures of it, so I had really no excuse.

The subsequent are speculations on its rendering methods, observations made whereas skimming captures, and enjoying just some hours.

Or not it's by no scheme a excessive are attempting at reverse engineering. For that, I lack each the time and the functionality. I additionally rationalize doing a nefarious job at this by the following excuse: or not it's in precise reality higher this suggests. 

I really feel or not it's higher to dream about how rendering (or the leisure really) might perhaps per likelihood be, acceptable with some stage of inspiration from exterior sources (on this case, RenderDoc captures), reasonably than precisely mental what's occurring.

If all of us know, all of us know, there's not very any longer any thriller anymore. Or not it's what we shut not know that makes us disclose, and often we precisely wager what's occurring on, however different circumstances we shut one higher, we hallucinate one thing new... Is not at all times that beautiful?

The subsequent is mainly a learn-by process of of a single raise. I did provoke a second one to raise a have a look at to achieve some blanks, however to this stage, that is all. 

I made the captures at excessive settings, with out RTX or DLSS as RenderDoc does not allow these (but?). I disabled motionblur and different uninteresting post-fx and made positive I modified into as quickly as transferring in all captures to ranking a process to repeat reasonably higher when passes entry earlier physique(s) information.

I'm additionally not relying on insider information for this. Makes all the issues extra easy and further enjoyable.

At a glance, it does not raise extended to characterize the core of Cyberpunk 2077 rendering. Or not it's a traditional deferred renderer, with a quite vanilla g-buffer construction. We originate not scrutinize the crazy amount of buffers of roar, Suckerpunch's PS4 provoke Contaminated:2nd Son, nor complicated bit-packing and re-interpretation of channels.

If we gape on the physique chronologically, it begins with a bunch of UI attracts (that I did not examine additional), a bunch of copies from a CPU buffer into VS constants, then a shadowmap change (additional on this later), and at remaining a depth pre-circulate.

This depth pre-circulate is partial (not drawing the complete scene) and is most attention-grabbing used to decrease the overdraw in the subsequent g-buffer flow into.

Normally, the complete geometry attracts are the instruct of instancing and a few invent of bindless textures. I'd think about this modified into as quickly as a colossal half of updating the engine from The Witcher Three to modern {hardware}. 

Bindless additionally makes it reasonably annoying to gape on the raise in renderDoc sadly - by space-checking I might perhaps not scrutinize too many assorted shaders in the g-buffer flow into - perhaps a designate of not having allowed artists to invent shaders by visible graphs? 

Other wild guesses: I originate not scrutinize any front-to-lend a hand sorting in the g-buffer, and the depth prepass renders each type of geometries, not acceptable partitions, so it might perhaps appear that there's not very any specific authoring for these (brushes, forming a BSP) - nor artists keep hand-tagged objects for the prepass, as some considerably "nefarious" occluders invent the carve. I think about that after culling a list of objects is sorted by shader and from there instanced attracts are dynamically usual on the CPU.

The opening credit standing shut not mark Umbra (which modified into as quickly as utilized in The Witcher 3) - so I wager CDPr rolled out their very possess visibility resolution. Its effectiveness is really exhausting to gauge, as visibility is a GPU/CPU steadiness ranking 22 state of affairs, however there seem like a type of attracts that shut not contribute to the picture, for what's value. It additionally seems to be prefer to be like as if that at circumstances the rendering can mark "hidden" rooms, so it seems to be prefer to be like as if or not it's not a cell and portal process - I'm guessing that for such enormous worlds or not it's impractical to quiz artists to shut a complete bunch e guide work for visibility.

Lastly, I did not scrutinize any culling accomplished GPU aspect, with depth pyramids and hundreds others, no per-triangle or cluster culling or predicated attracts, so I wager all frustum and occlusion culling is CPU-side.

Cover: people are asking if "nefarious" culling is the purpose for primarily the most customary efficiency points, I wager that scheme on ps4/xb1. This inference cannot be accomplished, nor the visibility process can also moreover be known as "nefarious" - as I wrote already. FWIW - it appears largely that consoles battle with reminiscence and streaming additional than the leisure else. Who's acutely aware of...

Let's assist going... After the first g-buffer flow into (which seems to be prefer to be constantly harm up in two - not positive if there might be a rendering purpose or perhaps these are two expose buffers accomplished on assorted threads), there are different passes for transferring objects (which write circulation vectors - the circulation vector buffer is first initialized with digicam circulation).

This flow into entails avatars, and the shaders for these objects shut not instruct bindless (perhaps that is used acceptable for world geometry) - so or not it's highly effective extra easy to scrutinize what's occurring on there if one wishes to.

Lastly, we're accomplished with the first g-buffer passes, depth-writes are modified into off and there might be a closing flow into for decals. Surprisingly these are beautiful "vanilla" as well, most of them being mesh decals.

Decals bind depth-stencil as enter as well, exhausting to repeat if to study the depth half, the stencil, or each, however as most decals are mesh-primarily based totally, depth should gentle not be wanted, so let's wager stencil is what's used right here...

It seems to be prefer to be like as if most attention-grabbing triangles carrying decals are rendered, the instruct of specific decal meshes, however instead of that each one the issues is remarkably uncomplicated. At the tip of the decal flow into we scrutinize typically projected decals as well, I keep not investigated dynamic ones created by weapons, however the static ones on the ranges are acceptable utilized with tight packing containers spherical geometry, I wager hand-made, with none stencil-marking methodology (which may perhaps perhaps doubtlessly not encourage on this case) to raise a have a look at to decrease the shadowy pixels.

As for the first g-buffer attracts, many of the decals can also cease up not contributing the least bit to the picture, and I originate not scrutinize highly effective proof of decal culling (as some little ones are attracts) - on the different hand it additionally also can depend on my chosen settings.

The g-buffer flow into is reasonably heavy, and the tip outcomes are inconceivable. E.g. gape on the commonplace, all the issues has patterns, and in customary, the element is reasonably excessive frequency. 

Cover additionally the speckles in the commonplace buffer. These are seemingly an artifact of most attention-grabbing-match commonplace encoding, as they originate not seem to scheme to speckles in the closing picture.

Lighting fixtures half 1: Analytic lights

Obviously, no deferred rendering analysis can shut on the g-buffer, we harm up shading in two, and now we've to gape on the second half, how lighting is accomplished.

Right right here issues flip into reasonably dicier, as in the customary age of compute shaders, all the issues will get packed into constructions that we'll not simply scrutinize. Even textures can also moreover be exhausting to study after they shut not elevate correct information however pack who-is acutely aware of-what into integers.

Regardless, or not it's beautiful positive that lastly the depth/g-buffer work is alleged and accomplished, a uber-summarization flow into kicks in caring for a bunch of depth-connected stuff. 

It first packs commonplace and roughness right right into a RGBA8 the instruct of Crytek's look up-primarily based totally most attention-grabbing-match commonplace encoding, then it creates a min-max mip pyramid of depth values.

The pyramid is then used to invent what seems to be prefer to be like as if a volumetric texture for clustered lighting.

So - from what I'll scrutinize it seems to be prefer to be like as if a clustered deferred lighting process. 

The clusters seem like 32x32 pixels in present camouflage-screech (froxels), with 64 z-slices. The lighting regardless of the confirmed fact that seems to be prefer to be accomplished at a 16x16 tile granularity, all by compute shader oblique dispatches.

I'd enterprise right here is on legend of CS are really good by each the supplies and lights present camouflage in a tile, after which dispatched accordingly - a commonplace setup in modern deferred rendering techniques (e.g. scrutinize Name of Duty Black Ops Three and Uncharted four shows on the topic).

Analytic lighting flow into outputs two RGBA16 buffers, which seems to be prefer to be diffuse and specular contributions. Relating to the strategies for scene lights, I'd not be shocked if all now we keep are house/stage/sphere lights and line/tablet lights. Most of Cyberpunk's lights are neons, so positively line mild toughen is a should.

Additionally, you'll understand that many of the lighting is unshadowed, and I originate not disclose I ever seen additional than one shadows below a single object/avatar. I'm positive that the engine does not keep limitations in that ingredient, however all this features at lighting that is closely "authored" with artists fastidiously putting shadow-casting lights. I'd additionally not be shocked if the lights keep manually assigned bounding volumes to e guide clear of leaks.


Lighting fixtures half 2: Shadows

But what we acceptable noticed does not suggest that shadows are unsophisticated in Cyberpunk 2077, reasonably the various, there are positively a sequence of strategies which had been employed, most of them in no process simple to reverse!

Initially, ahead of the depth-prepass, there are constantly a bunch of attracts into what seems to be prefer to be like as if a shadowmap. I imagine here is a CSM, however in the raise I really keep checked out, I really keep by no scheme thought of it used, most attention-grabbing rendered into. This features to a device that updates shadowmaps over many frames, seemingly with most attention-grabbing static objects?

These multi-body results are refined to raise, so I can't roar if there are additional caching techniques (e.g. scrutinize the quadtree compressed shadows of Black Ops 3) at play. 

One ingredient that seems to be prefer to be like attention-grabbing is that in the event you poke backwards and forwards fast ample by process of a stage (e.g. in a automobile) you'll ranking a process to scrutinize that the shadows raise some time to "raise up" and so they fade in incrementally in a queer pattern. It virtually seems to be like like there might be a depth offset utilized from the solar stage of leer, that over time will get diminished. Interesting!

Sun shadows are pre-resolved right right into a present camouflage-screech buffer ahead of the lighting compute flow into, I wager to simplify compute shaders and shut elevated occupancy. This buffer is generated in a flow into that binds a type of textures, two of which gape CSM-ish. One is clearly a CSM, with in my case 5 entries in a texture array, the put slices zero to 3 are assorted cascades, however the remaining carve seems to be prefer to be the the similar cascade as carve zero however from a reasonably assorted perspective. 

There might be completely hundreds to reverse-engineer right here if one modified into as quickly as inclined to shut the work!


All different shadows in the scene are some invent of VSMs, computed all once more incrementally over time. I've thought of 512x512 and 256x256 used, and in my captures, I'll scrutinize 5 shadowmaps rendered per physique, however I'm guessing this depends on settings. These type of seem most attention-grabbing dawdle as render targets, so all once more it might perhaps per likelihood be that it takes additional than one frames to originate rendering them. One will get blurred (VSM) right right into a carve of a texture array - I've thought of some with 10 slices and others with 20.


Lastly, now we keep what the sport settings name "contact shadows" - which are present camouflage-screech, quick-vary raymarched shadows. These seem like computed by the lighting compute shaders themselves, which may perhaps perhaps invent sense as these find out about lights and their instructions...

Total, shadows are each uncomplicated and complicated. The setup, with CSMs, VSMs, and optionally raymarching is not overly obedient, however I'm positive the devil is in the element of how all these are generated and dilapidated in. Or not it's unusual to scrutinize evident artifacts, so the complete process needs to be praised, particularly in an initiate-world recreation!

Lighting fixtures half III: Your complete leisure...

Since booting the sport for the first time I had the positive sense that virtually all lighting is constantly not in the invent of analytic lights - and certainly looking on the captures this appears to not be fraudulent. At the the similar time, there aren't any lightmaps, and I doubt there might be the leisure pre-baked the least bit. Right right here is doubtlessly one in each of primarily the most attention-grabbing components of the rendering.

Initially, there might be a very acceptable half-res SSAO flow into. Right right here is computed acceptable after the uber-depth-summarization flow into talked about ahead of, and it makes instruct of the packed RGBA8 commonplace-roughness rather than the g-buffer one. 

It seems to be prefer to be like as if or not it's computing zigzag normals and aperture cones - most unlikely to repeat the true methodology, on the different hand or not it's positively doing a giant job, doubtlessly one thing alongside the strains of HBAO-GTAO. First, depth, commonplace/roughness, and circulation vectors are all downsampled to half-res. Then a flow into computes most customary-body AO, and subsequent ones shut bilateral filtering and temporal reprojection. The dithering sample could be reasonably customary if I needed to wager, doubtlessly Jorge's Gradient noise?

Or not it's simple to wager that the separate diffuse-specular emitted from the lighting flow into is there to invent it extra easy to occlude each additional precisely with the cone information.


2nd, now we should gape at oblique lighting. After the sunshine clustering flow into there are a bunch of attracts that change a texture array of what seem like spherically (or twin paraboloid?) unwrapped probes. Again, right here is disbursed throughout frames, not all slices of this array are up beforehand per physique. Or not it's not exhausting to scrutinize in captures that some half of the probe array will get up beforehand with new probes, producing on the wing mipmaps, presumably GGX-prefiltered. 

The provision of the probe information is tougher to ranking regardless of the confirmed fact that, however in the first raise I'm the instruct of there seems to be prefer to be one thing that seems to be prefer to be like as if a specular cubemap relighting happening, or not it's not evident to me if here is an superb probe from the ones in the array or the present for the array information in a while. 

Furthermore, or not it's exhausting to roar whether or not or not these probes are hand positioned in the stage, if the relighting assumption is obedient, then I'd think about that the areas are mounted, and perhaps artist positioned volumes or planes to stipulate the have an effect on screech of each probe / assist away from leaks.


Now we keep obtained your "commonplace" volumetric lighting, computed in a 3d texture, with each temporal reprojection. The raymarching is clamped the instruct of the scene depth, presumably to avoid wasting efficiency, however this, in flip, can result in leaks and reprojection artifacts at circumstances. No longer too evident regardless of the confirmed fact that in most conditions.

Now, issues carry collectively very attention-grabbing all once more. First, now we keep an is an fabulous Cover-Dwelling Reflection flow into, which all once more makes instruct of the packed commonplace/roughness buffer and thus helps blurry reflections, and by no means not as much as at my rendering settings, is accomplished at fat decision. 

It makes instruct of previous-body color information, ahead of UI compositing for the reflection (the instruct of circulation vectors to reproject). And or not it's reasonably reasonably of noise, regardless of the confirmed fact that it employs a blue-noise texture for dithering!


Then, a oblique diffuse/ambient GI. Binds the g-buffer and a bunch of 64x64x64 quantity textures which are exhausting to decode. From the inputs and outputs one can wager the quantity is centered round the digicam and contains indices to some type of computed irradiance, perhaps spherical harmonics or such. 

The lighting is extraordinarily gentle/low-frequency and oblique shadows should not really thought of on this flow into. This can also even by dynamic GI!

Undoubtedly is volumetric, which has the revenue of being "uniform" throughout all objects, transferring or not, and this coherence reveals in the closing recreation.

And at remaining, all the issues will get composited collectively: specular probes, SSR, SSAO, diffuse GI, analytic lighting. This flow into emits all once more two buffers, one which seems to be prefer to be closing lighting, and a second with what seems to be prefer to be most attention-grabbing the specular components.

And right here is the put we will scrutinize what I acknowledged earlier than all the issues. Most lighting is not from analytic lights! We originate not scrutinize the an identical earlier strategies of the alternate, with a pair of "achieve" lights added by artists (albeit the sunshine carry collectively is certainly very cautious), instead oblique lighting is what makes many of the scene. This oblique lighting is not as "precise" as engines that depend additional closely on GI bakes and complicated encodings, on the different hand it is vitally uniform and regains high-frequency results by the two very obedient advantageous present camouflage-screech passes, the AO and reflection ones.

The present camouflage-screech passes are reasonably noisy, which in flip makes temporal reprojection really primary, and right here is yet one more extraordinarily attention-grabbing ingredient of this engine. Frail knowledge says that reprojection does not work in video games which keep a complete bunch clear surfaces. The sci-fi worlds of Cyberpunk positively qualify for this, however the engineers right here did not carry collectively the pointers and made issues work anyway!

And seemingly, typically or not it's talent to scrutinize reprojection artifact, and the complete shading can keep reasonably of "swimming" in circulation, however in customary, or not it's correct and coherent, qualities that even many engines the instruct of lightmaps can't narrate to keep up. Gentle leaks should not commonplace, silhouettes are typically well shadowy, correctly occluded.

Your complete leisure

There are many different results in the engine we can also not quilt - for brevity and to maintain my sanity. Hair is extraordinarily attention-grabbing, displaying to render additional than one depth slices and inject itself partially in the g-buffer with some pre-lighting and unusual commonplace (unfaithful anisotropic?) enact. Translucency/pores and skin shading is completely yet one more well-known enact I'd not dissect.

Sooner than the physique is over regardless of the confirmed fact that, now we should mark transparencies - as additional magic is going on right here for positive. First, there might be a flow into that appears to compute a lightweight chart, I really feel for all transparencies, not acceptable particles.

Glass can blur irrespective of is in the assist of them, and right here is accomplished with a really good flow into, first rendering clear geometry in a buffer that accumulates the blur amount, then a sequence of compute shaders cease up organising three mips of the present camouflage, and at remaining all the issues is composited assist in the scene.

After the "glass blur", transparencies are rendered all once more, together with particles, the instruct of the lighting information computed in the chart. At the least at my rendering settings, all the issues right here is accomplished at fat decision.


Lastly, the all-mighty temporal reprojection. I'd in precise reality seize to scrutinize the sport with out this, the disagreement ahead of and after the temporal reprojection is reasonably fabulous. There might be just some type of dilated camouflage magic occurring, however to be acceptable, I can't scrutinize the leisure too extraordinary occurring, or not it's fabulous how well it really works. 

Presumably there are some very refined secret

Read More

Similar Products:

    None Found

Recent Content