Divinity: Original Sin 2 has an amazing range-of-attack display. When I select a character's abilities, the range of the ability will appear (as shown in the screenshot below).

I'd like to know how to create an effect like this.


You can see this system in motion via this YouTube video

I think It just displayed navmesh , so I tried to display my navmesh.I used NavMesh.CalculateTriangulation() , GL API to displaying.

After baking navmesh attach this script to your camera and give this a material:

using System.Collections;
using System.Collections.Generic;
using UnityEngine.AI;
using UnityEngine;

public class NavmeshDebuger: MonoBehaviour {
    public Material material;

    void OnPostRender() {
        var triangulation = NavMesh.CalculateTriangulation();
        if (material == null) {

        for (int i = 0; i < triangulation.indices.Length; i += 3) {
            var triangleIndex = i / 3;
            var i1 = triangulation.indices[i];
            var i2 = triangulation.indices[i + 1];
            var i3 = triangulation.indices[i + 2];
            var p1 = triangulation.vertices[i1];
            var p2 = triangulation.vertices[i2];
            var p3 = triangulation.vertices[i3];
            var areaIndex = triangulation.areas[triangleIndex];
            Color color;
            switch (areaIndex) {
            case 0:
                color = Color.red; break;
            case 1:
                color = Color.green; break;
                color = Color.blue; break;




  • 1
    \$\begingroup\$ I think D:OS and D:OS2 have a grid-based system (from my experience playing both games). They check whether your character can see those grids and "light them up", but this doesn't necessarily mean that you can hit anywhere that is not grayed out. It just means that you can see it and can target it somewhere within that grid tile. \$\endgroup\$ Jan 8, 2018 at 6:14
  • \$\begingroup\$ To add to John comment. They probably don't just create mesh because it would be too performance heavy. Instead they could create a texture and have visual shader that grey-scales this area. Actually like fog of war, it's the same (it is fog of war). To lead you to the right path on creating fog of war - you would probably want a small texture something like 256 x 256 created and then scale it up to something like 1024, or 2048 and blur it out. - I guess it was this way, League of Legends has blog-post where they explain how they do fog of war. \$\endgroup\$ Mar 13, 2018 at 9:28
  • \$\begingroup\$ closely related to your question, I recently blogged about rendering outlines on the ground, in an approach that could be easily adapted to this effect newarteest.wordpress.com/2019/12/21/… \$\endgroup\$
    – jhocking
    Aug 1, 2020 at 18:54

1 Answer 1


I believe you want to extrude the mesh at each vertex by moving it out by the normal * some fixed scalar. (This leads to some issues around edges)

Here is a more detailed explanation: How do I generate a 3D race track from a spline?

and https://stackoverflow.com/questions/3039026/edges-on-polygon-outlines-not-always-correct/3058978#3058978 for corners


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .