Custom Bolt units (Unity’s visual scripting nodes)

  • Post comments:0 Comments

If you are using Unity's Visual Scripting tools (previously known as Bolt) you must have encountered situations where everything would be simpler if you had a custom unit (a graph node) that simply received some inputs and returned an output (like a black box), and which you could add to any graph instead of having to copy and paste a group of nodes / units that always do the same operation. I dug into the disassembled code of the Bolt libraries and learned some things about customizing units that may be useful for you.

Continue ReadingCustom Bolt units (Unity’s visual scripting nodes)

Light textures caching: Unity 2D Renderer optimization

  • Post comments:1 Comment

This article describes how to implement an optimization of the 2D lighting system that may drastically reduce the workload of the GPU in scenarios where a lot of static lights and shadows appear in camera. The technique is similar to the baked lightmaps used in 3D scenarios and requires that the developer does some previous work in the editor.

Continue ReadingLight textures caching: Unity 2D Renderer optimization

Constrained Delaunay Triangulation [Repost]

  • Post comments:0 Comments

The main purpose of this algorithm is to generate a triangle mesh in which the shape of most of the triangles are as little like a knife (thin and tall) as possible; or, in other words, they tend to be equilateral. The mesh is created from a point cloud and may have holes (other point clouds). Applications are many: terrain geometry, navigation meshes (triangle edges form the edges of a graph used for path-finding), physic colliders (recently, Unity added an option to optimize them)...

Continue ReadingConstrained Delaunay Triangulation [Repost]

LineRenderer2D: GPU pixel-perfect 2D line renderer for Unity URP (2D Renderer)[Repost]

  • Post comments:0 Comments

Unity provides developers with a great line rendering tool which basically generates a 3D mesh that faces the camera. This is enough for most games but, if you want to create 2D games based on pixel-art aesthetics, “perfect” lines do not fit with the rest of sprites, especially if the size of the pixels in those sprites do not match the size of the pixels of the screen. You will need lines that fulfill one main rule: each pixel may have a neighbor either in the same column or in the same row, but not in both. Unity does not help in this case, you need to work on your own solution.

Continue ReadingLineRenderer2D: GPU pixel-perfect 2D line renderer for Unity URP (2D Renderer)[Repost]