We get it. We use ad blockers too. But GameDev.net displays them so we can continue to be a great platform for you.
Please whitelist GameDev.net and our advertisers.
Also consider a GDNet+ Pro subscription to remove all ads from GameDev.net.
Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 03 June 2012 - 12:17 PM
Posted 04 June 2012 - 05:26 PM
// CIE response curves using Gaussians fitting const vec4 CIEX0 = vec4(0.26714125, 0.173056848724526, -0.0517890668554628, 0.369341509681465); const vec4 CIEX1 = vec4(0.0, 0.510852785928701, 0.636521548441552, -0.324530476950362); const vec4 CIEX2 = vec4(1.0622, 0.547302197035226, 0.0899535691555178, 1.10399973088081); const vec4 CIEY0 = vec4(0.2671425, 0.86798560108836, 0.150307921271593, -0.354744089805774); const vec4 CIEY1 = vec4(0, 0.10539332389757, 0.168752691961971, -0.289650515359526); const vec4 CIEY2 = vec4(1.0002, 0.445956775505726, 0.0920541376951253, 0.814888040084084); const vec4 CIEZ0 = vec4(0.26714375, 0.174251742295476, -0.0569218355789753, 1.72408897831517); const vec4 CIEZ1 = vec4(0.0, 0.0542544622978704, 0.0457454482464726, -0.442679263574661); const vec4 CIEZ2 = vec4(1.7826, 0.711309229610584, 0.285040831286585, -0.407629686738774); float Gaussian(const float x0, const float s, const float w, const float x) { return w * exp( -(x - x0) * (x - x0) / (2.0 * s * s + 1.0e-20) ); } float GaussianMixture(const float lambda, const vec4 Data0, const vec4 Data1, const vec4 Data2) { float t = (lambda - 0.380) / (0.780 - 0.380); float g0 = Gaussian(Data0.y, Data0.z, Data0.w, t); float g1 = Gaussian(Data1.y, Data1.z, Data1.w, t); float g2 = Gaussian(Data2.y, Data2.z, Data2.w, t); return min(max(g0 + g1 + g2 + Data0.x, Data1.x), Data2.x); } vec3 Spectrum2RGB(const float lambda) { float x = GaussianMixture(lambda, CIEX0, CIEX1, CIEX2); float y = GaussianMixture(lambda, CIEY0, CIEY1, CIEY2); float z = GaussianMixture(lambda, CIEZ0, CIEZ1, CIEZ2); // E to D65 // 0.26713798 is for mapping spectrum 1.0 into rgb (1.0, 1.0, 1.0) x = x * 0.9504700 / 0.26713798; y = y * 1.0000000 / 0.26713798; z = z * 1.0888300 / 0.26713798; // sRGB (D65) vec3 rgb; rgb.r = (x * ( 3.2404542) + y * (-1.5371385) + z * (-0.4985314)); rgb.g = (x * (-0.9692660) + y * ( 1.8760108) + z * ( 0.0415560)); rgb.b = (x * ( 0.0556434) + y * (-0.2040259) + z * ( 1.0572252)); return rgb; }
color.r = sin( input.posY_plus_time ); color.g = sin( input.posY_plus_time + 2/3*Pi); color.b = sin( input.posY_plus_time + 4/3*Pi);
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.