Previous topicNext topic

Color Palettes

Questions, comments, feedback, etc.
Post Reply
DeadMusik
Posts: 14
Joined: Wed Jan 20, 2021 9:39 pm

Color Palettes

Post by DeadMusik »

Hello people of magic!...

I'm wanting to get specific with my colors in my visuals, does anyone on here have any thoughts to apply specific color palettes.

I usually experiment with different sin's and increases with wraps on different values of colorHSB but its random, because my input isn't mathematically correct in the direction I want to go.

Hope that makes sense to anyone :D happy mixing!
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: Color Palettes

Post by Sadler »

There are plenty of palette generator and colour converter websites out there to create and convert the (mostly) hex colour values into RGB or HSL which Magic supports. It'd be handy to have a built-in hex conversion - may already have been requested? Also handy to have a colour picker - requested I think.

Once you found and converted all your RGB/HSL values the only thing now is to apply them to the various elements in your scene. There is no easy way to manage palettes - though you can store individual colour values in literals, variables or globals and switch them like you would switch anything else.

Rather than using Sin and Ramp, use a Smooth to blend from one specific colour to another.
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Color Palettes

Post by Terry Payman »

Perhaps not what you were looking for, but I've just started working on a palette module for the following use cases
  • Applying false colour to a video image
    Applying specific colours to a decaying trail
    Quickly recolouring existing scenes to fit within a different palette range
I wanted to be able to feed in an image of a desired palette, and to have some readily accessible presets.
It's very much an experimental and unfinished work-in-progress, and I'm adding functionality as ideas occur to me.

Attached is my current ISF shader version and a demo Magic project. Probably lots of poor coding in the shader. certainly lots to be tidied up. I make no claims other than "it's functional". Code is largely from Shadertoy, inspired and developed from this shader https://www.shadertoy.com/view/Nd3fR2, but also with a couple of cosine-based palettes using IQ's palette function https://www.shadertoy.com/view/ll2GD3 with parameters generated here http://dev.thi.ng/gradients/.

As well as the built-in palettes you can use the second input pin to feed in an external (vertical) palette image. The external palette image is sampled along a central vertical line, and as the external palette is an image it's easily masked or scaled to give further control. An external palette image could be composed of a number of adjacent palettes, selection between them made by introducing a horizontal translation of the composition.

I'll probably add the ability to sample a horizontal palette, also to adjust the range over which a palette is sampled so that a limited colour range could be selected.

Various components of the input image can be selected for processing:
  • Luminance
    Max Component
    R
    G
    B
Output can be selected between
  • Selected Palette
    All palettes
    Component used as input to the palette
    Applied Palette
Comments and suggestions welcome!
Attachments
Palettes 1v7.fs
(23.38 KiB) Downloaded 182 times
Palette module demo.magic
(3.47 KiB) Downloaded 186 times
Post Reply