Jump to content

# 'Dart throwing' algorithm

## Recommended Posts

Saw this instagram post. The 'dart throwing' algorithm is also something that Simon Holmedal talks about

Anyone care to suggest how to create this using Vex?

#### Share this post

##### Share on other sites

I think this is as simple (and naive!) as multi-radius dart throw gets. No space partioning, no optimisations. Simple raw dart throwing. The image below took 2 minutes to cook. There are much better ways via relaxation, rigid bodies, circle packing etc. Many of them are on this site I think.

dt.hipnc

• 1

#### Share this post

##### Share on other sites
3 hours ago, julian johnson said:

I think this is as simple (and naive!) as multi-radius dart throw gets. No space partioning, no optimisations. Simple raw dart throwing. The image below took 2 minutes to cook. There are much better ways via relaxation, rigid bodies, circle packing etc. Many of them are on this site I think.

no, not always,  it really depends on what do you want to do, some strats doesnt works on some cases, in a complex project it just complicates everything.  the darth throw is still important!

#### Share this post

##### Share on other sites

I just tried it with a SOP Solver, scattered random positions with uvsample() and then filter them out by their distance to the closest of nearpoints().

```vector pos_uvw = rand(@Time) * {1, 1, 0};
float dist_uv = xyzdist(2, pos_uvw);

if( dist_uv < 1e-5 ){
vector pos_geo = uvsample(1, 'P', 'uv', pos_uvw);
float rad_pt = fit01( rand(@Time + 45), 0.02, 0.1 );

int pts_close[] = nearpoints(0, '!mesh', pos_geo, 0.5, 2);
vector pos_close = point(0, 'P', pts_close[1]);
float dist_close = distance(pos_geo, pos_close);
float rad_close = point(0, 'pscale', pts_close[1]);

float t = dist_close - rad_close - rad_pt;

if( len(pts_close) <= 0 || t > 0.0 ){
int pt_add = addpoint(0, pos_geo);
setpointattrib(0, 'pscale', pt_add, rad_pt, 'set');
}
}```

While it does some filtering, it still produces fairly obvious intersections:

Is there something about the SOP solver I dont understand (maybe some syncing issue?) or what did I miss here?

dart_throwing.hiplc

#### Share this post

##### Share on other sites

couple of things:

- you are finding 2 closest points, but excluding the first, since the first is the closest, you are risking the intersections with it

- even checking just the first, will not guarantee no intersections, cause closest point can have small radius so it can satisfy the distance constraint, but the second or third closest can have big radius and actually intersect you new point even though it's further, so you'd have to check all points within 2*maxpscale radius

- to avoid all this, use pcfind_radius() which directly checks against pscale intersections, also you can directly use uvdist() to avoid having uvmesh

here is modified code and the file:

```int primid; vector primuv;
vector pos_uvw = rand(@Time) * {1, 1, 0};
float dist_uv = uvdist(1, "uv", pos_uvw, primid, primuv);

if( dist_uv < 1e-5 ){
vector pos_geo = primuv(1, 'P', primid, primuv);
float rad_pt = fit01( rand(@Time + 45), 0.02, 0.1 );

int pts_close[] = pcfind_radius(0, "P", "pscale", 1, pos_geo, rad_pt, 1);

if( len(pts_close) == 0){
int pt_add = addpoint(0, pos_geo);
setpointattrib(0, 'pscale', pt_add, rad_pt, 'set');
}
}```

dart_throwing_mod.hiplc

• 4

#### Share this post

##### Share on other sites
6 hours ago, anim said:

use pcfind_radius() which directly checks against pscale intersections, also you can directly use uvdist() to avoid having uvmesh

Thank you Tomas! I put together a little video tutorial summing it all up:

#### Share this post

##### Share on other sites

Thanks guys.

Super useful feedback

#### Share this post

##### Share on other sites

Hi guys,

there is much simpler solution I think, or maybe I do not understand what you want to achieve exactly...

1. scatter some random points

2. point wrangle with this conde
@pscale = distance(@P, point(0, "P", nearpoints(0, @P, 0.5)[1])) * 0.45;

3. sphere copy to points

all you need to do than is just delete all points but those you want

