I have been looking for a way to implement this for a while but so far I haven’t found a good solution.
The basic idea is to create a similar system as in Foundation.
Each time a character walks across the landscape, data is added to a mask or something similar that increases in strength with each character that walks across the same spot until a solid dirt path is visible. If the paths are not used frequently, they slowly fade away. Articel on Foundations path generation
Most of the times I hoped I can hijack on something similar like this tutorial for snow deformation. The issue with this is that it useses a RenderTarget and this would be to costly for the entitre Map. In this tutorial it’s solved by a smaller render target that follows the player around. What works fine for this effect and one player and not dozen of AI pawns, also in this tutorial previous data is discarded once it is off the render target.
The first time I tried this was with a Heatmap tutorial but it is basicaly the same issue as it uses a render target.
I have one or two more Ideas how to get this done but I tought before I do this I ask here if anyone has a better Idea on how to implement this.
Create an invisible gird over the map, round pawn locations to points on the grid and use this to spawn meshes or better splines that connect the points. The grid data would be stored with an additional value that increases with each pawn that walks over it and every point would decrease in strenght on a fixed intervall to fade paths away again if they are not frequently used.
Another Idea I have floating around is that each pawn spawns a bunch of small meshes everytime they walk around. Each mesh has a lifetime and over time there would be so many meshes in one spot that it would look like a path. But this would end up spawning thousands or tenthousands of meshes at which point performance propably takes a huge hit.
mmh, so I would spawn decals behind pawns instead of meshes? And then maybe set them to be additative. aren’t decals in a huge number also really expensive?
After some searching I stumbelt across fog of war. Maybe I can hijack a fog of war system and inverse and make it stick around.
I followed his instructions to hide grass under buildings with the RVT.
This actually got me thinking about this problem again, as I thought I could use this in some way to get the paths. But that only works if there is something in a certain place at anygiven time. I would need a way to store this data somehow and the only ways I have found so far is either write it to a render target or do it with a grid and data table.
Maybe I could use this and spawn splines based on the grid data, but then spawning splines has this huge problem of figuring out which points should make 1 path/spline. The basics wouldn’t be too hard. I could look to see if a nearby point meets the criteria to spawn a road and if so, add it to the spline, but then corssing or nearby paths would be hard to figure out what to connect.
This gives me some ideas, but I’m still not sure how to actually get and store the data needed to draw the roads.
I just got the acutal tracking and writting to the render target to work without a scene capture what is, to my understanding, what made all these other Methods with a render target I looked into so expensive.
I think I can use the virtual texture road approach with this and get the locations from the render target and not the spline to draw the paths onto the landscape.
Any idea how I can apply a texture over the whole render target to fade out everything that is draw onto it over time?
I tried to do the same as with the Material that draws the pawn movement to the render target but instead of doing it at a specific location and as a circle I use a black Material but it does not seem to affect any of the white paths that where drawn by the pawns on the rendertarget. I changed the color of it to check if it does anything and it does change everything that was black to the color I set but not the white paths.
Edit: oh wait, still wraping my head around materials. Is it because white is 1 and black is 0 so adding black (0) to white (1) doesn’t do anything?
Edit: Found a solution. I writte the render target to a new render target with less Intensity clear the original one and writte the less intense copy back to the original and then clear the less intense one. Triggering this from a timer gives me slowly fading out paths. I can adjust how often this should happen and how strong the difference should be.