Free Fauxton 3D - A 2.5D sprite-stacking engine

Gizmo199

Member
version 2.2.2
Logo.png
Demo | Download | Docs
Update - v 2.2.0


About

Fauxton 3D is a powerful and efficient sprite-stacking engine that not only makes 3D games possible in Game Maker but also INSANELY easy! There are many hurdles when attempting to do 3D rendering in Game Maker and it can be daunting trying to learn it all, but with Fauxton, I have tried to design it so that it is efficient, quick, and easy. So easy that a complete beginner to 3D can have a scene up and running in no time at all!

Testimonials
You made something super cool and inspiring! I've never been able to render a 3d scene so easily in gamemaker before
-
Rologfos

This is simply amazing man, the best asset of this kind for gms anywhere that i can find, and ive looked for a lot of 2.5d and sprite stacking solutions
-
Wurmhole

it's amazing, much easier to create rooms and objects as you want and add shaders
-
Baiter Yamato

What is sprite-stacking?

From an article by Avis:
Sprite-stacking is where a voxel model is sliced into many horizontal slices, these slices are then drawn in GameMaker from the bottom to the top, with each one slightly higher. This gives the effect of a sort of 3d model in a purely 2d game

What can it do?

This engine includes plenty of functionality fully compatible with most things you might do with a standard Game Maker 2D game. Some of the things you can do with the downloadable & playable demo include Volumetric fog, Object particle effects, Unlimited static buffers, and more! Once you initiate the engine using the function FAUXTON_START(), getting a model into a scene takes only 1 line of code fauxton_model_create() and that's it!! I tried to design this project for beginners and artists, so you can focus on your games, not learning about buffers!



You can read more about the functionality, as well as a brief tutorial, in the Documentation!
Follow me on Twitter to keep up-to-date on progress!

Code:
V 2.2.2 Patch
[FIXED] Scaling issues when adding scaled models to static buffers
Code:
V 2.2.1 Patch
[FIXED] Camera control right-stick axes were flipped (vertical was Angle, horizontal was Pitch).
Code:
V 2.2.0 Update
[ADDED] World Environment Node 
[ADDED] Point light node 
[ADDED] Spot light node 
[ADDED] fauxton_buffer_set_uniform_script(buffer_name_or_id, uniform_control_script) 
[MODIFIED] draw_sprite_3d OPTIONAL parameter 'enable_lighting' 
[MODIFIED] draw_sprite_3d_ext OPTIONAL parameter 'enable_lighting' 
[FIXED] fauxton_buffer_set (Would return an error)
Code:
V 2.1.1 Update
- [FIXED] - 'missing reference id' message for the Camera and RenderPipeline object nodes
Code:
V 2.1.0 Update
- [ADDED] - fauxton_model_texcube, fauxton_model_texcube_destroy, fauxton_model_create_ext
- [ADDED] - Full demo with examples of Static buffers, Particles, Volumetric Fog, and Player movement/animation
- [FIXED] - Bug fixes here and there, syntax highlighting fixed
- [ADDED] - HTML5 and mobile camera rotation support to Camera
Code:
V 2.0.0 Update
- [ADDED] - Completely new workflow,
- [ADDED] - Static buffers that models can be added to
 
Last edited:

Shut

Member
Whoa, looks like you put in a great effort into this. Looks really cool! I experimented with sprite stacking some time ago and I'll definitely try to use this if I decide to start a new project again.

Does this support vertical movement/collisions as well?
 

rui.r6o

Member
Looks cool, I will definitely check it out later as the project I want to start will use sprite stacking! Just a question: does it support lighting and different types of materials (e.g. diffuse, metal, glass, emissive)?
 

Gizmo199

Member
Whoa, looks like you put in a great effort into this. Looks really cool! I experimented with sprite stacking some time ago and I'll definitely try to use this if I decide to start a new project again.

Does this support vertical movement/collisions as well?
Currently no. This is purely a rendering engine. I would, however, suggest using @TheSnidr Colmesh library with it though! ColMesh comes with a bunch of predefined shapes so you shouldn't have to mess with OBJs or anything

Looks cool, I will definitely check it out later as the project I want to start will use sprite stacking! Just a question: does it support lighting and different types of materials (e.g. diffuse, metal, glass, emissive)?
Currently, it does not. It is planned for the future to include lighting / True shadow casting. Idk about full materials though. Been thinking of creating a sprite-stack modeling tool, and if I do that then It would probably be a lot easier to add in materials. Essentially it's just a bunch of stacked quads, so normals can be tricky with them.
 

Pixel-Team

Master of Pixel-Fu
Damn! This looks awesome! My favorite was that little dude's legs when he's running. I'm gonna have to look into this once the Jam is over. Nice job!
 

gnysek