4. second line in the wrangle ( 10 points more every frame )
@ptnum * 0.1 > @Frame ? removepoint(0, @ptnum) : 0;

here the scene saved out with opscript
just copy paste it into Textport

# Automatically generated script
\set noalias = 1
set saved_path = `execute("oppwf")`
opcf /obj

# Node scatter_points (Object/geo)
opadd -e -n geo scatter_points
oplocate -x -1.9984567901234569 -y 0.84104938271604945 scatter_points
opspareds '    group {         name    "stdswitcher4"         label   "Transform"          parm {             name    "xOrd"             baseparm             label   "Transform Order"             joinnext             export  none         }         parm {             name    "rOrd"             baseparm             label   "Rotate Order"             nolabel             export  none         }         parm {             name    "t"             baseparm             label   "Translate"             export  all         }         parm {             name    "r"             baseparm             label   "Rotate"             export  all         }         parm {             name    "s"             baseparm             label   "Scale"             export  none         }         parm {             name    "p"             baseparm             label   "Pivot Translate"             export  none         }         parm {             name    "pr"             baseparm             label   "Pivot Rotate"             export  none         }         parm {             name    "scale"             baseparm             label   "Uniform Scale"             export  none         }         parm {             name    "pre_xform"             baseparm             label   "Modify Pre-Transform"             export  none         }         parm {             name    "keeppos"             baseparm             label   "Keep Position When Parenting"             export  none         }         parm {             name    "childcomp"             baseparm             label   "Child Compensation"             export  none         }         parm {             name    "constraints_on"             baseparm             label   "Enable Constraints"             export  none         }         parm {             name    "constraints_path"             baseparm             label   "Constraints"             export  none         }         parm {             name    "lookatpath"             baseparm             label   "Look At"             invisible             export  none         }         parm {             name    "lookupobjpath"             baseparm             label   "Look Up Object"             invisible             export  none         }         parm {             name    "lookup"             baseparm             label   "Look At Up Vector"             invisible             export  none         }         parm {             name    "pathobjpath"             baseparm             label   "Path Object"             invisible             export  none         }         parm {             name    "roll"             baseparm             label   "Roll"             invisible             export  none         }         parm {             name    "pos"             baseparm             label   "Position"             invisible             export  none         }         parm {             name    "uparmtype"             baseparm             label   "Parameterization"             invisible             export  none         }         parm {             name    "pathorient"             baseparm             label   "Orient Along Path"             invisible             export  none         }         parm {             name    "up"             baseparm             label   "Orient Up Vector"             invisible             export  none         }         parm {             name    "bank"             baseparm             label   "Auto-Bank factor"             invisible             export  none         }     }      group {         name    "stdswitcher4_1"         label   "Render"          parm {             name    "shop_materialpath"             baseparm             label   "Material"             export  none         }         parm {             name    "shop_materialopts"             baseparm             label   "Options"             invisible             export  none         }         parm {             name    "tdisplay"             baseparm             label   "Display"             joinnext             export  none         }         parm {             name    "display"             baseparm             label   "Display"             export  none         }         parm {             name    "viewportlod"             label   "Display As"             type    ordinal             default { "full" }             help    "Choose how the object\'s geometry should be rendered in the viewport"             menu {                 "full"      "Full Geometry"                 "points"    "Point Cloud"                 "box"       "Bounding Box"                 "centroid"  "Centroid"                 "hidden"    "Hidden"                 "subd"      "Subdivision Surface / Curves"             }             parmtag { "spare_category" "Render" }         }         parm {             name    "vm_rendervisibility"             label   "Render Visibility"             type    string             default { "*" }             menureplace {                 "*"                             "Visible to all"                 "primary"                       "Visible only to primary rays"                 "primary|shadow"                "Visible only to primary and shadow rays"                 "-primary"                      "Invisible to primary rays (Phantom)"                 "-diffuse"                      "Invisible to diffuse rays"                 "-diffuse&-reflect&-refract"    "Invisible to secondary rays"                 ""                              "Invisible (Unrenderable)"             }             parmtag { "mantra_class" "object" }             parmtag { "mantra_name" "rendervisibility" }             parmtag { "spare_category" "Render" }         }         parm {             name    "vm_rendersubd"             label   "Render Polygons As Subdivision (Mantra)"             type    toggle             default { "0" }             parmtag { "mantra_class" "object" }             parmtag { "mantra_name" "rendersubd" }             parmtag { "spare_category" "Geometry" }         }         parm {             name    "vm_subdstyle"             label   "Subdivision Style"             type    string             default { "mantra_catclark" }             hidewhen "{ vm_rendersubd == 0 }"             menu {                 "mantra_catclark"   "Mantra Catmull-Clark"                 "osd_catclark"      "OpenSubdiv Catmull-Clark"             }             parmtag { "mantra_class" "object" }             parmtag { "mantra_name" "subdstyle" }             parmtag { "spare_category" "Geometry" }         }         parm {             name    "vm_subdgroup"             label   "Subdivision Group"             type    string             default { "" }             hidewhen "{ vm_rendersubd == 0 }"             parmtag { "mantra_class" "object" }             parmtag { "mantra_name" "subdgroup" }             parmtag { "spare_category" "Geometry" }         }         parm {             name    "vm_osd_quality"             label   "Open Subdiv Quality"             type    float             default { "1" }             hidewhen "{ vm_rendersubd == 0 vm_subdstyle != osd_catclark }"             range   { 0 10 }             parmtag { "mantra_class" "object" }             parmtag { "mantra_name" "osd_quality" }             parmtag { "spare_category" "Geometry" }         }         parm {             name    "vm_osd_vtxinterp"             label   "OSD Vtx Interp"             type    integer             default { "2" }             hidewhen "{ vm_rendersubd == 0 vm_subdstyle != osd_catclark }"             menu {                 "0" "No vertex interpolation"                 "1" "Edges only"                 "2" "Edges and Corners"             }             range   { 0 10 }             parmtag { "mantra_class" "object" }             parmtag { "mantra_name" "osd_vtxinterp" }             parmtag { "spare_category" "Geometry" }         }         parm {             name    "vm_osd_fvarinterp"             label   "OSD FVar Interp"             type    integer             default { "4" }             hidewhen "{ vm_rendersubd == 0 vm_subdstyle != osd_catclark }"             menu {                 "0" "Smooth everywhere"                 "1" "Sharpen corners only"                 "2" "Sharpen edges and corners"                 "3" "Sharpen edges and propagated corners"                 "4" "Sharpen all boundaries"                 "5" "Bilinear interpolation"             }             range   { 0 10 }             parmtag { "mantra_class" "object" }             parmtag { "mantra_name" "osd_fvarinterp" }             parmtag { "spare_category" "Geometry" }         }         group {             name    "folder0"             label   "Shading"              parm {                 name    "categories"                 label   "Categories"                 type    string                 default { "" }                 help    "A list of tags which can be used to select the object"                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "reflectmask"                 label   "Reflection Mask"                 type    oplist                 default { "*" }                 help    "Objects that will be reflected on this object."                 parmtag { "opexpand" "1" }                 parmtag { "opfilter" "!!OBJ/GEOMETRY!!" }                 parmtag { "oprelative" "/obj" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "refractmask"                 label   "Refraction Mask"                 type    oplist                 default { "*" }                 help    "Objects that will be refracted on this object."                 parmtag { "opexpand" "1" }                 parmtag { "opfilter" "!!OBJ/GEOMETRY!!" }                 parmtag { "oprelative" "/obj" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "lightmask"                 label   "Light Mask"                 type    oplist                 default { "*" }                 help    "Lights that illuminate this object."                 parmtag { "opexpand" "1" }                 parmtag { "opfilter" "!!OBJ/LIGHT!!" }                 parmtag { "oprelative" "/obj" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "lightcategories"                 label   "Light Selection"                 type    string                 default { "*" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "vm_lpetag"                 label   "LPE Tag"                 type    string                 default { "" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "lpetag" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "vm_volumefilter"                 label   "Volume Filter"                 type    string                 default { "box" }                 menu {                     "box"       "Box Filter"                     "gaussian"  "Gaussian"                     "bartlett"  "Bartlett (triangle)"                     "catrom"    "Catmull-Rom"                     "hanning"   "Hanning"                     "blackman"  "Blackman"                     "sinc"      "Sinc (sharpening)"                 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "filter" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "vm_volumefilterwidth"                 label   "Volume Filter Width"                 type    float                 default { "1" }                 range   { 0.001 5 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "filterwidth" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "vm_matte"                 label   "Matte shading"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "matte" }                 parmtag { "spare_category" "Shading" }             }             parm {                 name    "vm_rayshade"                 label   "Raytrace Shading"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "rayshade" }                 parmtag { "spare_category" "Shading" }             }         }          group {             name    "folder0_1"             label   "Sampling"              parm {                 name    "geo_velocityblur"                 label   "Geometry Velocity Blur"                 type    ordinal                 default { "off" }                 disablewhen "{ allowmotionblur == 0 }"                 menu {                     "off"       "No Velocity Blur"                     "on"        "Velocity Blur"                     "accelblur" "Acceleration Blur"                 }             }             parm {                 name    "geo_accelattribute"                 label   "Acceleration Attribute"                 type    string                 default { "accel" }                 hidewhen "{ geo_velocityblur != accelblur }"                 parmtag { "spare_category" "Sampling" }             }         }          group {             name    "folder0_2"             label   "Dicing"              parm {                 name    "vm_shadingquality"                 label   "Shading Quality"                 type    float                 default { "1" }                 range   { 0 10 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "shadingquality" }                 parmtag { "spare_category" "Dicing" }             }             parm {                 name    "vm_flatness"                 label   "Dicing Flatness"                 type    float                 default { "0.05" }                 range   { 0 1 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "flatness" }                 parmtag { "spare_category" "Dicing" }             }             parm {                 name    "vm_raypredice"                 label   "Ray Predicing"                 type    integer                 default { "0" }                 menu {                     "0" "Disable Predicing"                     "1" "Full Predicing"                     "2" "Precompute Bounds"                 }                 range   { 0 10 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "raypredice" }                 parmtag { "spare_category" "Dicing" }             }             parm {                 name    "vm_curvesurface"                 label   "Shade Curves As Surfaces"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "curvesurface" }                 parmtag { "spare_category" "Dicing" }             }         }          group {             name    "folder0_3"             label   "Geometry"              parm {                 name    "vm_rmbackface"                 label   "Backface Removal"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "rmbackface" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "shop_geometrypath"                 label   "Procedural Shader"                 type    oppath                 default { "" }                 parmtag { "opfilter" "!!SHOP/GEOMETRY!!" }                 parmtag { "oprelative" "." }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_forcegeometry"                 label   "Force Procedural Geometry Output"                 type    toggle                 default { "1" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_rendersubdcurves"                 label   "Render Polygon Curves As Subdivision (Mantra)"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "rendersubdcurves" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_renderpoints"                 label   "Render As Points (Mantra)"                 type    integer                 default { "2" }                 menu {                     "0" "No Point Rendering"                     "1" "Render Only Points"                     "2" "Render Unconnected Points"                 }                 range   { 0 10 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "renderpoints" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_renderpointsas"                 label   "Render Points As (Mantra)"                 type    integer                 default { "0" }                 disablewhen "{ vm_renderpoints == 0 }"                 menu {                     "0" "Spheres"                     "1" "Circles"                 }                 range   { 0 10 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "renderpointsas" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_usenforpoints"                 label   "Use N For Point Rendering"                 type    toggle                 default { "0" }                 disablewhen "{ vm_renderpoints == 0 }"                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "usenforpoints" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_pointscale"                 label   "Point Scale"                 type    float                 default { "1" }                 disablewhen "{ vm_renderpoints == 0 }"                 range   { 0! 10 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "pointscale" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_pscalediameter"                 label   "Treat Point Scale as Diameter Instead of Radius"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "pscalediameter" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_metavolume"                 label   "Metaballs as Volume"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "metavolume" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_coving"                 label   "Coving"                 type    integer                 default { "1" }                 menu {                     "0" "Disable Coving"                     "1" "Coving for displacement/sub-d"                     "2" "Coving for all primitives"                 }                 range   { 0 10 }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "coving" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_materialoverride"                 label   "Material Override"                 type    string                 default { "compact" }                 menu {                     "none"      "Disabled"                     "full"      "Evaluate for Each Primitve/Point"                     "compact"   "Evaluate Once"                 }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_overridedetail"                 label   "Ignore Geometry Attribute Shaders"                 type    toggle                 default { "0" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "overridedetail" }                 parmtag { "spare_category" "Geometry" }             }             parm {                 name    "vm_procuseroottransform"                 label   "Proc Use Root Transform"                 type    toggle                 default { "1" }                 parmtag { "mantra_class" "object" }                 parmtag { "mantra_name" "procuseroottransform" }                 parmtag { "spare_category" "Geometry" }             }         }      }      group {         name    "stdswitcher4_2"         label   "Misc"          parm {             name    "use_dcolor"             baseparm             label   "Set Wireframe Color"             export  none         }         parm {             name    "dcolor"             baseparm             label   "Wireframe Color"             export  none         }         parm {             name    "picking"             baseparm             label   "Viewport Selecting Enabled"             export  none         }         parm {             name    "pickscript"             baseparm             label   "Select Script"             export  none         }         parm {             name    "caching"             baseparm             label   "Cache Object Transform"             export  none         }         parm {             name    "vport_shadeopen"             baseparm             label   "Shade Open Curves In Viewport"             export  none         }         parm {             name    "vport_displayassubdiv"             baseparm             label   "Display as Subdivision in Viewport"             invisible             export  none         }         parm {             name    "vport_onionskin"             baseparm             label   "Onion Skinning"             export  none         }     }  ' scatter_points
opset -S on scatter_points
opparm -V 17.0.438 scatter_points stdswitcher ( 0 0 0 ) xOrd ( srt ) rOrd ( xyz ) t ( 0 0 0 ) r ( 0 0 0 ) s ( 1 1 1 ) p ( 0 0 0 ) pr ( 0 0 0 ) scale ( 1 ) pre_xform ( clean ) keeppos ( off ) childcomp ( off ) constraints_on ( off ) constraints_path ( "" ) lookatpath ( "" ) lookupobjpath ( "" ) lookup ( on ) pathobjpath ( "" ) roll ( 0 ) pos ( 0 ) uparmtype ( arc ) pathorient ( 1 ) up ( 0 1 0 ) bank ( 0 ) shop_materialpath ( "" ) shop_materialopts ( override ) tdisplay ( off ) display ( 1 ) use_dcolor ( off ) dcolor ( 1 1 1 ) picking ( on ) pickscript ( "" ) caching ( on ) vport_shadeopen ( off ) vport_displayassubdiv ( off ) vport_onionskin ( off ) stdswitcher4 ( 0 0 0 ) viewportlod ( full ) vm_rendervisibility ( * ) vm_rendersubd ( off ) vm_subdstyle ( mantra_catclark ) vm_subdgroup ( "" ) vm_osd_quality ( 1 ) vm_osd_vtxinterp ( 2 ) vm_osd_fvarinterp ( 4 ) folder0 ( 0 0 0 0 ) categories ( "" ) reflectmask ( * ) refractmask ( * ) lightmask ( * ) lightcategories ( * ) vm_lpetag ( "" ) vm_volumefilter ( box ) vm_volumefilterwidth ( 1 ) vm_matte ( off ) vm_rayshade ( off ) geo_velocityblur ( off ) geo_accelattribute ( accel ) vm_shadingquality ( 1 ) vm_flatness ( 0.050000000000000003 ) vm_raypredice ( 0 ) vm_curvesurface ( off ) vm_rmbackface ( off ) shop_geometrypath ( "" ) vm_forcegeometry ( on ) vm_rendersubdcurves ( off ) vm_renderpoints ( 2 ) vm_renderpointsas ( 0 ) vm_usenforpoints ( off ) vm_pointscale ( 1 ) vm_pscalediameter ( off ) vm_metavolume ( off ) vm_coving ( 1 ) vm_materialoverride ( compact ) vm_overridedetail ( off ) vm_procuseroottransform ( on )
chlock scatter_points -*
chautoscope scatter_points -* +tx +ty +tz +rx +ry +rz +sx +sy +sz
opset -d on -r off -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off -x off scatter_points
opexprlanguage -s hscript scatter_points
opuserdata -n '___toolcount___' -v '1' scatter_points
opuserdata -n '___toolid___' -v 'geometry_grid' scatter_points
opcf scatter_points

