GithubHelp home page GithubHelp logo

zubetto / blackbodyradiation Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 335 KB

The BlackBodyRadiation function approximates luminance and chromaticity of a black body radiation emitted at the given temperature. Approximation errors are not provided, so this function should not be used where computational accuracy is critical! Instead, the primary purpose of this function is to render a black body surface in real time, which can be used in CG shaders, therefore the function is written in HLSL.

License: MIT License

HLSL 100.00%
black-body color-temperature shaders luminance chromaticity

blackbodyradiation's Introduction

Black Body Radiation

The BlackBodyRadiation function approximates luminance and chromaticity of a black body radiation emitted at the given temperature. Approximation errors are not provided, so this function should not be used where computational accuracy is critical! Instead, the primary purpose of this function is to render a black body surface in real time, which can be used in CG shaders, therefore the function is written in HLSL.

The luminance and chromaticity of a black body radiation are computed independently of each other. The alpha-component of returned value is effective radiance in W/(sr*m2), which should be multiplied by 683.002 lm/W to get the corresponding luminance in cd/m2. The rgb-components of returned value are color components expressed in linear sRGB color space. Relative luminance of returned color is close to 1 for temperatures above about 1000 K. Note, that returned color can have negative components, which means that chromaticity of a black body is outside the sRGB gamut for a given temperature (g-component < 0 for temperatures below about 900 K and b-component < 0 for temperatures below about 1900 K). To get final color of a black body radiation with luminance in cd/m2 the rgb-components should be multiplied by the alpha-component and by 683.002 lm/W.

sRGB is defined according to ITU-R BT.709:

chromaticity x y
white point 0.3127 0.3290
red primary 0.64 0.33
green primary 0.30 0.60
blue primary 0.15 0.06

More details about how this approximation was derived can be found here https://www.desmos.com/calculator/qaxw5zb0zc

blackbodyradiation's People

Contributors

zubetto avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.