Legacy GM Set Alpha from File

F

Fodderbot

Guest
In the image editor under the menu of [Image] there is a function Set_Image_From_File that does exatly what I need.

Is there any way that I can apply this functionality to a background (or sprite) through code?

Fodder
 

Roa

Member
Whew lad. Once upon a time this was a hot topic. Is there a reason you want to do this?

You have to look into blend modes, but they are mostly obsolete and they can be kinda confusing at first. But maybe there is another way to solve the problem you are having?
 
F

Fodderbot

Guest
Whew lad. Once upon a time this was a hot topic. Is there a reason you want to do this?

You have to look into blend modes, but they are mostly obsolete and they can be kinda confusing at first. But maybe there is another way to solve the problem you are having?
I was looking to layer multiple backgrounds and use the alpha to vary the look using a set of procedurally generated alpha textures to cut art production and asset storage requirement by a factor of about a 100.
 
F

Fodderbot

Guest
The overhead on blend modes seems to be quite expensive. Since the Engine allows you to set background texture alpha, on or off or somewhere in between, it would just require the ability to do this with a grayscale image to work correctly. Does not seem to be very high hanging fruit in the scheme of things
 
A

anomalous

Guest
sprite_set_alpha_from_file(); // has parameters in manual
It works as advertised.

An issue you can run into is that it requires dynamic sprites (sprites added run time), which will each use their own texture page. This limits how much you can use that, unless you do something else with it.
 

Roa

Member
sprite_set_alpha_from_file(); // has parameters in manual
It works as advertised.
I think that only works on a single sprite though, and it doesnt compound in layers as he wanted.

Or am I missing the point?

Are you aiming for like sort of a "painted" texture that dynamically fades into different backgrounds?
 
F

Fodderbot

Guest
sprite_set_alpha_from_file(); // has parameters in manual
It works as advertised.

An issue you can run into is that it requires dynamic sprites (sprites added run time), which will each use their own texture page. This limits how much you can use that, unless you do something else with it.
That is good to know
 
A

anomalous

Guest
Surfaces and sprites both can be used to similar effect, all depends on what he's doing... both are good tools to be aware of.
I use the sprite function to create tiles...which I then import. Same effect but no run-time overhead/texture page issues..but I do have to build them all.

TMC has a tool on the marketplace that does something like this, you may want to check it out.
 
F

Fodderbot

Guest
I think that only works on a single sprite though, and it doesnt compound in layers as he wanted.

Or am I missing the point?

Are you aiming for like sort of a "painted" texture that dynamically fades into different backgrounds?
Your not missing the point. It's the same as terrain painting in many of the 3d industry engines where you have multiple textures blended by alphas that overlap.
 
F

Fodderbot

Guest
Currently I can use predefined background images with alphas and draw them at different levels to give me the functionality that I am looking for visually. It would be much nicer to not have an individual asset for each and every alpha pattern used and to be able to apply one on the go to reduce the number of assets required, the amount of page space used also being reduced, and while limiting computational time to make the code effiecient.
 
F

Fodderbot

Guest
Surfaces and sprites both can be used to similar effect, all depends on what he's doing... both are good tools to be aware of.
I use the sprite function to create tiles...which I then import. Same effect but no run-time overhead/texture page issues..but I do have to build them all.

TMC has a tool on the marketplace that does something like this, you may want to check it out.
I will check that out.

Really seems like a no brainer addition to the current solution though without having to jump through processor expensive hoops.
 
F

Fodderbot

Guest
sprite_set_alpha_from_file(); // has parameters in manual
It works as advertised.

An issue you can run into is that it requires dynamic sprites (sprites added run time), which will each use their own texture page. This limits how much you can use that, unless you do something else with it.
Yea, I can see where page swapping would really start to throw a kink into the process.
 
Top