Difference between revisions of "Korman:Soft Volumes"

m (Invert)
Line 31: Line 31:
  
 
=== Invert ===
 
=== Invert ===
As mentioned above, when enabling '''Invert''' on the Simple Soft Volume modifier, Korman does not simply swap the '''Inside Strength''' and '''Outside Strength'''. Rather, Korman creates an inverted Soft Volume and adds the original Soft Volume as an input. Functionally, '''Soft Volume Invert''' takes the input Soft Volume's result and multiplies it by -1.0.
+
As mentioned above, when enabling '''Invert''' on the Simple Soft Volume modifier, Korman does not simply swap the '''Inside Strength''' and '''Outside Strength'''. Rather, Korman creates an inverted Soft Volume and adds the original Soft Volume as an input. Functionally, '''Soft Volume Invert''' takes the input Soft Volume's result and multiplies it by -1.0, effectively swapping the sign of the numerical result.
 
<blockquote>NOTE: Soft Volume Invert will only accept one Soft Volume as an input.</blockquote>
 
<blockquote>NOTE: Soft Volume Invert will only accept one Soft Volume as an input.</blockquote>
  

Revision as of 22:49, 27 June 2016

Disambig gray.png

This is a tutorial page.Versions available: PyPRP; 3ds Max; Korman.
 

Typically, regions in Plasma have two settings: on or off -- either you are inside of it or outside of it. This would be referred to as a hard volume. Soft Volumes, on the other hand, allow a mechanism for artists to expose a transitional area in which the region is activating or deactivating. This could be roughly thought of as the way the volume of sound decreases as a listener moves away from its source. Soft Volumes accomplish this by assigning a numerical strength value to every point in space. Typically, inside the soft region the strength is 1.0 (or 100%) and fades at the boundary to 0.0 (or 0%). However, this is configurable by the artist.

Soft Volumes can be used in Korman to control sounds, runtime lights, and object visibility.

Simple Soft Volumes

Soft Volume Modifier

To create a simple soft volume in Korman, one simply needs to create a mesh and apply the Region > Soft Volume modifier. The default settings are for the region to be fully activated when inside and fully disabled when outside with no fade distance.

Blender cube from top

Typically in Blender, we deal with meshes whose faces are quadrilaterals. This is a good representation of traditional hard regions which tend to report when we are inside the exact bounds of said region. Soft Volumes, on the other hand, do not work on this principle. Rather, soft volumes are exported as a set of planes, one for each face on your Blender mesh. This is done so that the engine can evaluate the region's strength with respect to each plane. The result of the soft volume is the lowest strength value calculated by the engine.

Cube exported as soft volume planes

For example, your region is the cube shape shown above, and you're looking at it from the top. The soft volume version of this region is depicted to the right. Notice that you can still observe the shape of the mesh. Now, assume that your avatar is located at the green "X". The strength of planes B, C, and D would be whatever you set Inside Strength as. In this case, it is 100%. However, because we cross the boundary of plane A, this is going to be our lowest value, and therefore the value of the region. Based on the settings for Distance, we know that this region will not allow any fading at all, so the result is the value of Outside Strength, or zero. If distance were nonzero we would observe a graduate fade from Inside Strength to Outside Strength as we moved over outside plane A, up to Distance.

You could create an "inverted" region by swapping the values of Inside Strength and Outside Strength. This would mean the region is active when you are outside of it and inactive when inside of it. Alternatively, you can click the Invert checkbox in the modifier properties. However, this does not actually function the same way under the hood.

Complex Soft Volumes

As you can tell, Soft Volumes can be utilized to create intricate regions. Additionally, multiple Soft Volumes can be combined into a single Soft Volume to create more detailed effects. For example, you may want to have a single sound that fades out gradually on one side of a region but abruptly on the other side of the region. This can be done using the following techniques.

KorSoftVolumeModifierComplex.png

Complex Soft Volumes are made using nodes. To activate complex mode, click the node tree icon by Simple Soft Volume in the modifier panel. This will change the modifier to complex mode and will ask you for a node tree.

NOTE: Complex Soft Volumes should be attached to Empty objects. You will still need to have Simple Soft Volume modifiers attached to your region meshes, otherwise, Korman will not export any Soft Volume planes.

Switch to the Node Editor space and create a new Plasma node tree. Do not use a node tree with other logic nodes in it.

Remember: You will need to press the F button to the right of the node tree's name to ensure that Blender does not delete this node tree!
Soft Volume node tree output

The purpose of this node tree is to produce a "final" Soft Volume that can be referenced in lamps, sounds, and visibility regions by specifying the object you attached the Complex Soft Volume modifier to. To that end, we need to ensure that we add a Soft Volume > Soft Volume Output node to this tree so that Korman understands what you've created. This is similar to how Cycles material nodes work.

Invert

As mentioned above, when enabling Invert on the Simple Soft Volume modifier, Korman does not simply swap the Inside Strength and Outside Strength. Rather, Korman creates an inverted Soft Volume and adds the original Soft Volume as an input. Functionally, Soft Volume Invert takes the input Soft Volume's result and multiplies it by -1.0, effectively swapping the sign of the numerical result.

NOTE: Soft Volume Invert will only accept one Soft Volume as an input.
Soft Volume Invert node tree

To recreate the effect of the Invert checkbox using nodes, you will need to first add a reference to your Simple Soft Volume to the node tree by adding a Soft Volume > Soft Region node. This node allows you to specify any object that has a Soft Volume modifier attached to it.

Specifying a complex node-based Soft Volume using this node has undefined results. HERE BE DRAGONS -- errr -- just don't do it, okay?

Then, you connect the Soft Region node to a new Soft Volume > Soft Volume Invert node. You then connect that node to the output. Any light, sound, or visibility region you point to this Soft Volume will obey the rules set forth in this sample node tree.