Giter Site home page Giter Site logo

metaledr-ios's Introduction

MetalEDR-iOS

Demo of using Metal to render EDR/HDR content on iOS platform.

screenshot

How it works

This demo uses a hack to activate EDR display on iOS platform:

Then we can use Metal with a Float Point pixel format to output EDR contents.

Limitation

The "EDR trigger" hack basically has the same effect with metalLayer.wantsExtendedDynamicRangeContent = YES;,

But we still missing APIs like -[NSScreen maximumExtendedDynamicRangeColorComponentValue], so it's very hard to apply appropriate tone-mapping within Metal rendering process.

This demo outputs the raw pixel values loaded by CoreGraphics without applying any tone-mapping, so the colors will clip at current EDR max value and may seems off.

Credit

metaledr-ios's People

Contributors

naituw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

metaledr-ios's Issues

Better workaround

Hey,

Thank you so much for sharing this demo!

I was playing a lot with this and found that there is an easier way to enable EDR on the MTKView:
The wantsExtendedDynamicRangeContent property is actually there on iOS as well, just not public. So you can just use KVO to enable EDR rendering:

[self.layer setValue:[NSNumber numberWithBool:YES] forKey:@"wantsExtendedDynamicRangeContent"];

No need to add a hidden AVPlayerLayer anymore. ๐Ÿ™‚

Similarly, you can also query the EDR properties of the screen:

[[UIScreen mainScreen] valueForKey:@"extendedDynamicRangeCurrentHeadroom"];
[[UIScreen mainScreen] valueForKey:@"extendedDynamicRangePotentialHeadroom"];
[[UIScreen mainScreen] valueForKey:@"extendedDynamicRangeReferenceHeadroom"];

I hope that helps. Thanks again!

iOS 15.4

This technique no longer works on iOS 15.4 you need to set wantsExtendedDynamicRangeContent like mentioned in issue #1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.