By default, Defold renders different parts of your game separately. As it renders the different parts, you have the opportunity to manipulate each added layer as it is composed into the final image your players see.
This (among other things) is controlled in the .render_script
If you want to customize the settings of your game’s rendering you must make a new render script. Copy and paste the folder “render” from the “builtins” folder and paste it into the main folder of your project.
Next you need to modify the new copy of the main.render to point to the new copy of your main.render_script
Next you need to tell Defold to use your new copy of the render script and not the standard one.
Open the game.project and scroll until you see the boostrap section. Change the render: so that it points to your main.render script. Once you select the main.render script it will automatically add the c at the end, which is the eventual compiled version.
You can also manually type the path for entries like these if you know it. You do not have to press the … button and then search for it. If you do manually type the render_script url in don’t forget to add the c at the end.
Now that you have a new copy of the render script, you can change it to better fit the needs of your game… very radically if you wish. You can remove entire sections so they don’t render at all if you want.
The default render script is meant for 2d games - an orthographic projection without perspective. It ignores z depth in terms of scaling things with distance, and only uses z depth for layering. Defold is still a 3d engine always. By default, what looks like a 2d scene is still something rendered in a 3d world although in a flat way.
Though Defold is optimized for 2d games, it is possible to make 3d games with it, and to use 3d effects with it. Though making 3d games with Defold currently requires extra work on your part that may change in the future as features are built up by everyone involved.
If you have a 3d game with UI you’ll want to set the projection so that it is suitable for the 3d scene, and then set it back to orthographic projection (plus other things such as adjust camera) before you render your UI.
You don’t have to make a fully 3d game. You could make some 3d models and use them in special areas of your game, and then render as a layer in your render script.
You can still render 3d content in an orthographic projection too, but it will look flat.
You may have noticed the Cameras feature either as an option to add in the Defold Editor or when you glanced at the Camera Manual and thought that by changing the z distance of the camera you could change how everything seen by the camera can be scaled to be zoomed in and out, but hopefully after reading the previous text in this post you can understand that this would not be the case without changing the projection type.
Pro Tip! Read the Manuals!
Later I do plan to make some kinds of 3d games, and I’ll share the render scripts of how the back and forth with changing the settings. It’s still relatively new to me, and trying to explain things can help with learning them better too!