# Node attribwrangle1 (Sop/attribwrangle)
opadd -e -n attribwrangle attribwrangle1
oplocate -x -2.4265294082983231 -y 0.1248059013310604 attribwrangle1
opspareds "" attribwrangle1
opparm attribwrangle1  bindings ( 0 ) groupbindings ( 0 )
opparm attribwrangle1 folder0 ( 0 0 ) group ( "" ) grouptype ( guess ) class ( point ) vex_numcount ( 10 ) vex_threadjobsize ( 1024 ) snippet ( '@pscale = distance(@P, point(0, "P", nearpoints(0, @P, 0.5)[1])) * 0.49;\n@ptnum * 0.1 > @Frame ? removepoint(0, @ptnum) : 0;\n' ) exportlist ( * ) vex_strict ( off ) autobind ( on ) bindings ( 0 ) groupautobind ( on ) groupbindings ( 0 ) vex_cwdpath ( . ) vex_outputmask ( * ) vex_updatenmls ( off ) vex_matchattrib ( id ) vex_inplace ( off ) vex_selectiongroup ( "" )
chlock attribwrangle1 -*
chautoscope attribwrangle1 -*
opset -d on -r on -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off attribwrangle1
opexprlanguage -s hscript attribwrangle1
opuserdata -n '___Version___' -v '' attribwrangle1

