Skip to content

eirisocherry/relighting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Relighting

An After Effects tool that allows you to quickly relight a scene
Tutorial: https://www.youtube.com/watch?v=RzH9I8wUUOc
Author: https://www.youtube.com/@shy_rikki
Report a bug: https://discord.gg/AAJxThhbBf
Free AE project: https://t.me/works_by_rikki/68
If you wish to donate ❤️: https://boosty.to/shy_rikki

Screenshot_1

Features

  • Point Light
  • Spot Light
  • Rect Light
  • Directional Light
  • Rim Light
  • Ambient Occlusion (edge shadows)
  • Position Pass
  • Normal Pass
  • Normal Remap
  • Clamp (clamps values to 0-1 range)
  • Unmult (removes black)

Requirements

  • After Effects 2019/2021-2025 (The tool doesn't work in AE 2020)
  • NVIDIA GPU that supports CUDA
  • EXR Depth Map
  • Camera Data
  • Normal Pass (Optional)

What can meet the requirements?
Games: CS2, CSGO, COD4 (partially, cuz bad depth)
3D Software: almost any (Blender, Cinema 4D, Unreal Engine 5 etc)

Installation

  1. Download the tool: https://github.com/eirisocherry/relighting/releases
  2. Move r-relighting folder and r-relighting.jsx script to:
    C:\Program Files\Adobe\Adobe After Effects <version>\Support Files\Scripts\ScriptUI Panels
  3. Move Rikki folder that contains plugins to:
    C:\Program Files\Adobe\Common\Plug-ins\7.0\MediaCore
  4. Restart After Effects

Usage

First Steps
  1. Launch After Effects, go to Window, scroll down and open the r-relighting.jsx script
image
  1. Set Rendering Engine to Mercury GPU Acceleration (CUDA)
image
  1. Set project to 32 bit
image
  1. Set expressions engine to JavaScript
image
CSGO & CS2
  1. Record the required layers: game, exr depth, camera
    CSGO Tutorials: https://www.youtube.com/watch?v=PtdO_I-fBRo&list=PLiyMyFJsq2_VbQNn3nL4sYAXbaIQRQsZH
    EXR Depth Guide (10:49): https://youtu.be/NE5nAPHn_P4?list=PLiyMyFJsq2_VbQNn3nL4sYAXbaIQRQsZH&t=649
    CS2 Tutorials: https://github.com/eirisocherry/cs2-editing/wiki
  2. Import layers, camera data and setup an exr depth: https://www.youtube.com/watch?v=FWEqkaiXNM0
  3. Select a depth map and create a setup by pressing [+] button
image
  1. Adjust Depth Settings:
    Depth Black Is Near whether a black color is near on your depth map or not: unchecked
    Depth Far the farthest depth point value: 25000 (the same value you set in EXtractoR effect)
Screenshot_5 Screenshot_4
  1. a) Select Depth Projection depth layer and use Project On Point cursor to select where you want to project an object
    b) Select something from the dropdowm menu, ex: Point Advanced
    c) Press Project and wait a bit... Done!
Screenshot_2 Screenshot_3
COD4

[NOTE]
"Auto Orient" function, Shadows, Ambient Occlusion, Rim Light and Depth2Normal are not going to work correctly, because COD4's depth map has low precision.

  1. Record the required layers
    Tutorial by Politoo: https://www.youtube.com/watch?v=VjyNZsYzVWg
    CODMVM: https://codmvm.com/
Screenshot_1
mvm_output_directory "S:\Screens"      // output directory
mvm_avidemo_fps 0                      // disables default screen recording
mvm_streams_fps 125                    // fps to record layers in
mvm_streams_passes mvm_w mvm_wd mvm_wn // layers: game, depth, normal
mvm_streams_depthFormat 2              // depth format: 2 - rainbow (more precise)
mvm_export_format avi                  // output format must be set to avi, otherwise depth format will not work
mvm_streams_aeExport 1                 // export camera
mvm_streams_aeExport_sun 1             // export sun
  1. Convert the layers using my ftool-converter.bat
    Download: https://github.com/eirisocherry/ftools/blob/main/ftool-converter.bat
    Guide: https://github.com/eirisocherry/ftools/tree/main
  2. a) Download: https://github.com/gmzorz/MVMAETools/blob/main/Support%20Files/Scripts/ScriptUI%20Panels/MVMTools.jsx
    b) Move MVMTools.jsx script to:
    C:\Program Files\Adobe\Adobe After Effects <version>\Support Files\Scripts\ScriptUI Panels
    c) Import the layers, camera data and convert a depth
  3. a) Rename Normal Map to Normal Pass 1
    b) Apply Normal Remap effect to the Normal Pass 1 layer
    c) Copy the settings
Input Is Normalized: `Checked`
X -> -X
Y -> -Z
Z -> -Y
Normalize Output: `Checked`
Screenshot_7
  1. Select a depth map and create a setup by pressing [+] button
Screenshot_8
  1. Adjust Depth Settings:
    Depth Black Is Near whether a black color is near on your depth map or not: unchecked
    Depth Far the farthest depth point value: 4080
image
  1. a) Select Depth Projection depth layer and use Project On Point cursor to select where you want to project an object
    b) Select something from the dropdowm menu, ex: Point Advanced
    c) Press Project and wait a bit... Done!
image image
̷B̷O̷2̷

Sorry. The relighting tool doesn't work with Black Ops 2.
Why? Because its normal map is broken and depth has low precision.

I knew while recording the tutorial that the game had a normal map, but had no clue it was unusable. My bad.


Blender

[NOTE]
"Why would I use the relighting tool with 3d software?" You might ask.
The only benefit I see is quick object placement.
You can easily place nulls and link anything to them: images, overlays, flares and more.

  1. Export and import the camera to after effects: https://www.youtube.com/watch?v=V1ZpQJ2jZ8Q
    Blender Camera Exporter Script: https://github.com/sobotka/blender-addons-contrib/blob/master/io_export_after_effects.py
image

Remember the scale value, it will be used for "Depth Far" parameter later:

image
  1. Render the required layers:
    a) Render settings:
image

b) Color Managment settings (set to your liking):
image

c) Required Layers:
Screenshot_48

  1. Import the layers, setup them and rename as on the screenshots:

Beauty
OpenColorIO plugin: https://www.fnord.com/

image

Normal Pass

image

Depth

image image
  1. Select a depth map and create a setup by pressing [+] button
image
  1. Adjust Depth Settings:
    Depth Black Is Near: checked (yes, visually the depth is white, but because the depth's range is not 0-1, you need to check it)
    Depth Far: 100 (because, when exporting the camera, scale was set to 100)
image
  1. a) Select Depth Projection depth layer and use Project On Point cursor to select where you want to project an object
    b) Select something from the dropdowm menu, ex: Point Advanced
    c) Press Project and wait a bit... Done!
image image
Unreal Engine 5

[NOTE]
"Why would I use the relighting tool with 3d software?" You might ask.
The only benefit I see is quick object placement.
You can easily place nulls and link anything to them: images, overlays, flares and more.

  1. Export UE camera as fbx and import it to Blender: https://www.youtube.com/watch?v=zcAIfq8WfNU
  2. Export Blender camera and import it to After Effects (check the "Blender" category I wrote above)

I haven't tested this workflow yet, but, theoretically, it should work just fine.


Important Notes

  • The script is heavy and may crash your After Effects, but don't worry!
    It automatically saves your project before doing any actions, so even if your AE will crash, you will not lose any of your progress
  • During the process AE may freeze time by time, don't panic, just wait. It happens because light effects have hundreads of parameters and expressions, AE needs some time to process them.