Looking for help passing individual tile layers to a shader!
Hey all,
I currently have a decent "wave" shader that will produce an effect similar to this (not my work, but it's the same gist).
However, I've encountered a problem. When I apply the shader to my tile layers, they are passing in the UVs of my tileset texture page, so I will occasionally have pixels taken from adjacent (and differently colored) tiles on the tileset.
So I'm wondering, how do I "reference" the layer itself as it's own texture page/UVs? I think I may have to draw the layer to a surface, and use the surface as a texture page, but how would I do that using layer code?
Thank you!
EDIT: The "wave effect" I am referring to is the slight left/right movement to simulate heat rising over the entire screen.
EDIT 2: And, I should mention that I want to only apply the "wave" to specific layers (namely, the tile layers, and not the player/enemy layers). I think this rules out the application surface (which is the default surface tile layers are drawn to)?
Posted Aug 20, 2020, 8:54 PM UTC · edited
Since I don't know much about shaders, have you considered putting each tileset into its own texture group? Then they'd be isolated on each texture page.
There's also a setting you can change in your tileset menu where you can increase the output border (x and y), which will repeat the outside row of pixel on your tiles so that they have additional real estate to play with. Might prevent your shader from being able to grab outside of the tile's desired UV.
Hey, thank you for your reply!
Unfortunately, your first suggestion won't work for me because I've got, for example, grass and dirt (bright green next to dark brown) right next to each other in the tileset sprite itself.
You're second suggestion, however, sounds like it could definitely help mitigate that "tile leakage" that I described! I'll check into that for sure! Optimally, I'd still like to grab the pixels from the next tile over in the tile map built in the room editor.
I've detected the names of 2 colors in your comment. Please allow me to provide visual representations. Bright green (#66ff00) Dark brown (#654321)
^(Learn more about me | Don't want me replying on your color word comments again? Respond to this comment with: "colorsbot opt out words")