Nicolas Longchamps

Nicolas Longchamps

About Me

Game Artist


Recent Forum Posts

Scatter 250 rocks using HF scatter Nov. 11, 2019, 12:03 p.m.

The way i usually load files from disk, assuming they are in the same folder:

- use a python node to read from a directory, create a point per file found that i want with the path and name as point attributes.

import os

node = hou.pwd()
geo = node.geometry()

#get dir contents
dir = node.evalParm('pPath') # from path parm
dirContent = os.listdir(dir)

#create pt attribs
attribPath = geo.addAttrib(hou.attribType.Point,'filePath','')
attribName = geo.addAttrib(hou.attribType.Point,'fileName','')

#loop over dir contents
for f in dirContent :

    p = os.path.join(dir,f)
    #make sure it is a file and type is bgeo
    if os.path.isfile(p) and os.path.splitext(p)[1] == '.bgeo':
        pnt = geo.createPoint()
        pnt.setAttribValue(attribPath, os.path.abspath(p) )
        pnt.setAttribValue(attribName, f )

Then a for loop, iterate over points. For each point load the file given the path in the point's attrib. Load directly or as packed disk prim. Add class or name attrib based on loop iteration.

The HF Scatter node allows to define pieces by attribute. However i found name attribute doesn't work, so it possibly doesn't like string attribs. Use an integer attrib like class. Using this method you can scatter your 250 objects in one pass.

One bug i found however is that the point relaxation is done before object instancing, so i think the relax does not take into account the actual instance size, just the scale value in the “variability” section. Im not sure how to fix that without cracking open the scatter tool.

Flat Road projected onto surface / topography Nov. 4, 2019, 1:22 p.m.

Project only the center of your road onto the terrain. then extend the sides. Or if you road mesh is already done, project the center of the cross sections, leaving them flat. Then project the heightfield to the road to adapt the terrain.

View simulation in Scene View when outside of DopNet Oct. 23, 2019, 11:18 a.m.

In the Scene View, there's a pin next to the path bar. This path is what you are currently viewing. Just pin it when inside the DOP and it should stay there a you navigate elsewhere in your graph.