Using Scalars in ShaderMaker Pro
Power to the People

Save Lots of Time With a Single Math Function

 

Introduction

In this tutorial, I will demonstrate a simple technique to create ' virtual variables' that you can plug into other nodes.

This tutorial requires:

ShaderMaker Pro

The Shader

For this example, I created a simple shader in which two Tile Nodes are used to seed the spot colors in a Spots Node.

The Tile Size

The tile sizes are currently set to 0.10, or ten divisions of the width & height.

Changing the Size of the Tile
Suppose we wanted to change the size of the tile in both tile nodes to 0.20 ( 5 divisions).. We would have to change the Tile Width & Tile Height for each tile node, for a total of 4 operations before we could see the result of tile size change.
Change the Size of the Tile, Faster.

This is actually slower, initially. However, once it is set up, it will save you lots of time!

Create a Math Function Node, and call it "Tile Sizer". Set the function type to Add, and the inputs to 1.0, and 0.0, respectively.

Set up the Tile Nodes to Work with the Tile Sizer

Set the Tile Width & Height to 1.0 in each Tile Node.

Attach the Tile Sizer to the Tile Nodes

Drag the Tile_Sizer's Out to the Width & Height Input of each Tile Node.

Change the Size of the Tile with the Tile_Sizer

Set the top value in the Tile_Sizer node to 0.20.

Instantly, the Tile Nodes resize!

Why?

The result of the Math Function was 0.20.

0.20 multiplied by 1.0 ( the value of the Tile's width & height) = 0.20.

Changing this value, simultaneously changes all four inputs we plugged it into.

You'll come to appreciate this little trick with more complex shaders in which multiple nodes share a common scale factor.

As always, experimentation is the key. Have fun!

 

 

 

 

Contact Us | Privacy Notice
Copyright © 2000 Pixels Animation Studios, Inc. All rights reserved.
1-619-220-4902