Mesh Smoothing in Godot

Link, Like, Share.

The Godot engine doesn’t specifically have a way to edit, manage or modify mesh smoothing (smooth shading), its essentially on or off based on how smoothing is set up on the model itself. In other words, to manage smoothing in Godot it has to be to meshes directly in Blender using judicial application of Shade Smooth and Shade Flat, which Godot then honours.

Download: example files provided below.
Blender Smoothing for Godot (c. 150 kb – *.blend).
Godot Smoothing (c. 50KB – *.glb, *.material, *.tscn).

Mesh Smoothing

Briefly, Shade Smooth in Blender, or ‘mesh smoothing’ more generally, is a way to define how objects shade in response to scene lighting. This is typically achieved altering the relationships between surfaces so they’re either contagious, that is treated as part of the same collection of faces, or broken, that is surfaces are treated as being independent from those around them. Where these two modes interact a ‘sharp’ or ‘hard’ edge is rendered giving the appearance of smoothed ‘groups’.

Design note: while Blender uses hard/soft edges for smoothing rather than ‘groups’, strategic placement can give the impression they are being used (smooth groups).

In Blender Smoothing is typically managed assigning the Sharp property to an edge, marking it so the application knows to display a ‘break’ or ‘hard line’ in a surface, and across an entire object, smoothing. For external use these edges have to be ‘realised’ or ‘made real’ using Apply and/or enabling Apply Modifiers during export (to FBX in particular), which physically splits vertices apart into coincidental pairings, one on either side of the divide. This separation is what Godot uses to render smoothing, whether surfaces are contiguous or broken.

Flat Shading vs Smoothing vs Fully Smoothed
On the left a simple sphere is fully facetted, that is each face is treated as being an individual surface for shading purposes. On the right a similar sphere is fully shaded, individual faces are part of a larger collection. In the middle shading is broken by use of Sharp edges creating the impression of regions or smoothed ‘groups’.

Managing Smoothing

To manage smoothing for Godot then, in Blender create objects as normal then assign smoothing through use of hard/soft edges. This can be done using Auto Smooth in Object Data Properties [1] set to an appropriate angle on incidence [2], or marking specific edges as Sharp in Edit Mode, then in Modifiers [3] adding an Edge Split modifier set to use Sharp Edges [4].

Design note: if edges are marked Sharp in either case and an angle set, they should remain intact in terms of defining an edge. In other words the angle of incidence shouldn’t override them.

Enabling Auto Smooth in Blender
Mesh Smoothing in Blender can be controlled in Object Data Properties [1] using the Auto Smooth setting that splits surfaces based on an angle of incidence [2]…

Enabling Edge Split Modifier
… whereas using an Edge Split modifier [3] specific edges can be split depending on their being marked as Sharp [4] in Edit Mode.

Export to Godot

To export meshes from Blender to Godot, with objects made and Smoothing defined per the above, select the items to be included in the *.glTF file then from the File menu chose Export then glTF 2.0 (.glb/.gltf) from the available options – File » Export » glTF 2.0 (.glb/.gltf). In the Blender File View that appears change the file name and save location as needed then in export settings to the right (press N if not visible) set Apply Modifiers [5] in Geometry to ensure the Split Edge or other modifiers are applied and fixed in placed by the process, and optionally set Selected Objects [6] in Include to export only the items selected. Click the Export .glTF 2.0 button to finish.

Design note: modifiers assigned to objects can be set before export so enabling Apply Modifiers in export settings may not be necessary. To do this in newer versions of Blender, in the modifier panel click the down arrow [a] and select Apply [b] from the list of options.

Apply Modifers in Blender
To manually set Sharp edges in place manually, select the object in question and in the Edge Split modifier panel click the down arrow menu icon and select Apply.

Apply Modifers at Export
During export to *glb or *.glTF any modifiers assigned to the mesh will need to be ‘applied’ so smoothing imports as expected. In export settings make sure to enable Apply Modifiers [5] (and optionally Selected Objects [6]).

Smoothed objects in Godot
In Godot, once successfully exported from Blender, meshes import with Smoothing intact; left – a fully facetted sphere (each face is independent of its neighbours); right – a fully smoothed mesh (all faces belong to the same ‘group’); centre – a combination (edges are marked Sharp so smoothing appears selectively).

Link, Like, Share.