3
\$\begingroup\$

I am interested in the algorithm for color picking that would ideally allow to choose what color range will be highlighted and what color range will be faded.

I can sort-of understand how to make it look like black light effect, but I wonder if there is actual research out there on how to make it properly. What is the technique for rendering a black light effect?

Another question is highlights: How do you handle highlights? Do you ignore them completely or link their power to the luminess color of the surface?

enter image description here

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Instead of asking an open-ended question like a request for tutorials, you should ask a specific question about the trouble you had when trying to implement this. \$\endgroup\$
    – MichaelHouse
    Mar 31 '14 at 17:48
  • 1
    \$\begingroup\$ Well the problem is which colors to choose for highlighting and which to fade, that's basically it. I really don't want to use an extra texture channel for that. I wonder if there is an algorithm for picking the right colors? Another issue is how do you handle highlights? Just ignore them or only apply them only to bright colors? \$\endgroup\$
    – cubrman
    Mar 31 '14 at 18:06
2
\$\begingroup\$

To answer your 2 somewhat unrelated questions:

#1

To pick which color range to fade out in a fragment shader I would first calculate the actual color of that fragment in the usual way. Then I would convert that to HSL colorspace. Then I would compare the H part (hue) to a constant and if it was too far away from that constant i would set the color of the fragment to black. You could also fade towards black based on the distance between the color and the constant for a less abrupt effect.

#2

When you go to the club dance floor to bust a move you might not think about the fact that UV light is invisible to us. The only reason we see it is because of an effect called fluorescence, which roughly means that "some materials, when they receive rays of UV light convert that light to another (visible) frequency.

Thus, to render UV light you will probably need an extra color component in your UV active textures and light sources. This is because our eyes preceive colors by separating it (roughly) into the amount of red, green and blue that is in the light, and there is no provision for unseen light in traditional graphics engines. I would investigate if using the alpha channel for this would be feasible in your case (of course this means that it cannot be used for transparency).

I would then paint a "UV mask" and save it as the alpha channel in my texture. Lets assume you have a wood texture for the walls of a basement and then in the alpha channel you make a "REDRUM" in bold letters. Next you create two light sources to your fragment shader, one with UV=0.0 and one with UV=1.0 (UV being your custom light parameter).

To calculate the amount of blue light contributed to the visible light you would do fragment.b+=fragment.a*light.uv; //.a is uv, remember?

If you want different colors for the fluorecence, you would need more than one color channel added.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.