Reader small image

You're reading from  Build Stunning Real-time VFX with Unreal Engine 5

Product typeBook
Published inMay 2023
PublisherPackt
ISBN-139781801072410
Edition1st Edition
Concepts
Right arrow
Author (1)
Hrishikesh Andurlekar
Hrishikesh Andurlekar
author image
Hrishikesh Andurlekar

Hrishikesh Andurlekar is the founder of Tplusplus Interactive, an Unreal Authorized instructor, owner of a Unreal Authorized training center and a Mentor at Mastered UK. He has been a CG Supervisor at Prana Studios and Pixion. He has been working as a contractor/consultant in Unreal Engine for 6 years with leading companies including Reliance Jio Studios, Monk Studios, Prime Focus and True Telecom delivering Games, Simulations, Virtual Production Solutions and AR/VR experiences. He has trained companies around the world through Epic Games. More than 3200 hours of 1-2-1 training conducted for major companies like Technicolor, Yashraj studios, Infosys, Tech Mahindra, TCS, Aptech among others.
Read more about Hrishikesh Andurlekar

Right arrow

Creating Custom Niagara Modules

Modules in Niagara enable us to achieve different behaviors for our particle systems. We are now familiar with a few of these modules. However, as you start working on advanced particle systems, it may not be possible to achieve the behavior that you require in your particle systems with the modules that are shipped with Niagara. This is when you may want to design your own custom modules. In this chapter, you will learn how to create your own custom Niagara modules.

The topics we will cover in this chapter are the following:

  • Creating a new module
  • The Niagara Module Script Editor
  • Editing a Niagara module to create custom effects

Technical requirements

You can find the project we worked on in this book here:

https://github.com/PacktPublishing/Build-Stunning-Real-time-VFX-with-Unreal-Engine-5

Creating a new module

So far, we have been using inbuilt modules to create our particle effects. The real power of Niagara is unleashed when you start developing custom modules. Custom modules give you unlimited control over all aspects of your particle system. They allow you to design custom behavior for your particle system. Developing these modules requires some basic knowledge of mathematics and vectors. We covered some of the basics at the beginning of the book.

We will be creating a particle system with a custom module that detects the presence of the player and changes the size and color of particles around the player. As the player walks around the particle system, the change in color and size will follow the player. It is not possible to create this behavior by using just the inbuilt modules. To achieve this behavior, we will need to write a script in our custom module.

Figure 7.1: The effect we will have achieved by the end of this chapter

While...

The Niagara Module Script Editor

The Niagara Module Script Editor looks suspiciously similar to a blueprint editor. This makes it easy for users familiar with blueprints to grasp the functionality easily. The nodes available here are completely different from what you otherwise see in a blueprint, although there may be a few nodes, especially the ones dealing with basic mathematics, that look similar.

Figure 7.6: The Niagara Module Script Editor

There are eight major areas in the editor.

Figure 7.7: The Menu bar

  • The Menu bar

This area contains commands to open/save the module, undo/redo options, a few asset commands, and commands to hide/show the different panels in the editor.

Figure 7.8: The Toolbar area

  • Toolbar

Along with the standard buttons to save and browse for the asset, the Toolbar area has buttons to Compile and Apply the script. There is also the new Versioning button, which...

Editing a Niagara Module to create custom effects

Now that we are familiar with the Niagara Module Script Editor, let us start working on the Presence Detector module we have created.

Before we start working on the actual code, let us first understand how the module works by looking at a simple example.

Understanding how the module works

This is an example where the module affects the size of a sprite based on the input values given by the user in the module’s Selection panel.

In the Node Graph panel, a template graph node will have been created with the InputMap, Map Get, Map Set and Output Module nodes added. We will keep the template graph node and start with our Module script by clicking on the + sign on the Map Get node. We want the user to be able to specify the size of the particle. We will use uniform scaling for the particle size. This means we can use a float input instead of a vector. The new float input value pin will be in Input Namespace, as indicated...

Summary

Learning how to create custom Niagara modules in the Niagara framework helps us extend the functionality of the framework to suit our needs better. Niagara modules are the building blocks of Niagara Systems, and by creating custom modules, we can tailor the systems to specific tasks or scenarios.

In this chapter, we learned how to create these custom module assets and encapsulate complex functionality in a single module. In the next chapter, we will see a different way in which custom modules can be implemented locally in a system.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Build Stunning Real-time VFX with Unreal Engine 5
Published in: May 2023Publisher: PacktISBN-13: 9781801072410
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $19.99/month. Cancel anytime

Author (1)

author image
Hrishikesh Andurlekar

Hrishikesh Andurlekar is the founder of Tplusplus Interactive, an Unreal Authorized instructor, owner of a Unreal Authorized training center and a Mentor at Mastered UK. He has been a CG Supervisor at Prana Studios and Pixion. He has been working as a contractor/consultant in Unreal Engine for 6 years with leading companies including Reliance Jio Studios, Monk Studios, Prime Focus and True Telecom delivering Games, Simulations, Virtual Production Solutions and AR/VR experiences. He has trained companies around the world through Epic Games. More than 3200 hours of 1-2-1 training conducted for major companies like Technicolor, Yashraj studios, Infosys, Tech Mahindra, TCS, Aptech among others.
Read more about Hrishikesh Andurlekar