• 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!

Shaders Shaders for map layers?

LunaticEdit

Member
I need to have two map layers where one or the other renders on a per-pixel basis based off of perlin noise values. Is this possible to do with a shader?
 

LunaticEdit

Member
Further question.. I'm trying to do some spiffy shader stuff, but it seems that the v_vTexcoord is based on the entire atlas, not the sprite itself. This makes perfect sense. But is there a way to know the bounds of the sprite itself within the atlas? I need to calculate the relative position in the sprite during the shader process.
 

NightFrost

Member
First question: yes, it is possible to write a perlin noise shader if that's what you're asking. To fill a layer with perlin noise, you draw a square that covers the view area and set the shader for that draw.

Second question: sprite's positional (UV) data on a texture page can be retrieved with sprite_get_uvs. You'll have to feed the relevant bits to the shader through uniforms.

Here's a good tutorial series on using shaders with GMS by TheReverend, in case you're interested.
 

LunaticEdit

Member
First question: yes, it is possible to write a perlin noise shader if that's what you're asking. To fill a layer with perlin noise, you draw a square that covers the view area and set the shader for that draw.

Second question: sprite's positional (UV) data on a texture page can be retrieved with sprite_get_uvs. You'll have to feed the relevant bits to the shader through uniforms.

Here's a good tutorial series on using shaders with GMS by TheReverend, in case you're interested.
This is exactly what I wanted to know, and works perfectly. Thank you!
 
Top