Skip to content

feat(shaders): added Neupow - #614

Open
XgarhontX wants to merge 1 commit into
clshortfuse:mainfrom
XgarhontX:neupow
Open

feat(shaders): added Neupow#614
XgarhontX wants to merge 1 commit into
clshortfuse:mainfrom
XgarhontX:neupow

Conversation

@XgarhontX

@XgarhontX XgarhontX commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Neupow

Neutwo, but instead of "two", the power is a parameter.
Less optimized for more flexibility.
(x * peak) / pow(pow(x, power) + pow(peak, power), rcp(power))
https://www.desmos.com/calculator/693lgrzm2v

  • When power = 2: Neutwo.
  • When power = 1: Reinhard.
  • When power > 2: Similar to late shoulder ExponentialRolloff / GTSport.
  • When power < 1: Super compressed & mid gray will noticably shift.

Why?

I'm not a colorist so idk the curve's value regarding that.

I stumbled into by trying to luminance compress HDR color input into SDR LUT.
Being able to flexibly blend between Neutwo and Reinhard greatly help shape HDR upgrade coming out!

Also, as a final HDR tonemapper, it's nice to hook up one white clip parameter and let user tune to their heart's content since the power morphs so it much within just 1 - 4.

No gray in/out versions?

The morph makes everything arbitrary anyways.

Optimization

I let AI optimize with log2/exp2.
I've been using the current version for some newer stuff, and it seems good!

float p_over_x_pow_a = exp2(power * (log2(peak) - log2(x)));
return peak * rcp(exp2(log2(1.0f + p_over_x_pow_a) * rcp(power)));

Invert

I didn't do it yet, and idk if it's worth.

@XgarhontX

Copy link
Copy Markdown
Contributor Author

Ok, the log2/exp2 optimization has drawbacks, like really high "probably not going to be used" values causes banding.
Should the accurate pow() functions be used for simplicity & functionality sake?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant