Skip to content

Instantly share code, notes, and snippets.

View mazelines's full-sized avatar

jplee mazelines

View GitHub Profile
@mazelines
mazelines / Unreal-AgX-Tonemapper.usf
Created June 1, 2025 15:10 — forked from nxrighthere/Unreal-AgX-Tonemapper.usf
AgX tonemapping for Unreal Engine 5
// See image comparison https://imgur.com/a/9L2P7GJ
// Read details https://iolite-engine.com/blog_posts/minimal_agx_implementation
// Usage:
// 1. Open "Project Settings" and change "Working Color Space" to "sRGB / Rec709"
// 2. Open `Engine\Shaders\Private\PostProcessTonemap.usf` file
// 3. Find `half3 OutDeviceColor = ColorLookupTable(FinalLinearColor);` line
// 4. Replace it with `half3 OutDeviceColor = ApplyAgX(FinalLinearColor);` line
// 5. Find `half3 ColorLookupTable( half3 LinearColor )` function
// 6. After the scope of the function, add the code below and run `RecompileShaders Changed` from console
@mazelines
mazelines / ShaderStripper.cs
Created March 4, 2024 09:40 — forked from yasirkula/ShaderStripper.cs
Stripping commonly unused shader variants in Unity's built-in render pipeline
//#define SHADER_COMPILATION_LOGGING
//#define SKIP_SHADER_COMPILATION
using System.Collections.Generic;
using UnityEditor.Build;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
public class ShaderStripper : IPreprocessShaders
Shader "Skin Clip Alpha" {
Properties {
_MainTex ("Albedo(RGB) , Roughness(A)", 2D) = "white" {}
[HDR]_Color ("BaseColor", Color) = (1,1,1,1)
[HideInInspector]_Specular ("Specular", Range(0, 1)) = 0.28
_Roughness ("Roughness", Range(0, 1)) = 0.5
[NoScaleOffset]_SurfaceTangentMap ("Normal Map", 2D) = "bump" {}
_OcclusionStrength ("Occlusion", Range(0, 1)) = 0.8
_Reflection ("Reflection", Range(0, 5)) = 1
[Header(SKIN BRDF)]
//Propertices related of Tone map.
[Header(TONE MAPPER)]//// Neutral tonemapping (Hable/Hejl/Frostbite)
[Toggle] _toggleToneMapper("Tone Mapper" , FLOAT) = 0
_a("Segment A" , Range(0.1, 1)) = 0.2
_b("Segment B" , Range(0.1, 1)) = 0.29
_c("Segment C" , Range(0.1, 1)) = 0.24
_d("Segment D" , Range(0.1, 1)) = 0.272
_e("Segment E" , Range(0.01, 0.1)) = 0.02
_f("Segment F" , Range(0.1, 1)) = 0.3
_WhiteLevel("ToneMappe White Level" , Range(1.3, 5.3)) = 2.3
#if _USESUBLIGHT
static bool _UseSubLight = true;
#else
static bool _UseSubLight = false;
#endif
uniform half _SubLightScale;
#if USE_SECOND_DIRECTIONAL_LIGHT
@mazelines
mazelines / dishonored2_cvars.txt
Created November 16, 2021 08:54 — forked from fakuivan/dishonored2_cvars.txt
All cvars for Dishonored 2 as of version ``1.77.9.0``, in the format: <cvar struct address> | <cvar name> = <cvar default value> | <cvar int value address> -> <current int value>\n<cvar description>
Dishonored2.exe+3BFC7F0 | aas_subdivisionSize = 64 | Dishonored2.exe+3BFC818 -> 64
the size of subdivisions to use for debug drawing
Dishonored2.exe+340CC20 | achievements_Verbose = 0 | Dishonored2.exe+340CC48 -> 0
debug spam for achievements
Dishonored2.exe+3BFA570 | ai_debugCam = 0 | Dishonored2.exe+3BFA598 -> 0
enable debug camera
Dishonored2.exe+3BFA470 | ai_debugScript = -1 | Dishonored2.exe+3BFA498 -> 4294967295
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field)]
public class MinMaxSliderAttribute : PropertyAttribute
{
public readonly float max;
public readonly float min;
@mazelines
mazelines / BuildConfiguration.xml
Created April 26, 2020 15:31
UE4 Disable to UnityBuild Configuation
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<bUseUnityBuild>false</bUseUnityBuild>
<bUsePCHFiles>false</bUsePCHFiles>
</BuildConfiguration>
</Configuration>
@mazelines
mazelines / UE4-build.bat
Created April 26, 2020 15:19 — forked from drewsberry/UE4-build.bat
UE4 Windows command line building
:: Build client
RunUAT BuildCookRun -project="full_path.uproject"^
-noP4 -platform=Win64^
-clientconfig=Development -serverconfig=Development^
-cook -allmaps -build -stage^
-pak -archive -archivedirectory="Output Directory"
:: Cook client
RunUAT BuildCookRun -project="full_project_path_and_project_name".uproject^
-noP4 -platform=Win64^
Shader "ASE_DualMatcap"
{
Properties
{
_FrontParaboloid ("_FrontParaboloid", 2D) = "white" { }
_RearParaboloid ("_RearParaboloid", 2D) = "white" { }
_Albedo("Albedo", 2D) = "white" {}
_Float0("Float 0", Range( 0 , 2)) = 1
[HideInInspector] _texcoord( "", 2D ) = "white" {}