Point Controls for Python States RnD

   1819   4   2
User Avatar
Member
102 posts
Joined: June 2019
Online
Here's some progress on project I'm working on with python states.

I'm currently trying to generalize "point controls" for states to make a framework for tools creating. The idea is create something similar to what you have in game engines (from UI perspective).

So you have point like an object with transform and arbitrary set of properties (attributes). In state you can transform selected point and edit its properties in "inspector" (parameters pane in Houdini). This approach is very limiting, no channel expressions so no animations, and destructive. However at the same time it's surprisingly very flexible for tools. Set of points with data can represents so many inputs and manual editing can be very helpful in procedural workflow.

Current features:
- Base state to derive to create a "point controls" state
- Attributes "inspector" for points utilizing parameters pane. So inspector UI editing is available out of the box
- Mass transform (with optional box transform handle)
- Custom selections without using built-in one
- Multi editing of attributes (select points and adjust attribute for all of them)
- Support for custom collider. State stores all collisions in special attributes so it can be used as an anchor placer

From UX point of view it's like an uber Add SOP for points that can also edit attributes.

The very basic example would be metaball editor:



The state code is as simple as:
class State(PointControlsState):
    def __init__(self, state_name, scene_viewer): 
        super(State, self).__init__(state_name, scene_viewer)

        self.point_controls.projection_mode = ProjectionType.FREE

        self.add_point_attribute("weight", 2.0, control_parm="weight", allow_multiedit=True)
        self.add_point_attribute("Cd", (1.0, 1.0, 1.0), control_parm="color", allow_multiedit=True)
        self.add_point_attribute("kernel", "wyvill", control_parm="kernel", allow_multiedit=True) 
        self.add_point_attribute("roundness", 1.0, control_parm="roundness", allow_multiedit=True)

        self.allow_box_transform = False
        self.allow_box_selection = True
        self.allow_mass_moving = True

Basically just a defining attributes and linking them to the node parameters. Base state will take care of the rest.
Then downstream we just copy metaballs to points and that's it.

For modelling metaballs are little bit silly, but being basically sdf they are quite responsive and can be used as less destructive alternative to Attribute Paint.
Edited by elovikov - June 18, 2021 10:17:07

Attachments:
meta.gif (7.4 MB)

User Avatar
Member
102 posts
Joined: June 2019
Online
This approach also naturally translates to any game engine as point is basically actor in UE or gameobject in Unity.

For example this is the same metaball editor but loaded in Unity as an HDA:


We have the same controls and it's really easy to set up other tools like instancers, fractures etc. Points can be used as a separate input to feed some custom data about environment from game engine.

The only thing it's not available right now out of the box for UE or Unity. Though it's pretty straightforward to create a geo from set of actors/gameobjects.

Attachments:
meta_unity.gif (4.2 MB)

User Avatar
Member
13 posts
Joined: Nov. 2018
Offline
elovikov
This approach also naturally translates to any game engine as point is basically actor in UE or gameobject in Unity.

For example this is the same metaball editor but loaded in Unity as an HDA:
Image Not Found


We have the same controls and it's really easy to set up other tools like instancers, fractures etc. Points can be used as a separate input to feed some custom data about environment from game engine.

The only thing it's not available right now out of the box for UE or Unity. Though it's pretty straightforward to create a geo from set of actors/gameobjects.

This is awesome ,it could be so usefull
User Avatar
Member
102 posts
Joined: June 2019
Online
I've also added some layer to integrate gadgets and custom handles a little bit easier. Mostly automated binding and providing interface for custom implementation (like dragging and clicking callbacks etc).

Anyway with custom handles I can push this even further.

I've created this layout sop. It's like a Labs Pick'n'Place on steroids. Additionally to controls and custom attributes it also dynamically creates a kinefx skeleton and output packed captured geo. So even being destructive you can use the output downstream with other tools.


Custom attributes allows you to set per instance material through shop_materialpath with all the benefits of multiediting. You can even promote material overrides for points if your render supports that.


Currently I'm trying to figure out how to add dictionary attributes. That would be even more flexible and potentially If I feed points to some loop with compiled hdas I can use it as a nice little hda processor in sop context.

Attachments:
layout.gif (9.7 MB)
materials.gif (6.6 MB)

User Avatar
Member
145 posts
Joined: Jan. 2014
Offline
I wonder if you have any progress with this tool?

I think it's super useful and I'd like to experiment with it.
Basically, I tried to make smth like an add sop, but failed and found your topic.

Thank you
https://linktr.ee/Deviner_vfx [linktr.ee]
Linux Arch | RTX 3090 | Ryzen 9 5950X | X570-PRO
  • Quick Links