A collection of various Houdini related things that doesn´t fit anywhere else.
VOPS
Snippet
If you want to make some small tweaks using vex inside a VOP network you can use a snippet
- Use a Snippet
- Create a plane
- Add an attribute noise float (not needed but will show additional tip)
- Set the attribute name to noise
- Add a Point VOP, step in the network
- Add a Snippet
- Connect the output P (from geometryvopglobal) to input next of the snippet
- Connect the output of the snippet to the input of geometryvopoutput
- When the snippet gets connected the input name will switch from next to the name of the incomming variable
- Note that you can rename the variable in the snippet with the Variable Name 1 input field
- Add the following lines to the Code Snippet
- This will adjust the y position based on the ptnum and the noise attrib that exists on the incomming points
float y = @ptnum*@noise*.4; P = set(P.x, y, P.z);
``
POP
Birth Rate
A good way to control the amount of particles being emitted is to keyframe the Const. Birt Rate (Birth tab) with values between 0 and 1. Then we can use the Scale Point Count by Area (Source tab) as a multiplier of points emitted.
Rest attribute
If we want to store the position where the particle was spawned we can create a rest attribute to the geo that we use as source. This attr can then be used at the sop level so do various things, maybe use as Cd. All attributes are inherited by default, we might axplicitly set which attrs to inherit.
POP Advect by Volumes
Lets use a velocity volume to advect particles.
- In the popnet after the source append a POP Advect by Volumes.
- Velocity source: point to the velocity volume
- Advection Type: Update Position
- This will explicitly set the position (instead of update force that implicitly will affect the position). We might want to set the position if we have nice, detailed velocity noise and would like to use this. (might be worth testing the other options as well)
- Velocity Update: Final Velocity
- We want to store the velocity if we want motion blur.
SOP
Wrangle
- Output Selection Group
Sets a group that will be highlighted when the node is viewed.-
In the wrangle write some code that will create a group
if(@P.y > 0){ @group_test = 1; }
-
Then on the tab Bindings we set the Output Selection Group to the group we want to be selected, in our case “test”
-
UI
Parameters
Color
- Color Parameter
- Sample screen color
- If you MMB press and hold on a color parameter you can sample the screen color.
- Sample screen color
- Node Color
- Color palette
- Press C in the network view to open up the color palette
- Set Node default color
- If you hold Ctrl while drag an drop on a node you will set the node default color.
- Note When you set the default color a JSON file called Default_Theme_theme.nodecolors will be created in the folder C:\Users\username\Documents\houdini18.5. A brute force way to reset all node colors is to delete this file. (I did not learn this from the docs but just tried it and it seems to work fine, so do this at your own discretion) You can also have a look at the documentation on the opdefaultcolor HScript command which is used to change the initial color of a node when it is put down (changing colors this way will also edit/create the same JSON file as described before)
- Color palette
Shelves
Recently I had an issue that the added shelves were not saved when Houdini was closed and reopened. A post in the Houdini forum mentioned that you could try to run Houdini as administrator one time to fix this issue, and it did!
Default desktop
- Edit > Preferences > General User Interface
- Startup in Desktop : Build
Flags
Flags represent some state information on the node, such as which node represents the output of the network. Different network types have different flags.
Selectable template flag
If you LMB ctrl click the template flag you will set the selectable template flag. This makes the geometry visible and allows you to select components from the templated geometry in the viewport, in addition to components on the geometry with the Display flag.
Volume
VDB Analysis
Gradient
We can use the vdb analysis node to calculate the gradient of an SDF. The value of a SDF is 0 at the surface, negative on the inside and positive on the outside. When we calculate the gardient of an SDF we will get a vector that points in the direction of where the values of the sdf increases. Then we can for instance use this vector field to drive particles.
- Append a VDB from Polygons node to the geo.
- Use World space for Band: Enabled
- It might be easier to use world space to decide how large padding we want instead of voxels.
- Exterior Band:
- Set the desired size
- Interior Band:
- If we do not fill the interior we can set this
- Use World space for Band: Enabled
- Append a VDB Analysis node
- Operator: Gradient
- Custom Name: vel
- Here we can give the filed a custom name if we want
- Now we have a vel vector filed that we can use for various things, for instance use in a popnet to advect particles using a POP Advect by Volume.
- We can noise up the volume using a volume vop.
Curl field (velocity)
- Append a bound sop to the geo that we wish to create a curl field around. Add panning if needed. The bound will be the size of our velocity volume.
- Append a volume sop to the bound.
- Rank: Vector
- Name: vel
- Dimensions
- Uniform Sampling Divs: 100
- Note, the more subdivs we use the more detail we can get in our curl noise.
- Uniform Sampling Divs: 100
- Append a VDB from Polygons to the input geo.
- Use Worldspace for band
- Exterior Band: 2
- Interior Band: 1
- Append a Volume VOP and connect the volume sop to the first input and the VDB from Polygons to the second and dive in.
- Create a Vector to Vector4 and connect P and time.
- Create a Curl Noise and connect the hvec from the Vector to Vector4 and connect the OpInput2 (our vdb that created the sdf) to the sdf input of the curl noise.
- Create a Bind Export node and set the name to vel and connect the noise output to the input of the bind export.
- We will promote Frequency, Roughness and Surface Effect Radius
- Note that the Surface Effect Radius will control how for the curl noise will be affected from the sdf surface. Larger value means it will reach farther out.
- We have now created a velocity volume with a curl noise. We can for instance use this inside a pop simulation to advect the particles.
Tips
UI
- Quick relative channel Reference
- Select the value in the parm you want to use as source
- LMB drag and drop the text on the parameter you want to drive
- choose Relative Channel Reference
HScript
- Switch
- Alternate two inputs
- Lets say you want to switch between two streams to visually debug/inspect a network. Use this expression in a switch to use the first input for 24 frames then the second for another 24 and so on:
$F%48<24
- Lets say you want to switch between two streams to visually debug/inspect a network. Use this expression in a switch to use the first input for 24 frames then the second for another 24 and so on:
- Loop through inputs
- Switch to the next input every fifth frame, loop forever.
floor($F/5)%opninputs('.')
- Tips from Christopher Rutledge
- Switch to the next input every fifth frame, loop forever.
- Alternate two inputs
- Remap HScript Sin
- The sin function (using hscript expression) expects the value to be in degrees!
- Time based
- The time value at frame 0 is -1.0/$FPS (one time step negative)
- So to remap a parameter using a sin function you could do this
fit(sin((($T+1.0/$FPS)*360-90)), -1, 1, 10, 15)
- This assumes that you want to start at frame 0
- also that you want the sine value to be -1 at frame 0
- Themn we just remap between 10 - 15 in this case
- Frame based
fit(sin(((fit($F, 0, 47, 0, 4))*360-90)), -1, 1, 10, 15)
- The value will oscillate between 10 and 15 4 times over the frame range 0-47
Hips
adjust_prim_lengths_v01.hiplc
assign_material_and_split_by_y_position_01.hiplc
axiom_setup.hiplc
box_axis_geo.hiplc
button_strip_bitmask.hiplc
cop_number_mosaic_01.hiplc
dihedral_01.hiplc
for_each_fetch_feedback_01.hiplc
group_find_path_01.hiplc
hf_tests_01.hiplc
hf_tests_02.hiplc
ik_chain_rig.hiplc
karma_instancer_motionblur.hiplc
karma_lens_shader_01.hiplc
kinefx_compute_transform_01.hiplc
kinefx_layered_rig_01.hiplc
kinefx_pointtransform_01.hiplc
kinefx_vex_01.hiplc
lop_assign_material_01.hiplc
lop_houdini_procedural_RBD.hiplc
pop_interact_grow_curve_folding_01.hiplc
rbd_setup_example_01.hiplc
rop_opengl.hiplc
rotate_vector2_01.hiplc
sop_solver_examples_v01.hiplc
terrain_anim_iso_lines_v01.hiplc
top_wedge_mosaic_v01.hiplc
unshaded_color_01.hiplc
usd_assign_mat_with_vex_01.hiplc
vellum_18_ltree_mass_based_by_distance_v01.hiplc
vellum_basic_setup.hiplc
vellum_emit_sticky_collision.hiplc
vop_vdb_gradient_to_vel_v01.hiplc
waves_01.hiplc