POV-Ray : Newsgroups : povray.binaries.scene-files : Reinterpreting colors.inc colors as sRGB : Re: Reinterpreting colors.inc colors as sRGB Server Time
25 Apr 2024 00:42:58 EDT (-0400)
  Re: Reinterpreting colors.inc colors as sRGB  
From: Alain
Date: 9 May 2016 11:25:59
Message: <5730ac07@news.povray.org>

> I second Thomas's comment. Thanks, this looks very useful.
>
> I'm curious about something though. In 3.7.0's "colors.inc" file, there are some
> macros for converting between RGB, HSL and HSV, and vice-versa. I've never used
> those, but I thought I would take a look at them anyway. Most of the macros seem
> OK to use, even in an srgbt world. But one macro looks suspicious ;-) ...
>
> // Converts a color in RGB color space to a color in HSL color space.
> // Input:  < Red, Green, Blue, Filter, Transmit >
> // Output: < Hue, Saturation, Lightness, Filter, Transmit >
> #macro CRGB2HSL(Color)
> ......
> #end
>
> Would the equations there still be correct when giving the macro an srgb color?
> For example, let's say I'm rendering a scene with srgb <.3,.5,.7> as an
> *on-screen* color (a 'gamma-bent' color, although I realize that the rgb colors
> themselves are actually 'linear' colors.) Feeding those linear rgb colors to the
> macro would result (by my thinking) in an HSL color that wouldn't quite match
> what I was seeing on-screen. (Assume that I'm running v3.7xx with the proper
> assumed_gamma 1.0).
>
> At least, that's how it seems to me, although I could be wrong.
>
> Does that macro need updating for your "colors_srgb.inc" file?
>
>
>

When you define a colour as srgb, it's converted to rgb space at parse time.
So, if you feed that macro a colour as srgb, you are realy feeding it 
the srgb colour converted to rgb.

Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.