Thursday, 23 January 2025

FluidNinja VFX Tool

     There are several different modules in FluidNinja: 

  • FluidNinja(Core): create density and velocity maps with particles/ textures/paint input
  • NinjaFields: create vector field data with velocity maps
  • NinjaFlow: create animated textures using velocity maps
I'll be focusing on the FluidNinja(core) for now.
Here is the actual manual on FluidNinja. Below are just quick notes with pictures as i play with the tool.

The FluidNinja GUI

    The right side shows the inputs and outputs. The left side drives what is seen, broken up into several parts. 

Canvas



    Clicking the top squares change whether you're viewing a single canvas or all four canvas. 
    Changing options here will affect the output canvas. The page icon is used to 'blank' the canvas, or to reset the simulation

Bake



    Has the stop and play button to stop and play the simulation. The record button (the circle) will bake out the current simulation. The number underneath determines your flipbook frame length. 

    Once you bake these canvases will replace the previous bottom two. The right side shows your flipbook. The left side you use to tell FluidNinja to save it as a texture, material, or png. 

Velocity and Density


    These are your main controls over the simulation's look.

Velocity

Note that all of these are tested with the Flower preset
  • Offset X and Y:  Changes the direction of the 'wind', or which way it flows. Gives it a direction
Offset X at 0.76, smoke is flowing to the right

Offset X at -0.56 and Offset Y at -0.79, smoke flowing to the upper left

  • Rotate: creates a circular flow
rotating at 0.39

  • Turbulence: Causes more swirling
Turbulence turned down to 0.01
Turbulence Turned up to 1.04

  • Amplify: determines the strength of the velocity field. Higher Positive values will make it go outward faster. Negative values will make it flow inward (inverted). 
Amplify at 0
Amplify at 20

Amplify at -20

  • Noise: the noise is actually masking the strength (amplitude) of the input velocity field. the noise is moving, so it helps to add fluctuations to the flow sim. (note the direction of the noise does not influence the direction of the flow, only the strength matters) (additional note: negative values do not seem to affect it)
Noise at 0.05

Noise at 1.38

Density

  • Input weight: controls how much the initial input particle affects the sim
  • Out weight: controls the speed of dissolve (the 'lifetime' of a virtual density particle). The larger the value the longer the output density particles live. If you have low values, it's more like a flame, and if it's higher it is closer to smoke.
Out Weight at 0.43

Out weight at 1

  • Shading: fakes directional light on the sim can give depth to smoke and emphasize edges on flames
Shading at 0

Shading at 0.98

  • Contrast: increasing it gives a more solid look to the sim
  • Hue: Increasing it gives the output density a color. Note this is only for visualization purposes and it is recommended to bake out the density maps as greyscale
  • Curl: adds a curl noise to the field, smudges density information. Note: curl offset can be animated, you have to edit the "VeloDirNoiseSpeed' param in the preset file
0 curl
20 curl

  • Sharpen: with negative values you can blur
  • CurlScale: changes size of curl noise, negative values removes details, positive value adds details

Input


    Ninja takes 3 different inputs to generate the density maps: Niagara particles, images, and paint mode. If you don't select any particles or images for input, it defaults onto the painting mode. 
    For particles, you can zoom in and reposition the particles in the simulation area using the Scale and Offset XY params.
    Note: try to keep the particle uassets in the same folder your preset is. Presets usually will recognize particles in the same folder or in subfolders. For testing keep the preset file higher in the folder hierarchy to broaden its scope to more folders. 
    You can edit a particle in Niagara and have it upload in real time in ninja to speed up the workflow.
    Another note: sometimes particles don't look the same in ninja and Niagara :( try these things to fix it:
  • switch particle systems type to LOCAL in Emitter properties > Local Space: ON
  • only have ninja open (having both ninja and niagara running gpu sim might interfere)
  • "Ninja is capturing the particle simulation using a fixed view angle, that might be different from your view angle in Niagara/Cascade editor. In case if something does not look the same, try to swap/flip axes (eg. something is aligned on the Z axis - and change that to Y)."

Export FGA 

    You can capture the current sim as a Field Grid Ascii (FGA) type data (vector field data), to drive GPU particles. Although it is recommended to use the other module NinjaFields

Wednesday, 22 January 2025

Tech Art Math Part 2

 More with Matrices

Why do we use Linear Algebra? To transform objects from one shape to another. Aka moving points from one object space to another. 

    A point can be defined as a vector in 3D space. 

Remember that the w needs to be 1 to be a point, 0 for a vector

Homogeneous Coordinates

    The extra 'w' designates position or orientation in the homogeneous coordinate system. Homogeneous coordinates allow translation to be performed in conjunction with rotations and scales.

    ‘w’ value of 1 accounts for position
    ‘w’ value of 0 accounts for orientation
    When multiplied against a 4x4 matrix a value of “0” nullifies translation

   If you multiple T * A, a 4x4 and 4x1 matrix together, you'll get another 4x1 matrix.

