A downloadable shader

Download NowName your own price

Overview

Have you ever wanted to provide more colour options for character creation, but didn't have the budget or time to create a bunch of colour variations? If you've tried out Ren'Py's built-in ColorizeMatrix, you'll know that it's limited to two colours, which act as the "black" and "white" colours for a grayscale image. This makes it impossible to get true depth with shadows and highlights, since the midtone is always perfectly in between two existing colours. Luckily, with shaders we can fix this problem!

For reference: in all screenshots of the hand, the base image looks like this, and is then colorized in-engine using the included custom RGB shader.


Description

Better Colorize for Ren'Py includes three main features:

First, there is a custom shader. This shader takes up to seven colours per channel and associated thresholds and can be applied as a transform onto an image. The base image can be grayscale, but it can also use red, green, and blue in specific ways to differentiate shades of gray for recolouring (tutorial coming soon on feniksdev.com!).

Second, there is a special DynamicDisplayable which will take a variable which ranges from 0-100 and a list of special RGBColorize objects containing colour and optional threshold information. Adjusting the bar value will smoothly interpolate between the provided colours.

Lastly, there is a special shader which takes up to 8 colour codes and will return a gradient smoothly interpolating between all provided colours. This can be used in combination with the colour codes provided to the DynamicDisplayable to create a bar image which can be used in character creators.


This shader has been tested on multiple art styles, to excellent success. With proper base images and colours, it is possible to replicate the colouring for styles ranging from shiny cel-shaded art with outlines to more painterly and blended styles.

Instructions

Download better_colorize.zip and unzip it. Place the provided rpy files (better_colorize.rpy and better_colorize_examples.rpy) into your project's game/ folder and the provided images hand_rgb.png and hand_heart.png into your images folder.

To see the example screen, make a button to go to it, for example on the main menu:

textbutton "Colorize" action ShowMenu("colorize_example")

You will see the provided hand images with a slider demonstrating various applications of the shader. If you do not need the example code, you may delete better_colorize_examples.rpy.

Compatibility

This code has been tested for compatibility with Ren'Py 7.5-7.6 and 8.0-8.2. It is expected to be compatibile with earlier versions that include gl2 (so, 7.4+). Leave a message in the stickied thread if you run into any bugs.

Terms of Use

You may:

  • Use this code in commercial and noncommercial projects.
  • Modify and edit this code to suit your needs

You may not:

  • Resell all or part of this code as-is or sell it with modifications

Attribution should be credited as Feniks, with either a link to this page or to https://feniksdev.com

Credits

Hand illustration adapted from Edurs34 from Pixabay (included in zip).

Character art from sutemo (not included in zip).

Final Notes

Ginormous thank you to the devs who've tested out this shader and helped me make it the best version it can be. I've learned more about colour math and premultiplied alpha than I ever thought I'd need to know.

I've also released a tool specifically designed to work with this shader in order to preview the results in real-time. Find it here!



Everything in this image has been colorized in-engine -- the hair, the eyes, the shirt, the skin, the eyebrows. The base images look like:


Cove is from Our Life: Beginnings & Always by GB Patch!

In the coming weeks I will also be releasing tutorials on my website (feniksdev.com) about how to set up base images and how to colorize them with the tool.

Download

Download NowName your own price

Click download now to get access to the following files:

better_colorize.zip 383 kB

Development log