---
description: Here we will go over one of the first steps to visual modding, editing LUTs!
---

# Editing LUTs

## What is a LUT?

The term LUT has its origins in mathematics, where a Look-Up Table would be able to shorten certain math operations by containing readily-calculated values for any input value, or an operation for an input value for a desired outcome. This shortcut was quite efficient and sped up many operations, and was normally designed as a matrix of different numbers and variables. Soon enough, this improvement in speed would be applied in many other fields, and eventually reached computer graphics and film production.

LUTs are essentially a texture or text file containing **every single possible color** that can be displayed, and the transformation of an input color into an output color through it.

### Cyberpunk's use of LUTs

There are many different types of color-grading-related LUTs, such as `.CUBE` files and `.3DL` files, but video games often use a texture.

Initially, Cyberpunk took an approach like many other games, and encoding the LUT as an unwrapped 3D texture:

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2F3cSU7ZuQ282QFjTWNUsO%2Fimage.png?alt=media&#x26;token=925549ea-4bfd-442f-a2cb-4f73ddb10e77" alt=""><figcaption><p>"3D" LUT texture from ReShade project.</p></figcaption></figure>

Afterwards, Cyberpunk would repackage LUT textures with the blue and green channels inverted to get higher quality, as the human eye values green more than other colors and is more efficient to get all gradients laid on top of green instead of blue. _**Here we can safely assume is where the switch to using true 3D textures was also made, but we will not show a 3D texture due to redundancy and inability to do so, so just assume from now on all textures are actually just a 3D cube.**_

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FN6fAzayFTQ2qGvCcu83V%2Flut_gb_inv.png?alt=media&#x26;token=dbe10086-96f9-470b-bb62-5927355caba7" alt=""><figcaption><p>An edited version of the ReShade project's "3D" LUT texture to show the G-B inversion.</p></figcaption></figure>

To get even more odd, Cyberpunk would then put the image tone mapping, the process in which HDR colors are processed into SDR, inside of the LUT! **This came with the conversion from using a normal sRGB transform, which is industry standard, to using an input of ARRI LogC1 and outputting a linear color which is afterwards processed into normal sRGB gamma by the linear tonemapping.**

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FC6hos6M2yr0T2QutEaEv%2Fcp2077_gen_lut_nge_v017.png?alt=media&#x26;token=48017b07-7d30-448b-a04d-929cc35d2c75" alt=""><figcaption><p>The actual base-game LUT with tonemapping applied within. You can see the reason why there is so little highlight fidelity in SDR now! It all just gets mapped to white!!!</p></figcaption></figure>

## Editing base-game LUTs

With all that backstory done--how do we start?!

You'll need [WolvenKit](https://github.com/WolvenKit/Wolvenkit/releases), [NVIDIA Texture Tools Exporter + its Photoshop plugin](https://developer.nvidia.com/nvidia-texture-tools-exporter), and we also require Adobe Photoshop CS4 or later. Photoshop CC is preferred.

### **Okay, now we can get started!**

Create a new WolvenKit project and call it whatever you want.&#x20;

<div align="center"><figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FPYhybZbfb9N2mH3asGOx%2Fcreate_project.png?alt=media&#x26;token=596ca523-dec6-490c-904b-b98783d28bdf" alt=""><figcaption></figcaption></figure></div>

After that, import the file `base\weather\24h_basic\luts\cp2077_gen_lut_nge_v017.xbm` into your project.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2F5xHRILfGma3RoR25FoYL%2FUntitled-2.png?alt=media&#x26;token=52e504f9-893b-4f2d-b4a2-8aa05530a4ec" alt=""><figcaption><p>(Double clicking the file also works)</p></figcaption></figure>

Then open it, and change `depth` to `1`, `height` to `32`, and `width` to `1024`. After that, navigate to **`renderTextureResource/renderResourceBlobPC/header/sizeInfo`** and apply the same edits as before.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FyyxbS5MJQcCWLMXbzFdT%2Fapply_edits.png?alt=media&#x26;token=aa6d56ac-e1a2-4d36-a9b7-2782f35dc7ad" alt=""><figcaption></figcaption></figure>

Export the file into a DDS...

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FpYaqJaJmeJFUwaXu1AMN%2Fexport_dds.png?alt=media&#x26;token=5325fd25-4cfd-49d9-9076-fcbb08b449f8" alt=""><figcaption></figcaption></figure>

Open it up in Photoshop and... _voila!_

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FTU2CMX9TvD7C0Ux2aNs8%2FScreenshot_20230126_071905.png?alt=media&#x26;token=b5bdcdbe-05e9-481f-b544-e87b80a494ee" alt=""><figcaption></figcaption></figure>

We now successfuly have the 32-bit HDR LUT imported into Photoshop. You can do any color correction here, or do some ReShade edits in-game and then put that into a LUT image and then use a Photoshop plugin to import it and apply it ontop of this LUT. Make sure you _**DO NOT**_ simply replace this image with your exported LUT from ReShade or some other editing app, as you will completely ruin the tone mapping the base-game does. I recommend DaVinci Resolve as well and then exporting as as `.CUBE` file from inside of it.

**When you edit your LUT, make sure you flip the vertical axis (make it upside down) inside of Photoshop!**

### Re-importing your edited LUT.

**Let's say I just did some curves tweaking and contrast, etc., etc. Maybe make the green saturation lower and other saturation higher to get rid of the green tint. Now what?!**

Save back your DDS using NVTT and apply these settings:

* **Format: `32x4f RGBA 128bpp | floating-point`**
* **Generate Mipmaps: OFF**
* **Image Options - Compression Quality: Highest**

**If you forgot to flip your image inside of Photoshop, turn on the Image Options - Flip Vertically option inside of NVTT.**

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FsyIwRv4p4y9Y6ulkqjwU%2Fimage.png?alt=media&#x26;token=1af95d32-23f7-4f61-8f4b-5d1033bb37cd" alt=""><figcaption></figcaption></figure>

#### **Wolvenkit:**

* Open the Wolvenkit project where you have the original LUT of the game in `.xbm`&#x20;
* Take your newly made LUT and name it the same as the original LUT, so: `cp2077_gen_lut_nge_v017.dds`.
* Move it to the folder where you exported the original LUT from the game in `.dds` format, and overwrite that one with yours.&#x20;
* The folder in question is: `yourwolvenkitprojectname\source\raw\base\weather\24h_basic\luts`.&#x20;
* You can also open the exact location from the 'Project explorer' in Wolvenkit. Under 'raw' folder dropdown you should see the exported `.dds` file. If you hover over it, it will show a yellow folder button that you can click to open its location.

&#x20;![](https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FdG9kovikgk0SNQUFoeQu%2Fimage.png?alt=media\&token=b2d9eb06-a4bf-4b7b-848c-9944ef7467ca)

* Now to import it, hover over 'Tools' at the top left in Wolvenkit, and select 'Import Tool'.
* Select the LUT and make sure the import settings are correct



<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FvGBJ44zQreVfRvaAbcA0%2Fimage.png?alt=media&#x26;token=510a1a7c-f588-429f-9ea9-a063be305ba6" alt=""><figcaption><p>(LUT Import Settings)</p></figcaption></figure>

**Changing the settings back:**

* When your LUT imports, double click on the `.xbm` file to open it in an editor.&#x20;
* Then change: depth and width in both sections that we modified, back to the default of 32.&#x20;
* Under `renderTextureResource>renderResourceBlobPC>Header>mipMapInfo>0>layout` change 'rowPitch' to '512'.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fn2Ydwvvj00MOYvepfFrR%2Fimage.png?alt=media&#x26;token=6a6ed254-f2fb-4c12-93ef-28f160744137" alt=""><figcaption><p>(rowPitch Settings)</p></figcaption></figure>

* Under `renderTextureResource>renderResourceBlobPC>Header>textureInfo` change 'type' to 'TEXTYPE\_3D'.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FanzDw7o4aCXvQFz0CWeu%2Fimage.png?alt=media&#x26;token=44fe274f-8518-43f4-8570-bfe7dadba8db" alt=""><figcaption><p>(textureInfo Settings)</p></figcaption></figure>

That's it, now either use 'Pack mod' to pack the mod and have .archive file in the Wolvenkit project folder, or 'Install Mod' to preview it in game!&#x20;

This will replace the sdr LUT for the base game (Night City).&#x20;

I**f you want the LUT to also apply to Dogtown, or HDR:** `cp2077_gen_lut_nge_hdr_v017` is HDR lut. `cp2077_gen_lut_ep1_sdr_v02b` and(?) `cp2077_gen_lut_ep1_sdr_v002`is Dogtown.&#x20;

If you want to change these as well, before importing you have to have the paths for these LUTs correct, along with the names.&#x20;

To achieve this with ease, I suggest exporting the LUTs you want replaced, as they will create paths and give you the names by default.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FOKpFTIBerM6bIr6QlSf3%2Fimage.png?alt=media&#x26;token=72498caa-2b51-4d7c-9db2-9fbe1343c015" alt=""><figcaption><p>(LUTs I exported for replacement)</p></figcaption></figure>

Then you can go over to their locations, copy your LUT `.dds` file, copy the name of the LUT you want to replace, delete the original and overwrite it with yours while making sure it retains the name from the original. Rinse and repeat. Process for importing and adjusting the settings afterwards will be the same as before.&#x20;



## Results!

| Before                                                                                                                                                                                                                                                                         | After                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FluS8hE8LuWujPQHPTZoc%2Fphotomode_26012023_200639.png?alt=media&#x26;token=a0e6d3a5-d364-4c06-b65d-de421f4e818a" alt="" data-size="original"> | ![](https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2FQGXIcxXrEX3zzAI6syjW%2Fphotomode_26012023_200249.png?alt=media\&token=6b6cbb3d-3422-48d9-97ec-606c84c51e16) |
| As you can see, vanilla's red saturation leaves more to be desired.                                                                                                                                                                                                            | After our edits the red saturation is a lot better and the contrast is more satisfying!                                                                                                                                                 |
