A downloadable shader

Buy Now$3.99 USD or more

This is a shader asset for GameMaker Studio 2 (GMS2) that transforms a texture according to a perspective transformation, creating an effect similar to old Mode7 SNES games (F-Zero, Super Mario Kart, Chrono Trigger).

Requires intermediate knowledge of GML (GameMaker Language) and GLSL (GL Shader Language) to use effectively!

Features:

  • Commented code: Both shader and objects are fully commented and it should be easy to make wanted adjustments.
  • Includes 2 shaders: one for single texture transformation, one for an infinite plane of the same texture!
  • Includes functions necessary for sprite billboarding to make flat sprites appear on the plane.

Controls:

  • WASD+QE moves the player object around.
  • X-C changes the height of the horizon
  • V-B changes the horizontal scaling
  • N-M changes the distance of the camera to the point of reference (shown by a car sprite) (not available in demo).
  • F-G changes the scale of the plane. Should be the size of the square texture for 1:1 translation of coordinates (not available in demo).
  • R resets the position of the player and the values of the shader.

If you like this shader or have found an issue with the code, leave a comment or reach out to me on Twitter. Check out my other tools and games on itch.io too!

Updated 27 days ago
StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(2 total ratings)
AuthorMrLevRocks
Made withGameMaker
TagsAsset Pack, GameMaker, mode-7, mode7, Shaders, sourcecode

Purchase

Buy Now$3.99 USD or more

In order to download this shader you must purchase it at or above the minimum price of $3.99 USD. You will get access to the following files:

Mode7Shader.yyz 43 kB

Download demo

Download
Mode7Example.zip 2.8 MB

Development log

Comments

Log in with itch.io to leave a comment.

(+1)

This is great!

can we add Trees? I mean a vertical item?

It should be possible to make billboarded sprites. That's how the car in the demo is made. But to get proper projection, the relative position of an object to the camera would have to be calculated first. There's some code already in the shader package you can buy but I didn't implement any billboarded sprites (other than the player).

(1 edit)

Any chance you could implement billboards that are non-players, that keep their location on the floor relative to the camera? I've been tinkering with it some, but can't figure it out.

Also: how might I go about normalizing depth? I usually use depth=room_height-y, but the object doesn't draw with the shader when using that depth sorting method.

God, it's been so long since I touched this but it should be possible. I'll have to look into the code again to tell you how to calculate the relative coordinates of a billboard object so that you can place it accurately.
As for depth, it should be relative to the calculated y coordinate of an object but I didn't implement it because I struggled with it myself. Should I figure it out, I could get back to you.

I have make a quick tutorial on how to make billboards using the code already included in the shader code examples. It's pretty easy, actually.
https://mrlevrocks.itch.io/mode7/devlog/812974/how-to-add-billboards-to-mode-7-s...
Normalizing depth might be a bit harder but what you could do is pass the calculated height from the draw event into a defined variable and then set that in the end step event. Tell me if that works.

(+1)

Thanks for this! 

It is no longer just possible, it is done. Check out this tutorial I made on how to.
https://mrlevrocks.itch.io/mode7/devlog/812974/how-to-add-billboards-to-mode-7-s...

(+1)

epic