GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2016-01-30 23:05:42

Shadowblitz16
Member
Registered: 2016-01-30
Posts: 3

(Suggestion) GM8 Palette Swap Scripts/Shader

Can someone make some scripts and shader that uses a png palette to change a sprites colors and alpha to different colors?

I was thinking along the lines of reading the png palette top to bottom, left to right
and storing the color sets in a array or map by calling palette_init

then you could call scripts like
palette_swap(cset) <-- can return
palette_effect(effect) <-- can return
palette_fadeEffect(effect,time) <-- read only

effects being
thermal
negitive
frozen
gray
sepia
ultraViolet

to change the color

Offline

#2 2016-02-02 00:25:55

lostdarkwolf
Member
Registered: 2015-11-19
Posts: 23

Re: (Suggestion) GM8 Palette Swap Scripts/Shader

GM8 doesn't support shaders... unless your using some kind of extension. it could be done with surfaces but it would be lag-intensive i think.

(negative can be done with blend modes.)

Last edited by lostdarkwolf (2016-02-02 00:31:16)

Offline

#3 2016-02-04 16:40:28

xot
Administrator
Registered: 2007-08-18
Posts: 1,201

Re: (Suggestion) GM8 Palette Swap Scripts/Shader

This is an extension for GM8 shaders I've used.

http://gmc.yoyogames.com/index.php?showtopic=492876

It does not work with GM8.1 and you must program your shaders with PS1.4 assembly which is not as easy as GLSL or HLSL. There may be tools to help you compile from a high-level language to assembly but I don't know what they would be. PS1.4 targets old versions of DirectX and may not be well supported by creation tools.

When making this shader, you need to limit the amount of data you pass to it. Pass the palette information as a texture and let the shader read it directly. Comparing each pixel to a pixel in a large texture could be very slow or fail to compile but for a small number of colors this should be practical.


Abusing forum power since 1986.

Offline

Board footer

Powered by FluxBB