# Node testgeometry_pighead1 (Sop/testgeometry_pighead)
opadd -e -n testgeometry_pighead testgeometry_pighead1
oplocate -x -5.4176470588235297 -y 4.0552176561425721 testgeometry_pighead1
opspareds "" testgeometry_pighead1
opparm testgeometry_pighead1 t ( 0 0 0 ) r ( 0 0 0 ) uniformscale ( 1 ) difficulty ( medium ) addshader ( on )
chlock testgeometry_pighead1 -*
chautoscope testgeometry_pighead1 -*
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off testgeometry_pighead1
opexprlanguage -s hscript testgeometry_pighead1
opuserdata -n '___Version___' -v '' testgeometry_pighead1
opuserdata -n '___toolcount___' -v '1' testgeometry_pighead1
opuserdata -n '___toolid___' -v 'sop_testgeometry_pighead' testgeometry_pighead1
opcf ..
opcf scatter_points

# Node grid1 (Sop/grid)
opadd -e -n grid grid1
oplocate -x -2.1764705882352939 -y 3.611764705882353 grid1
opspareds "" grid1
opparm -V 17.0.438 grid1 type ( poly ) surftype ( quads ) orient ( zx ) size ( 4 4 ) t ( 0 0 0 ) r ( 0 0 0 ) rows ( 10 ) cols ( 10 ) orderu ( 4 ) orderv ( 4 ) interpu ( on ) interpv ( on )
chlock grid1 -*
chautoscope grid1 -*
opset -d off -r off -h on -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off grid1
opexprlanguage -s hscript grid1
opuserdata -n '___Version___' -v '17.0.438' grid1
opuserdata -n '___toolcount___' -v '1' grid1
opuserdata -n '___toolid___' -v 'geometry_grid' grid1

