• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Some quick questions regarding "image_blend"

D

Dudeless

Guest
First question:
Can I use "image_blend" function with constants such as "c_yellow" etc.? If yes, how? If not, what can I use other than "make_color_rgb/make_color_hsv"?

I used this code in "Draw" event but it didn't work:
GML:
draw_self();

image_blend = c_yellow
Second question:
Is it possible to draw a sprite white using image_blend? If yes, how? If not, is there a way to do that other than using shaders? I tried to use "d3d_set_fog" but GML didn't recognize it as a built_in function.

Third question:
Is it possible to blend only specific layer(s) of a sprite? Like, for example, if I have a stickman whose head and body are in different layers (in image editor, not "instance layers"), is it possible to make only the head blend?

Thanks in advance!
 

curato

Member
1. assigning image_blend should work, but I like draw_sprite_ext personally. It give you more options to tweak. either should work for what you are saying.
2. white is used as default coloring. If you want a white version make the sprite white then color it with image_blend.
3. I have done it before as seperate sprite likea paper doll setup, but an all in one deal you would be looking at shaders.
 
1) Do you have anything else in the object that sets the image_blend back to white? You set the colour to yellow after you draw the sprite, so chances are that it's reset during the next game loop, making the variable appear to not be functioning.

2) d3d_set_fog() was replaced with gpu_set_fog().
 
D

Dudeless

Guest
1. assigning image_blend should work, but I like draw_sprite_ext personally. It give you more options to tweak. either should work for what you are saying.
2. white is used as default coloring. If you want a white version make the sprite white then color it with image_blend.
3. I have done it before as seperate sprite likea paper doll setup, but an all in one deal you would be looking at shaders.
1) Do you have anything else in the object that sets the image_blend back to white? You set the colour to yellow after you draw the sprite, so chances are that it's reset during the next game loop, making the variable appear to not be functioning.

2) d3d_set_fog() was replaced with gpu_set_fog().
1- Apparently, color constants actually did work but for some reason it did not show itself on my lime-colored square (maybe it is as "yellow" as it can be (I tried "c_red" but it made it go black)). However, when I tried to do it on another object, which is white, it worked out fine. So, my first question is resolved. Thanks! (thanks for suggesting "draw_sprite_ext" too!)

2- BattleRifle's suggestion seems to work but I couldn't understand all the variables in the formula. With the help of another post, I wrote this code, which worked:
GML:
d3d_set_fog(true, c_white, 0, 0);
draw_self();
d3d_set_fog(false, c_white, 0, 0);
But, why does this work? Or, how does this work? What do the "start" and "end" values represent?

3- curato's idea is what I had in mind but I didn't want to do it as it would complicate things. But if that is the only way, okay then, thanks!
 
Top