Member
At first I thought that it's one of those sprite stacking only engines, which generally are slow for more complex games, but seems it's not, and also have something similar to bilboards, which make things smooth enough to make a game!
 
Last edited:

Gizmo199

Member
At first I thought that it's one of those sprite stacking only engines, which generally are slow for more complex games, but seems it's not, and also have something similar to bilboards, which make things smooth enough to make a game!
Yeah, it's a 'fake 3d' engine but I use actual vertex buffers and projection matrices, so performance is actually maintainable. :) I plan to add in OBJ importation eventually so you can go the more 'true' 3d route if you wish. :)
 

Gizmo199

Member
Is there any possible make 2D multi-sprites faceing to the screen sametime?
not exactly sure what you mean? If you use draw_sprite_3d and set the facing_camera parameter to true it's the same as drawing a regular sprite that faces the camera at all times.
 

Gizmo199

Member
Not find the facing_camera in DOC 😂 😂

Implement that, thank your work again!
Sorry, its technically face_camera :p
Capture.PNG

Glad you found it! :D Can't wait to see what you come up with! I'm working on lighting and shadow casting now, so hopefully, soon that will be available! :D
 

gnysek

Member
but I use actual vertex buffers and projection matrices
I know that there's big performance issue with matrices on Xbox UWP, I will try to benchmark your code at some point and then report to YYG (cause maybe I was just using matrices wrong and your example will solve my problems xD).
 

Gizmo199

Member
I know that there's big performance issue with matrices on Xbox UWP, I will try to benchmark your code at some point and then report to YYG (cause maybe I was just using matrices wrong and your example will solve my problems xD).
Oh interesting! I have only been able to port/test on html5 and PC unfortunately. Was that with the YYC? Might have to write my own matrix functions but idk how well that would even work if it's an internal thing with GM.
 

Gizmo199

Member
V 2.2.0

GET VERSION 2.2.0 HERE

Nodes
  • [ADDED] World Environment Node
  • [ADDED] Point light node
  • [ADDED] Spot light node
Functions
  • [ADDED] fauxton_buffer_set_uniform_script(buffer_name_or_id, uniform_control_script)
  • [MODIFIED] draw_sprite_3d OPTIONAL parameter 'enable_lighting'
  • [MODIFIED] draw_sprite_3d_ext OPTIONAL parameter 'enable_lighting'
Fixed
  • [FIXED] fauxton_buffer_set (Would return an error)

Lighting is here!! With Fauxton 3D you can easily add lighting to a scene by just adding an instance of WorldEnvironment and either point lights or spotlights! Fauxton supports up to 64 different spot/point lights. This can be changed, however, by going into shd_default and change all numbers in the fragment shader that are 64. Let's look at what each of these nodes contains!

** NOTE **

If you override buffer shaders with your own you will have to calculate lighting in your new shader! It is suggested that you should duplicate the shd_default shader and its uniform script found in:

RenderPipeline

> pipeline_initiate()

> default_world_shader_set()


And then proceed to make your changes.



World Environment
First, we have the WorldEnvironment node. This node MUST be added to a room in order to enable lighting. There are a few options in this node under the Variable Definitions button.



AmbientColorThe ambient color of our scene. The ‘Shadow’ color in a sense.
SunColorThe Color of our directional light
SunIntensityThe intensity of our directional light
SunPositionThe position of our directional light
The AmbientColor will be the color of the ‘shadows’ or rather the color of the scene facing away from the sun. Setting this to white ( $ffffff / c_white ) will make it so that the shadows are completely illuminated.

The SunColor is the color of our scene lit from the SunPosition. The sun position is an array that contains an X, Y, and Z. These values should be between a value of -1 and 1. So for example:

[ -1, -1, 0 ]The sun is at the TOP-LEFT corner of the room at a z of 0 (straight on)
[ 1, 1, 1 ]The sun is at the BOTTOM-RIGHT corner of the point DOWN in z-space
Due to the fact that sprite-stacks are just a series of stacked planes on top of one another it should generally be avoided setting the sun's z-position to -1 (as you will not easily be able to see them illuminated from the bottom).

Point Lights
Point lights are SUPER easy to add-in. Once you have an instance of WorldEnvironment added to your room you can add up to 64 point or spot lights! You can find the attributes for point lights in the Variable Definitions:



zThe z position of the light
colorThe Color of the light
rangeThe radius or ‘range’ of the light

Spot Lights
Spotlights are SUPER easy to add-in. Once you have an instance of WorldEnvironment added to your room you can add up to 64 point or spot lights! You can find the attributes for spotlights in the Variable Definitions:



