Jump to content


xot

Member Since 08 May 2004
Offline Last Active Apr 19 2016 12:53 PM

Topics I've Started

Color-Blindness Simulation

09 September 2013 - 12:23 PM

Color-Blindness Simulation

Fragment Shaders:
Spoiler

All use the default GM:Studio vertex shader.


What they do:

These shaders simulate what a color-blind person would perceive when viewing one's game. There are different forms of color-blindness and these simulate common ones.

gamemakercolorblindness.jpg

shDeuteranopia - simulates dueteranopia color-blindness
shProtanopia - simulates protanopia color-blindness
shTritanopia - simulates tritanopia color-blindness

The intended use is to render a game to a surface and draw the surface to the screen using one of the simulation shaders. In this way developers can identify game features which may be difficult to distinguish for people with limited color perception. From there one can go about recoloring these parts of the game or providing color-blind alternatives for those who desire them. These shaders are to aid development and are not intended to be present in the final game.

This project also includes a few other shaders which alter the color space in similar ways.

shDogVision - simulates the color perception of dogs
shDesaturate - grayscale conversion treats RGB channels equally
shLumCIE - grayscale conversion based on the CIE television standard
shLumNTSC - grayscale conversion based on the NTSC television standard


Download:

Dropbox - color-blindness-shaders.gmz

Replace Similar Colors While Preserving Shading

31 July 2013 - 07:12 PM

shColorReplaceBlend

Fragment Shader:
Spoiler



What it does:

This shader will replace one color with another. It can also replace similar colors while preserving the overall shading of the original. In the image below, red (245,0,0) is replaced with blue (20,34,233).

kt0JD5P.gif

The interactive demo displays different examples of use with simple parameter controls to alter the output, including examples which don't work well with this shader. The demo object is a bit complex due to its interface but the shader specific parts are easily identified.

Download from Dropbox: shColorReplaceBlend.gmz


How it works:

The shader accepts an input color and output color to select the color to replace and the replacement color. It compares each pixel with the input color. If it matches within a specified degree of error -- limited by "tolerance" parameters for hue, saturation, value, and alpha -- it is replaced by the output color. The output color is modulated by the input error, eg. if a selected pixel is slightly darker than the input color, the output color will also be made slightly darker. In this way, shading and other nuances are preserved. This modulation is optional and is controlled by the "blend" parameter. The color matching and blending is performed with the aid of an RGB-to-HSV color space transformations.


Limitations:

This works well for most colorful imagery and is suited for games which need to display different team or player colors using a single set of sprites. Groups of colors which are similar may be difficult to separate. Sometimes this is useful for replacing several colors at once. Other times this may make it difficult or impossible to isolate a specific color. For best results, make sure the colors you wish to replace are reasonably different from the other colors in the image. Gray-like pixels with very low chroma may be more difficult to accurately match or blend. This is because as chroma/saturation is reduced, hue appoaches an undefined state and transformation back to RGB color space becomes less accurate or impossible.


Update:

The demo now includes a version of the shader for replacing multiple colors using arrays. Detailed usage notes are included with the code. This update also fixes a bug with rgb_to_hsv() that turned perfectly gray colors into black.

Replace And Animate A Range Of Colors

21 July 2013 - 10:17 AM

shColorReplaceRange
shColorReplaceRangeExt

Fragment Shader:
Spoiler


What it does:

This shader maps a range of colors in the base texture to a second range of colors to be output. Colors which do not match the input range are output normally. Special features allow the output to be manipulated and animated in various ways. There are two versions of the shader. The extended "Ext" version allows the replacement of multiple ranges of colors.

gwZvnYv.gif

Download from Host-A: shColorReplaceRangeExt.gmz
Download from Dropbox: shColorReplaceRangeExt.gmz

The example features two rooms. The first is a demo like the picture above. The karate men display two color changes using the extended version of the shader. The second is a demo that lets you manipulate the various inputs of the shader interactively. Holding the Shift key disables the shader.


How to use it:
Spoiler



How it works:
Spoiler



Potential for future expansion:
Spoiler

Staff Changes

05 April 2012 - 03:04 PM

Please join me in welcoming to the staff our new local moderators (in no particular order): Dangerous_Dave, Desert Dog, IceMetalPunk, Tepi, TheSnidr, True Valhalla, Yal, and YellowAfterlife! (OK, it was alphabetical order)

I think most of you will recognize these long-time members who were kind enough to go beyond their normal helpfulness and take it to the next level by dispensing brutal justice upon their former peers.

Also, give a big thanks to our current moderators who have recently been promoted to Global status. They've been such a tremendous asset to the community and now their eyes are everywhere. EVERYWHERE.

Cheers!

Welcome new staff recruits!

08 June 2011 - 06:04 PM

Please join me in welcoming our new staff recruits Nocturne, ugriffin, icuurd12b42, flexaplex, and paul23! I'm sure most of these members will be no strangers to you. They already help the community everyday with their regular and informative posts. Now they have agreed to take on larger, more perilous roles within the community as moderators. Try not to break them right away.

In addition to these changes, moderators Takagi, Mnementh, and xshortguy have agreed to take on greater responsibility as global moderators. There is nowhere to hide from these guys now.

It is also my unhappy duty to announce that moderator ragarnak has decided to step down. He was a greatly valued member of the staff and enormously helpful in keeping things running here, as well as assisting Game Maker users with their questions in the forums. Hopefully, we will continue to see ragarnak remain a strong pressence in that latter capacity.

Community Topic