# Node scatter1 (Sop/scatter::2.0)
opadd -e -n scatter::2.0 scatter1
oplocate -x -2.4235294117647057 -y 1.3764705941957589 scatter1
opspareds "" scatter1
opparm -V 17.0.438 scatter1 group ( "" ) stdswitcher ( 0 0 ) generateby ( bydensity ) densityscale ( 10 ) usedensityattrib ( off ) densityattrib ( density ) useareaattrib ( off ) areaattrib ( area ) indepvoxel ( off ) useareaforvolumes ( off ) forcetotal ( on ) npts ( 4370 ) usedensitytexture ( off ) densitytexture ( default.pic ) primcountattrib ( count ) useemergencylimit ( on ) emergencylimit ( 1000000 ) seed ( 0 ) overrideprimseed ( off ) primseedattrib ( primid ) randomizeorder ( on ) relaxpoints ( off ) relaxiterations ( 10 ) scaleradiiby ( 1 ) usemaxradius ( off ) maxradius ( 10 ) useprimnumattrib ( off ) primnumattrib ( sourceprim ) useprimuvwattrib ( off ) primuvwattrib ( sourceprimuv ) useoutputdensityattrib ( off ) outputdensityattrib ( density ) useoutputradiusattrib ( off ) outputradiusattrib ( pscale ) radiusintexturespace ( off ) pointattribs ( * ) vertattribs ( "" ) primattribs ( "" ) detailattribs ( "" )
chlock scatter1 -*
chautoscope scatter1 -*
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off scatter1
opexprlanguage -s hscript scatter1
opuserdata -n '___Version___' -v '17.0.438' scatter1

