HScript

Expressions, shell commands, and quick production references.

Reverse Time (TimeShift)

Play a frame range backwards using a TimeShift frame expression.

ContextTimeShift Use caseReverse Playback FieldFrame Expression
// Reverse time in a timeshift
($RFEND+1-$F)

Ping Pong Time

Create a forward-backward frame playback pattern in one expression.

ContextTimeShift Use casePing Pong Loop FieldFrame Expression
// Ping pong time
if($F <= ($RFSTART + $RFEND) / 2, $F, (2 * (($RFSTART + $RFEND) / 2)) - $F)

Opinput Path Syntax

Get the connected input node path from a parameter expression.

ContextNode Path Query Use caseInput Node Reference FieldParameter Expression
// opinput path syntax
`opinputpath("..",0)`

Random File Loader Path

Build a randomized texture file path using a seed parameter.

ContextFile Path Use caseTexture Variation FieldFilepath Expression
// random file loader in hscript example
$HIP/tex/Bark/Bark_`round(fit01(rand(ch('../colour_seed')), 1, 4))`_Displacement.jpg

String Path Channel Reference

Use a string parameter as a path source and query a channel from that node.

ContextString Path Reference Use caseHDA Parameter Linking FieldChannel Expression
//adding a string into a reference, useful for hda's
//this example referneces a camera in a string parameter and gets the x transform
ch(chsop("../camera")+"/tx")

Deep Volumetrics With V-Ray

Setup notes and linked expressions for deep volumetric rendering controls.

ContextV-Ray Deep Volumetrics Use caseDeep Rendering Setup FieldRender Parameter Notes
Deep volumetrics with v-ray
make sure deep output is enabled on the environment fog
best to turn off probalistic volumetics in the volumetric rendering options as it forces sampling based on the step size from what I can tell
distance, density and step size should all be linked, smaller values produce more steps in the deep image creating more deep samples but larger file sizes
best to test this as it relates to scene scale to find the optimum settings
// Density
1/100*ch("distance")
// Step Size
ch("distance")/2

Conditional Input Switch Expression

Route input index values based on a control parameter range.

ContextInput Switch Logic Use caseControl Based Routing FieldExpression Block
{
    input = 0;
    if (ch("../CONTROL/control")<1) {
        input = 0;
    } else if (ch("../CONTROL/control")>1 && ch("../CONTROL/control")<3) {
        input = 1;
    } else {
        input = 2;
    }
    return input;
}