Skip to content

Instantly share code, notes, and snippets.

View dmitrymatveev's full-sized avatar

Dmitry Matveev dmitrymatveev

  • Auckland, New Zealand
View GitHub Profile
@dmitrymatveev
dmitrymatveev / Unreal-AgX-Tonemapper.usf
Created February 17, 2026 05:11 — 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
@dmitrymatveev
dmitrymatveev / WorldPointerProvider.jsx
Last active April 20, 2025 01:38
Calculates world position from mouse pointer and/or camera direction to a given plane.
import { CameraControls } from '@react-three/drei';
import {
Dispatch,
MutableRefObject,
SetStateAction,
useEffect,
useRef,
} from 'react';
import { Plane, Raycaster, Vector2, Vector3 } from 'three';
@dmitrymatveev
dmitrymatveev / SystemsContainerLite.cpp
Last active September 18, 2024 06:17
Unreal UObject implementing strategy pattern function.
#include "SystemsContainerLite.h"
void UESLSystemsContainer::Execute(UObject* Context, UESLProcess *InCommand)
{
InCommand->Error = NAME_None;
for (TObjectPtr<UESLSystem> ExecutionStep : Systems)
{
if (InCommand->Error != NAME_None)
{
return;
/**
* Removes new lines and tabs and preceding whitespace in a multi-line
* template strings.
*
* E.g.:
* console.log(lineTag`line: ${1}
* line: ${2}
* line: ${3}`); // line: 1 line: 2 line: 3
*
const DELIMITER = /[\W_](\w)/g
export default str => str.replace(DELIMITER, (m, ch) => ch.toUpperCase());
util functions
const HEAD = 0;
const splitCallback = list => [
list.slice(0, list.length - 1),
list[list.length - 1]
];
function next(args, done, ...functions) {
const fnc = functions[HEAD];
function deepMerge(...objects) {
let dest = objects[0];
let target = objects[1] || {};
for(let targetKey of Object.keys(target)) {
let targetValue = target[targetKey];
if (Array.isArray(targetValue)) {
dest[targetKey] = dest[targetKey] || [];
dest[targetKey].push(...targetValue);
@dmitrymatveev
dmitrymatveev / github-deploy.sh
Last active September 29, 2017 02:52
Scripts to manage projects version updates
#!/bin/bash
# ==================================================================================================
# Makes an archive of a pre-built distributable and
# using github REST apiV3 create a release on the current tag and uploads archive.
# This will assume the tag was created with the same name as current version in package.json
#
# Usage:
# github-deploy <archive file path>
# ==================================================================================================
"use strict";
class Signal {
constructor() {
this._callbacks = new Map();
}
add(fnc) {
this._callbacks.set(fnc, {count:0});