But even these palettes aren't the true colors, but represent positions on a global color palette that is used for everything in the game! All of these color tables are stored on a single surface that the shader samples from. The colors of this personal palette aren't colors either, but represent positions on an index of local palettes that contains all color palettes used for all objects in a specific room. I also had this idea, but I took it to an extreme illogical conclusion! All colors in a sprite represent positions on a personal palette that can be assigned to individual instance when calling their draw function. Hopefully this helps other people who want to make a Downwell-style game! I know one of my biggest gamedev dreams was a game with changeable palettes - I don't know why, but it was always a really cool idea for me. Shader_set_uniform_f(shf_ph,texture_get_texel_height(_tex)) īasically, I just copy the application_surface and re-draw it with the shader on. Build Magick.NET yourself: Instructions on how to build Magick.NET can be found here. Search for Magick.NET and choose the package that uses the platform of your choice: x86/圆4 or An圜PU. Shader_set_uniform_f(shf_pw,texture_get_texel_width(_tex)) You have two options to get the Magick.NET binaries in your project: Use NuGet: Right click on the references of your project and choose 'Manage NuGet packages'. Shader_set_uniform_f(shf_index,global.palette) Var _tex = sprite_get_texture(sPalettes,0) Surface_copy(_surf,0,0,application_surface) I was sure it would suit my needs perfectly, and I knew exactly how it worksĪnd here's the Draw End event: var _surf = surface_create(256,240) I could technically buy a color swap shader from the GM Marketplace, but I decided to stick with making my own since: ![]() Pw and ph are the texel width and height of the palette sprite texture (texture_get_texel_height and texture_get_texel_width) Palette_index is the index of the currently used palette - in my case this goes from 0 to 5. Palette is the palette sprite texture (sprite_get_texture(sPalettes)). Gl_FragColor = texture2D(palette, index) Vec4 color = texture2D(gm_BaseTexture, v_vTexcoord) Here's the shader: varying vec2 v_vTexcoord ![]() So I made a shader that takes that amount of green + the palette "index" and checks for that color on a palette sprite. I figured out that these colors are only different through their green - black has 0%, pink 50%, and white 100% green. After a few days of figuring out shaders, I am here to bless everyone with this knowledge.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |