Modifying position using a Material

A less common thing to do is to use a Material to modify an object's position. This is commonly done in things such as water shaders. We do it using the World Position Offset node inside the Material's output.

Modifying position using a Material

We can modulate the output position of a vertex using some GPU math. This lightens the load of rendering realistic water on the CPU by a significant amount.

Getting ready

Create a piece of geometry in your world. Construct a new shader called Bob, which we'll edit to produce a simple bobbing motion for objects rendered with the material.

How to do it...

  1. In your new Material (named Bob), right-click and add

Get Unreal Engine 4 Scripting with C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.