Usually we think of rendering as “turning our scene into a frame on the screen”. However, as described in Rendering to Textures: Shadows, Cubemaps, and Special Effects, that’s not the only use-case for the rendering pipeline. Sometimes, we want to render something onto a texture and use that texture elsewhere. One common example is thumbnails: if you have a 3D game with an…
This article expands on the previous parts of the grass rendering series and makes it feasible for real-world use with a level-of-detail system utilizing impostors. If you want to implement a grass effect from scratch yourself, definitely go through the previous parts first, starting at Grass Rendering Series Part 1: Theory. However, this tutorial will also be useful if you just want to learn…
When starting up an empty 3D scene in Godot, the editor provides a default lighting and environment setup. That way, you can start working on a scene without immediately having to figure out the lighting and background of a pitch-black scene. It looks something like this: This is a fine start as a general-purpose entry point. However, I’d argue that you’ll want to invest some time into…
In the previous part, Grass Rendering Series Part 2: Full-Geometry Grass in Godot, we worked on placing and shading blades of grass to get a realistic-looking field of grass into our scene. It looks nice, but it’s completely static: it looks good on screenshots, but in a game, you’d want your grass to look lively and react to what’s happening around it. Therefore, in this third…
In this second part of the Grass Rendering series, we’ll go over one possible implementation of grass in Godot. It will be full-geometry grass, meaning that each grass blade is an actual 3D object. This is in contrast to the also very popular billboard grass, where multiple blades of grass (or other plants) are drawn onto a transparent texture, which is rendered onto quads scattered across…
This is part 1 of a multi-part series on grass rendering. We’ll start by figuring out how realistic grass should look like, and how herbage can be modeled with the tools we have at our disposal in real-time 3D graphics. Then, we’ll look at how to implement different methods of grass rendering in Godot. However, most of the tutorial will not be Godot-specific aside from some node names…
When we use a camera in a game, it’s usually to choose what the player sees and send it to the monitor. As explained in Introduction to Shaders, the GPU gets the current frame data from the CPU, processes it, and sends the final pixels to its video outputs (or to the operating system - this is essentially the difference between “Fullscreen” and “Windowed Fullscreen”).…
Handpainted Light Shader: Cross-Hatching in Godot showed how to use textures in light shaders to apply hand-painted shadows. We can use a similar technique for halftone shading, where shades of darkness are represented by black dots of varying size: This effect reads from a texture and wraps it in a step function to get dots of varying size, much like how we got a line of varying thickness in…
In Understanding Godot Light Shaders and Light Calculations by Implementing a Toon Light Shader, we discussed light shaders and how you can use functions like step() to switch from realistic to toon lighting. Here, we will use light shaders along with a hand-painted texture to create a cross-hatching effect. Cross-hatching is a (pencil) shading technique that looks like this: Bright areas are left…
In Introduction to Shaders, we discussed the two most common shader types: Vertex and Fragment. Godot offers another function to override: the Light shader. In this tutorial, we’ll see what we can do with this shader. To do so, we’ll have to look into how light is generally calculated in real-time 3D environments, how to implement this ourselves, and how to make changes to it to get a…
In this post we’ll go through the process of making a simple lightning VFX using a shader, from conception to implementation. In the process, we’ll learn about step() and smoothstep, both very important and popular functions to achieve all kinds of effects in shaders, as well as (Signed) Distance Fields, which sound intimidating but are really quite simple. First, let’s think…
Overview Shaders are everywhere, but these days you rarely have to write them yourself. Game engines come with a multitude of shaders which do everything from moving objects, scaling and rotating them, to coloring and texturing them, calculating lighting (perhaps using a physically-based rendering approach), and applying post-processing effects like bloom or HDR. But sometimes these built-in…