RSSAmplifier

Blog

coding adventures

astralcode.blogspot.comRSS feed ↗25 posts

Latest posts

Reverse engineering the rendering of The Witcher 3, part 21 - the painted world

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . If you have played " Hearts of Stone " expansion pack you might recall one of quests when Geralt finds himself in so-called "painted world". What is special about it is it looks much different than the "normal" world. The following two screenshots present the game before and after this effect is applied. This…

Reverse engineering the rendering of The Witcher 3, part 20 - light shafts

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . In this 20th (wow) post I am going to cover how the "Light Shafts" (aka crepuscular rays, God rays, sunbeams...) effect from "The Witcher 3: Wild Hunt" works. I focus not only on presenting the idea of the algorithm, but also provide the game-specific implementation details, code snippets and a Shadertoy the…

Reverse engineering the rendering of The Witcher 3, part 19 - portals

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . If you have played The Witcher 3 for long enough, you know that Geralt is not a huge fan of portals. Let's find out if they are really that scary. There are two types of portals in the game: Blue portal Fire portal I will explain how the fire one is built. It's mostly because its code is simpler comparing to…

Reverse engineering the rendering of The Witcher 3, part 18 - color grading

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . One of the postfx effects you can encounter pretty much everywhere in The Witcher 3 is color grading (aka color correction). The idea is to use a lookup table (LUT) texture to map one color set to another. A usual workflow looks like this: there is a neutral (output color = input color) lookup table, which is…

Reverse engineering the rendering of The Witcher 3, part 17 - the Milky Way

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . In the previous post I explained how shooting stars are implemented in The Witcher 3. That effect doesn't appear in "Blood & Wine". In this post I'm going to cover an effect which is exclusive to that DLC: the Milky Way Here is a video which presents Milky Way in the action. And a few screenshots: (1) before…

Reverse engineering the rendering of The Witcher 3, part 16 - shooting stars

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . In "The Witcher 3" there is a subtle yet nice detail in the sky - shooting stars. Interestingly, they don't seem to appear in "Blood & Wine" DLC. Check out the video to see them in action: Let's find out how this effect was achieved. As you can notice, the head of a shooting star is much brighter than its…

HLSLexplorer 1.01 - UI improvements and D3D12 rendering backend

Hi, A new version of HLSLexplorer, 1.01 is done and available to download from here (Google Drive). The executable is working on Windows 10 and was built against Windows 10 SDK 10.0.17763.0. If you would to like to play with source, it's on GitHub . Let's go briefly through the most important changes: 1) Recent Files List Quite self-explanatory. I've been wasting too much time because of looking…

Reverse engineering the rendering of The Witcher 3, part 15 - fog

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Fog can be implemented in many ways. However, times when we could apply simple distance-based fog and be happy with it are gone forever (probably). Living in a land of programmable shaders opened us doors to new, crazy, but most importantly - physically-correct and visually plausible solutions. Current trend…

Reverse engineering the rendering of The Witcher 3, part 14 - cirrus clouds

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . When it comes to being outdoor, sky is one of these aspects which decide if the world in a game is believable. Think about that for a while - sky literally takes, let's say, 40-50% of whole screen for most of the time. Sky is a lot more than just nice gradient. We have stars, the Sun, the Moon and, finally,…

Reverse engineering the rendering of The Witcher 3, part 13c - witcher senses (fisheye effect & final combining)

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome! This is the last part of reverse engineering witcher senses effect from The Witcher 3: Wild Hunt. Quick look on what we have now: in the first part full-screen intensity map was generated which tells how visible effect will be depending on distance. In the second part I investigated "outline map" in…

Reverse engineering the rendering of The Witcher 3, part 13b - witcher senses (outline map)

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome, This is the second part of demystifying Witcher Senses effect from The Witcher 3: Wild Hunt. Once again, example scene we are working on: In the first post I showed a bit how "intensity map" is being generated. We have one full-resolution R11G11B10_FLOAT texture which can look like this: The green…

Reverse engineering the rendering of The Witcher 3, part 13a - witcher senses (objects & intensity map)

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome back! So far, almost every effect/technique explained in this series was not really Witcher 3-related. I mean, you can find things like tonemapping , vignette or calculating average luminance almost in every modern video game. Even drunk effect is something quite widespread. That's why I decided to…