# Node sphere1 (Sop/sphere)
opadd -e -n sphere sphere1
oplocate -x -5.6764705882352944 -y 0.31404118257410429 sphere1
opspareds "" sphere1
opparm -V 17.0.438 sphere1 type ( prim ) surftype ( quads ) rad ( 1 1 1 ) t ( 0 0 0 ) r ( 0 0 0 ) scale ( 1 ) orient ( y ) freq ( 2 ) rows ( 13 ) cols ( 24 ) orderu ( 4 ) orderv ( 4 ) imperfect ( on ) upole ( off ) accurate ( on ) triangularpoles ( on )
chlock sphere1 -*
chautoscope sphere1 -*
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off sphere1
opexprlanguage -s hscript sphere1
opuserdata -n '___Version___' -v '17.0.438' sphere1

# Node copytopoints1 (Sop/copytopoints)
opadd -e -n copytopoints copytopoints1
oplocate -x -4.6294117647058828 -y -1.1601529349299033 copytopoints1
opspareds "" copytopoints1
opparm -V 17.0.438 copytopoints1 sourcegroup ( "" ) targetgroup ( "" ) showguide ( on ) pack ( off ) pivot ( centroid ) viewportlod ( full ) transform ( on ) doattr ( on ) labelparm ( Set Mult Add Sub ) setpt ( *,^v,^Alpha ) mulpt ( Alpha ) addpt ( v ) subpt ( "" ) setprim ( "" ) mulprim ( "" ) addprim ( "" ) subprim ( "" ) setvtx ( "" ) mulvtx ( "" ) addvtx ( "" ) subvtx ( "" )
chlock copytopoints1 -*
chautoscope copytopoints1 -*
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off copytopoints1
opexprlanguage -s hscript copytopoints1
opuserdata -n '___Version___' -v '17.0.438' copytopoints1