zThe z position of the light
colorThe Color of the light
rangeThe radius or ‘range’ of the light
cutoff_angleHow many degrees to cut light to (smaller = spike, larger = bowl)
angleThe x/y angle of the light (imagine this like image_angle)
z_angleThe z angle of the light (how much the light points up or down)

fauxton_buffer_set_uniform_script
This function allows you to set a custom shader uniform control script for a buffer created using fauxton_buffer_create.

Syntax:

fauxton_buffer_set_uniform_script( buffer_id_or_name, uniform_control_script);
ArgumentDescription
buffer_nameThe name (string) or ID (index) of the buffer to set
uniform_control_scriptThe shader uniform control script for the buffer
Returns:

N/A
Example:

GML:
var uniform_script = function(){

    var uni = shader_get_uniform(shd_grass_sway, "time");

    shader_set_uniform_f(uni, current_time/250);

}

fauxton_buffer_create("GrassBuffer", shd_grass_sway);

fauxton_buffer_set_uniform_script(“GrassBuffer, uniform_script);
First we create a script to control our grass shader called uniform_script. We then create a buffer, set the shader to shd_grass_sway and set the uniform control script to our uniform_script.
 
Last edited:

gnysek

Member
OK, I've tested it on UWP+Xbox One export and... I must say that it works better than on my PC :p
On Fidelity=2/Res=200%, first 3 demos are giving 60 FPS, and fourth one have 28-29 FPS (60 fps with fid/res=1).

What's fun, my PC with GTX 950M is showing 50 FPS at max on last one, so seems that Xbox One is better here (while as I mentioned earlier UWP sucks when having lot of matrix function calls per frame). Seems that UWP is buffer friendly. I did't checked Xbox Series X as it for sure wouldn't have worse results, and I got some suspended games there :p I'm not sure however why my PC was showing that only integrated GPU from Intel was used instead of GTX, I'm not sure if it shared some usage with it, or score was so bad cause GMS games won't run using Geforce.

Btw. camera for controller seems to be flipped, as up-down rotates it, and left-right changes height.

Edit: I've found a way to force to use GTX card, from "Screen settings/Display" in new Win10 fancy Settings panel there's "Graphic Settings" on very bottom, and by clicking there apps can be added an forced to use one of GPUs. Bad that GM isn't able to do run on proper card by itself.
 
Last edited:

Gizmo199

Member
OK, I've tested it on UWP+Xbox One export and... I must say that it works better than on my PC :p
On Fidelity=2/Res=200%, first 3 demos are giving 60 FPS, and fourth one have 28-29 FPS (60 fps with fid/res=1).

What's fun, my PC with GTX 950M is showing 50 FPS at max on last one, so seems that Xbox One is better here (while as I mentioned earlier UWP sucks when having lot of matrix function calls per frame). Seems that UWP is buffer friendly. I did't checked Xbox Series X as it for sure wouldn't have worse results, and I got some suspended games there :p I'm not sure however why my PC was showing that only integrated GPU from Intel was used instead of GTX, I'm not sure if it shared some usage with it, or score was so bad cause GMS games won't run using Geforce.

Btw. camera for controller seems to be flipped, as up-down rotates it, and left-right changes height.

Edit: I've found a way to force to use GTX card, from "Screen settings/Display" in new Win10 fancy Settings panel there's "Graphic Settings" on very bottom, and by clicking there apps can be added an forced to use one of GPUs. Bad that GM isn't able to do run on proper card by itself.
Omg thank you so much for all that info!!! You are a king! Strange that the axes are flipped?? I will look into that. Was that tested with v2.1 (I just release a newer version that has forward lighting). Eithet way thanks so much!!
 

gnysek

Member
Was that tested with v2.1
It was version with lighting, I've downloaded it yesterday right before testing, and I've used latest GMS2 beta to test it. I've only added code so R1/L1 was switching between rooms, also there was no cursor so I wasn't able to spawn grenades :p Generally it worked better than I thought, so I need to look deeply to take inspiration how to optimize code with buffers :)
 

Gizmo199

Member
It was version with lighting, I've downloaded it yesterday right before testing, and I've used latest GMS2 beta to test it. I've only added code so R1/L1 was switching between rooms, also there was no cursor so I wasn't able to spawn grenades :p Generally it worked better than I thought, so I need to look deeply to take inspiration how to optimize code with buffers :)
Nice! Well thanks again! Biggest optimizations are limiting matrix building. If possible (like static buffers) build the matrix once and re-use matrices if possible. Also (if you know the matrices you want) you can alter things like position with by just doing 'matrix[13] += speed' or whatever and that can help you avoid rebuilding matrices for small simple stuff.

Edit: and of course always batch as many vertices/models as possible to 1 vertex buffer.
Edit 2: Fixed the axes issue. Hadn't use the game-pad for testing since I switched some stuff around. haha woops! :p
 
Last edited:
Top