Reverse engineering the rendering of The Witcher 3, part 12 - stupid sky tricks

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome, This part will be slightly different comparing to the previous ones. Today I'd like to show you some aspects of sky shaders from The Witcher 3. Why some "stupid tricks" instead of full shader? Well, there are a few reasons. First of all, sky shader in The Witcher 3 is quite a complex beast. Pixel…

Reverse engineering the rendering of The Witcher 3, part 11 - lightnings

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome back! In the 11th part of the series we will take a look how lightnings are rendered in The Witcher 3: Wild Hunt. Following the distant rain shafts effect, lightnings are rendered slightly after, but still in forward pass. You can see them in action in the following video: They last for a very short…

Reverse engineering the rendering of The Witcher 3, part 10 - distant rain shafts

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome to the 10th part of the series! Woohooo! :) See previous parts here . This time we will take a look at really cool atmospheric effect I really like - distant rain/light shafts near the horizon. The easiest way to encounter them in the game is visiting Skellige Islands. Personally I really love such…

Reverse engineering the rendering of The Witcher 3, part 9 - GBuffer

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome, This is the ninth part of my series about rendering in The Witcher 3. Click here for full index. In this part I will show some details about geometry buffer (gbuffer) in The Witcher 3. I assume here that you know the basics of deferred shading. Quick recap: the idea is to, well, defer rendering by not…

Reverse engineering the rendering of The Witcher 3, part 8 - The Moon and lunar phases

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome, In the 8th part of this series I will investigate the Moon shader from The Witcher 3 (more specifically, from "Blood and Wine" expansion pack). The Moon is an important element of night sky and can be quite challenging to make it believable, but in TW3 for me it's just a pleasure to walk around during…

Reverse engineering the rendering of The Witcher 3, part 7b - average luminance (calculation)

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome, This is the second part of demystifying calculating of average luminance in "The Witcher 3: Wild Hunt". Being familiar with the first part is highly recommended. Before we start the battle with another compute shader, let's do a quick recap of what happened previously: We were working on 1/4x1/4…

Reverse engineering the rendering of The Witcher 3, part 7a - average luminance (histogram/distribution)

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome, Calculating average luminance of current frame can be found in virtually any modern video game. Such value is often used later by eye adaptation and tonemapping . Simple approaches include calculating luma to, let's say, 512 2 texture and calculating its mips and using the last one. This usually…

Reverse engineering the rendering of The Witcher 3, part 6 - sharpen

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Hi, Today we will take a closer look at another postprocess from The Witcher 3 - sharpen. Sharpening makes an output image a bit crisper. The effect is known from Photoshop and other image editors. In The Witcher 3 sharpening has two presets: low and high. I will discuss differences between them later, let's…

Few words about HLSLexplorer

Welcome, HLSLexplorer started as a hobby project (which still is!) and was never meant to be "Godbolt for shaders" nor any "competition" for already available solutions (see Shader Playground by Tim Jones for example). I just realised during its development that someone might find it useful - that's all. Today I am happy to say that new version of HLSLexplorer is done and now it's open source!…

Reverse engineering the rendering of The Witcher 3: Index

Welcome, This is the index page for my "Reverse engineering the rendering of The Witcher 3" small series where I select some rendering techniques from "The Witcher 3", analyze them using RenderDoc , then grab DirectX assembly for shaders and finally try to turn these instructions back to readable HLSL shader. I focus especially on understanding and explaining presented techniques; it's all for…

Reverse engineering the rendering of The Witcher 3, part 5 - drunk effect

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Hi, Let's take a look how drunk effect is implemented in The Witcher 3: Wild Hunt. If you haven't played it yet, drop anything you're doing, buy it and play it see these videos: Evening: Night: At first we see "double rotating" image, pretty common when you're not sober in real life. The more distant the pixel…

Slides from "Witcher Tricks" are available

Hi, In case you missed it - you can grab slides from my presentation about rendering in The Witcher 3 from here (in Polish and Engish; also with notes). The presentation covers general rendering pipeline of a single frame and more detailed description of a few techniques, including storing normals in gbuffer, the Sun, blinking stars, tonemapping and vignette. Mateusz

Reverse engineering the rendering of The Witcher 3, part 4 - vignette

This post is a part of the series "Reverse engineering the rendering of The Witcher 3" . Welcome back! This time we are going to understand and reverse engineer vignette used in The Witcher 3: Wild Hunt. Vignette Vignetting is one of the most widespread postprocessing effects used in games. It's popular in photography as well. Subtly darker corners can produce nice looking effect. There are few…