• Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!

surface colour misalignment for meta balls

JML

Wabbajackalope
i am using the following code to blend two objects on a surface together to create one item visually and have run into a problem related to what colours are used.

the following code is based off the youtube video on metaballs linked to at the bottom of this page

specifically the problem lies in how the "way" variable is represented, if i use 0 or 255 for the colours then the object appears fine, but if i try to use partial variables (for instance to make an orange metaball) then i end up with an item that looks more yellow than orange and their is a change in colour from the outside going into the center, which isnt present if i pick red or green or aqua.

please note, if i draw an orange metaball without the surface, it is correctly coloured, but going through the surface it turns more yellow with an orange ish outline, so im at a loss.

is their something i am doing wrong with the surfaces? how could i correct the drawing system so that the colours of objects i choose will be correctly represented on screen?

thank you.


Code:
var way = make_colour_rgb(255,128,000);
if surface_exists(surf)
{
if instance_exists(obj_ball)
{
surface_set_target(surf);
draw_clear_alpha(way,0.5);
draw_set_blend_mode(bm_add);
with(obj_ball)
{
draw_sprite_ext(sp_ball,0,x,y,image_xscale,image_yscale,0,way,1)
}
draw_set_blend_mode(bm_normal);
surface_reset_target();
draw_set_alpha_test(true);
draw_set_alpha_test_ref_value(200);
draw_surface(surf,0,0)
draw_set_alpha_test(false);
}
}else{
surf = surface_create(room_width,room_height);
}
 
Last edited:

Yal

GMC Memer
GMC Elder
Not gonna lie, only clicked on this topic because of the title.

Does the ball sprite have transparent edges? The way alpha works on surfaces basically makes alpha more extreme than when drawing normally. You could consider turning off writing the alpha channel to amend this.
 
Top