Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tonemappers: AgX and Tony McMapface #3475

Closed
wants to merge 1 commit into from

Conversation

makinori
Copy link

I've spent the last year playing with many different tonemappers to try to get Second Life to look as beautiful as possible, especially with PBR being live now. I've been working on this for quite a while.

The AgX tonemapper stood out to me because it's the default in Blender and precedes Filmic, which has issues with bright lights turning unrealistically saturated. As far as I know, it's the more mathematically correct tonemapper out of the two I've added. Any Blender user will immediately recognize the name and thus art made in Blender and brought into Second Life can now look more 1 to 1 which may be desirable. It's a good tonemapper and I prefer it over ACES or Khronos PBR Neutral.

Tony McMapface is an interesting tonemapper. It tries to stay close to linear whilst also being carefully tuned for our perceptual phenomena. It's not as mathematically correct as AgX, but in my personal opinion, it's simply stunning how it can really bring out a well built sim. I've been using this tonemapper in many other projects and absolutely love using it. I really do think it's worth considering. I've certainly enjoyed taking screenshots with it and others have asked me how I get the colors to look so nice. https://github.com/h3r2tic/tony-mc-mapface

I used the AgX implementation recently added to Godot as it's a near perfect approximation using sigmoid curves instead of lookup tables. godotengine/godot#87260

Unfortunately Tony McMapface requires a lookup table, but I've added tonemapTex as a shader uniform to potentially use in the future. I also had to fit the LUT (originally in 48x48x48), into a power of two texture which is a little awkward, but it seems to have no consequences. I'll include the script I made which creates the SL compatible LUT image. godotengine/godot#97095

1_aces 1_agx 1_tonymcmapface

1

2_aces 2_agx 2_tonymcmapface

2

3_aces 3_agx 3_tonymcmapface

3

I would prefer not to disclose the sim location.

I personally really like how Tony McMapface looks, however AgX can be a really good base to color correct with and I'm sure many residents would appreciate it.

Thank you all for the wonderful changes in Second Life. I'm always trying to improve the software some way or another and absolutely love keeping up with the development.

@makinori makinori changed the title Add more tonemappers: AgX and Tony McMapface Add tonemappers: AgX and Tony McMapface Jan 24, 2025
@makinori
Copy link
Author

makinori commented Jan 24, 2025

The script for creating the LUT image uses Deno. Input texture can be found here https://github.com/SergeyMakeev/tony-mc-mapface-fuse

deno run --allow-read --allow-write tony-mcmapface-generator.ts

#!/usr/bin/env -S deno run --allow-read --allow-write

import { Jimp } from "npm:jimp";

// make 48x48x48 fit into power of 2

// https://github.com/h3r2tic/tony-mc-mapface
// png from https://github.com/SergeyMakeev/tony-mc-mapface-fuse
const image = await Jimp.read("TonyMcMapfaceLUT.png");

const newImage = new Jimp({
	width: 512,
	height: 512,
	color: 0x000000ff,
});

const splitEvery = 6;

for (let z = 0; z < 48; z++) {
	for (let y = 0; y < 48; y++) {
		for (let x = 0; x < 48; x++) {
			const color = image.getPixelColor(z * 48 + x, y);

			var yIndex = Math.floor(z / splitEvery);

			let newX = (z - splitEvery * yIndex) * 48 + x;
			let newY = y + 64 * yIndex;

			// flip y
			newY = newImage.height - newY;

			newImage.setPixelColor(color, newX, newY);
		}
	}
}

Deno.writeFile(
	"TonyMcMapfaceLUTPacked.png",
	await newImage.getBuffer("image/png"),
);

@Geenz
Copy link
Collaborator

Geenz commented Jan 29, 2025

Hey there! Thank you for the PR.

At this time, we will not be incorporating this. We're still considering the overall direction we want to take tonemapping in the viewer, including the specific tonemapping options and parameters we want to expose to our residents and content creators.

We will revisit this, either in concept or this PR specifically, in the future once we've settled on a plan for the future of tonemapping in the viewer.

@Geenz Geenz closed this Jan 29, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants