Skip to content

Instantly share code, notes, and snippets.

@kulkalkul
kulkalkul / Unreal-AgX-Tonemapper.usf
Created February 17, 2026 06:32 — 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
@bp2008
bp2008 / windows_font_rendering.md
Created May 14, 2022 05:48
How to change Windows font rendering / cleartype / subpixel antialiasing for displays with BGR, WRGB, and other subpixel layouts.

Purpose

Most computer monitors use an "RGB" subpixel layout, so most computer software (including Windows itself) optimizes its text rendering to look good on this kind of display. However this kind of optimization starts to become undesirable in many situations, where it causes color fringing to appear around text.

Changing font rendering settings in Windows

Method 1: ClearType Tuner

Use the ClearType tuner: Windows > Settings > search: Cleartype

@da-molchanov
da-molchanov / ue4_aces_tonemapping.hlsl
Last active December 1, 2025 09:04
Simple custom ACES tonemapper that approximates the default UE4 filmic tonemapper in 11 instructions.
// Copyright 2021 Dmitry Molchanov and Julia Molchanova
// This code is licensed under the MIT license
// Output type: CMOT float 3
// Input name: LinearColor
// This multiplier corresponds to "ExposureCompensation=1" and disabled auto exposure
const float ExposureMultiplier = 1.4;
const float3x3 PRE_TONEMAPPING_TRANSFORM =
@mgsx-dev
mgsx-dev / BlendingExportDemo.java
Last active February 25, 2021 00:13
How to draw into a FBO with proper blending function and save it to a PNG file
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.PixmapIO;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
// Unity C# Cheat Sheet
// I made these examples for students with prior exerience working with C# and Unity.
// Too much? Try Unity's very good tutorials to get up to speed: https://unity3d.com/learn/tutorials/topics/scripting
@lukz
lukz / PerspectiveGroup.java
Last active June 8, 2016 20:47
Group that allows to change its perspective along X axis (will be very simple to change axis) using orthographic camera and Scene2d. You have to set camera.near = -1000 and camera.far = 1000 on your OrthographicCamera.
package om.mandir.gdx.utils.actors;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Affine2;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.scenes.scene2d.Group;
/**
* Allows to render Group in perspective.
*
@eevee
eevee / perlin.py
Last active May 29, 2025 13:08
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@xoppa
xoppa / PolygonShapeTest.java
Created July 5, 2015 13:05
Shows how to render primitive shapes using Batch, without using ShapeRenderer. Requires at least libGDX 1.6.4 or latest nightly.
package com.badlogic.gdx.tests.g2d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
@staltz
staltz / introrx.md
Last active March 10, 2026 03:48
The introduction to Reactive Programming you've been missing
@subudeepak
subudeepak / WebSockets.md
Last active October 24, 2025 09:19
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t