Translation Matrix


    First start with the identity matrix. Then in the 4th column assign the zeros with the z, y, z values you want to translate the point by. 

Scaling Matrix


    Instead of using the identity matrix, put the x,y,z scale value in the diagonal, with a 1 at the end of the diagonal.

Rotation Matrix


    You need three different rotation matrices for rotation. This works as well for 2D, use the z rotation matrix. (assume the theta is in radians)
    Right handed coordinate system determines which direction is the positive or negative rotation. Stick out your right hand, your thumb should point to your left. That is the positive x direction. If you curl your fingers inward, that direction is the positive x rotation. If you point your thumb up, that's the positive y direction. When you curl your fingers inward, that is the positive y rotation. 

    This matrix is for performing all the rotation matrices in one matrix. It's not very practical to use.


    Angle Axis has stuff to do with Quaternions. It helps to find an orientation of a vector. 

Concatenation

    Instead of multiplying point individually against each matrix, the transformation matrix can be concatenated into one matrix. The order is very important and not commutative.
    There are two types of Concatenation: Pre-(right to left) and Post-(left to right) Multiplication. Which one? Depends on what you do, open GL uses post-multiplication. Vulkan is the standard that we're moving towards in cg, so it uses Post-Multiplication 

Global Transformations

    All transformations are done relative to axis origin. 

    Pre-Multiply the matrices together!
p' = M * p = S * T * R * p

Local Transformations

    A transformations affect position and orientation of local axis. 
    Post- Multiply the matrices together
v' = M * v = R * T * S * v

    Why? Both methods can create similar results. OpenGL Fixed pipeline uses post-multiplication, therefore we probably should too. 

    To transform within context of Local coordinates: post multiply!
v' = I * T * Rz *Ry *Rx * S * v 
    This is the default Maya order
    To transform within context of Global coordinates: Pre multiply
v' - S * Rx * Ry * Rz * T I* v

But these are just one convention, Sometimes artists break order. Some softwares switch direction, some software matrices are column major, not row major, so matrices may need to be transposed. 
    Imagine you find the transformation matrix has the values in the bottom row instead of the final column. That means your point has to be transposed so that it fits in one row, so you can multiple a 1x4 and a 4x4 matrix to get the corrected final point. 

Tuesday, 21 January 2025

Lighting Workshops Week 3

 Post Processing

    We'll be taking a look at LUTs now. LUTs stand for color 'Lookup Table'. They're useful for adding color corrections in a post process volume. 

    This is the neutral LUT that unreal gives you in its documentation here.  You can take this into photoshop, apply several filters to it, and then export it back into Unreal. 

    Get a screenshot from your scene. Save it and bring it into photoshop (or any other photo editing program). You can apply any color adjusting layer that controls the overall color. 

    
    Once you're happy with the color adjustments, group all your layer adjustments, and copy this into a new file with the basic LUT image. Now your color adjustments are applied to the LUT. Export this out. (You can export out a PNG, TIFF, etc)

    Bringing it into Unreal, open the texture settings for it. Change the Texture Group of the LUT as 'ColorLookupTable'. If you don't do this step the colors will look off. 

    Select your post process filter, go down into Color Grading to find the Color Grading LUT option. 


    Apply the LUT and you should see the exact same colors that were in photoshop. 


Thursday Notes

Notes on Product Shots: When you want to light a product, the problem with lights are that they are additive. You want to show the actual color of the product or else it will be misleading. One of the techniques used is to mainly use Rim lights to separate it from the background, leave the intensity of the key low. 
    If you need to push the foreground out from the background, use a Rim light. 

Lighting the Car quick example


    Steps taken: 
  • got the car mode Cutlass, make sure its in your content folder under Cars>Cutlass
  • Bring in all the models, you'll need to assign the materials to the car now, select them all. (the new materials are in the textures folder given)

  • bring in a plane for the ground and several cubes for the background, for the materials we went onto fab and got a concrete plaster material and a shiny concrete material. 

  • Use the environment light mixer window to bring in all the basic environment lights. 


  • adding the spec: 
no spec

nice line spec

  •     Take a point light, then increase the source length so its a long skinny cylinder. This elongates the specular into a line. You can also control what light effects what objects using the light channels
    • There's currently only 3 channels and You'll have to change which ones are affecting which
default is that all lights are in channel 0

 
You also have to adjust the light channels on the object as well. The car is affected by channel 0 and 1

Point light only affecting the car in channel 1
Point light affecting channel 0 with everything else in it




Easy Notes Archive

 Tech Art Blueprints Demo Animation State Machines Part 1 Animation State Machines Part 2 Math for Tech Art Part 1 Math for Tech Art Part 2 ...