# Node merge1 (Sop/merge)
opadd -e -n merge merge1
oplocate -x -3.1617647058823519 -y -2.9212529320927221 merge1
opspareds "" merge1
opparm -V 17.0.438 merge1
chlock merge1 -*
chautoscope merge1 -*
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off merge1
opexprlanguage -s hscript merge1

# Node switch1 (Sop/switch)
opadd -e -n switch switch1
oplocate -x -3.761764705882352 -y 2.3258058914366897 switch1
opspareds "" switch1
opparm -V 17.0.438 switch1 input ( 0 )
chlock switch1 -*
chautoscope switch1 -*
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -F on -c on -e on -b off switch1
opexprlanguage -s hscript switch1
oporder -e grid1 scatter1 sphere1 copytopoints1 attribwrangle1 merge1 testgeometry_pighead1 switch1
opcf ..

opcf /obj
opcf scatter_points
opwire -n switch1 -0 scatter1
opwire -n sphere1 -0 copytopoints1
opwire -n attribwrangle1 -1 copytopoints1
opwire -n scatter1 -0 attribwrangle1
opwire -n copytopoints1 -0 merge1
opwire -n switch1 -1 merge1
opwire -n testgeometry_pighead1 -0 switch1
opwire -n grid1 -1 switch1
opcf ..
opcf \$saved_path

#### Share this post

##### Share on other sites

Hey, @konstantin magnus i got inspired by your approach and tried to build my own, got about 400-500k Points in about 30-40secs cooktime. and thanks to @anim for the pcfind_radius approach, thats super fast.

dt_demo.mp4

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

×
• Donations

• Leaderboard