Driving Global Effects (shared world space painting)


Search Knowledge Base by Keyword

You are here:

Introduction

The plugin allows you to rapidly create world-aligned textures at runtime which can form the basis of global effect systems (like fog-of-war) with just a few nodes.

Context-free world-space painting using the Paint World Direct node is the relevant workflow. We will use this node to paint a texture mapped along any two world axes (typically XY) and read this texture inside a post-processing material (for the purpose of this example, you can use it for anything though) to create a FoW system.

Make sure you’ve setup your project for world-space painting as described in the world-space UVs reference page.


Creating & updating the global texture

To create a fog-of-war system, we need our pawns to unfog areas as they move around. This is accomplished by using the Paint World Direct node to paint a stroke of desired radius around the pawn’s actor location.

Here is how the sample project achieves this:

“Unfog Areas” is called only when the pawn moves. You don’t need to do this every tick.


Rendering effects from our global texture

Now that we have a texture which tells us precisely which areas our units have unfogged, we just need to use the texture and render the desired effect.

This is achieved with just a single node and a very simple post-process material:

Observe how we’re using the Don_WorldSpace_XY node because we earlier specified that we were only interested in the XY plane while painting our texture.

 


The End Result

That’s really it! With just a few nodes we have created a simple fog-of-war system:

You can extend this concept in many creative ways to create any kind of global effect/gameplay system you need.

Paint blob collisions will allow you to generate pixel collisions from the areas you have painted allowing you to drive both gameplay and visuals using this technique.