# Shawn Wang

NMVHS

LOCATION
Shanghai, China
WEBSITE

Not Specified

## Recent Forum Posts

#### Generate curves (geo) during simulation in DOPJan. 1, 2024, 9:04 a.m.

tamte
NMVHS
I feel like this involves creating a SOP context in DOP, but now sure how to do that.

processing of any geometry data in DOPs can be handled using SOP Solver DOP node
Thank you! I'll look into that.

#### Generate curves (geo) during simulation in DOPDec. 30, 2023, 3:10 a.m.

Hi everyone,

Curious to know if this is possible to do in DOP:

In a particle sim, generate curves (or mesh) based on the result of current frame's simulation, and then feed these generated curves back to simulation as guides so they can affect next frame's sim.

I feel like this involves creating a SOP context in DOP, but now sure how to do that.

Thanks!

#### usd point instancer reading external prototypesOct. 23, 2023, 7:27 a.m.

npetit
Here's an example:
Create a sphere, a cube and a torus, plug a python LOP and set it to use this code:

```from random import random, randint
import hou
from hou import hmath
from pxr import UsdGeom, Gf

node = hou.pwd()
stage = node.editableStage()

numinstances = 20

prim = stage.DefinePrim("/pointinstancer", 'PointInstancer')
pi = UsdGeom.PointInstancer(prim)
rel = pi.GetPrototypesRel()

protoindices = pi.GetProtoIndicesAttr()
protoindices.Set([randint(0,2) for x in range(numinstances)])

pos = pi.GetPositionsAttr()
pos.Set([[float(x * 5), 3.0, 0.0] for x in range(numinstances)])

rot = pi.GetOrientationsAttr()
rot.Set([Gf.Quath(*list(hou.Quaternion(hmath.buildRotate(random()*180, random()*360, random()*270)))) for x in range(numinstances)])

scl = pi.GetScalesAttr()
scl.Set([[random()*2+0.2]*3 for x in range(numinstances)])
```
Is there a way to do this with variants? For example, to have instancer randomly choose variants of a sphere.