Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for instancing #26

Closed
chadrik opened this issue Oct 12, 2018 · 6 comments
Closed

Add support for instancing #26

chadrik opened this issue Oct 12, 2018 · 6 comments
Assignees

Comments

@chadrik
Copy link
Contributor

chadrik commented Oct 12, 2018

No description provided.

@sirpalee
Copy link
Contributor

I started redesigning parts of the mtoh plugin to support instances; the current state can be found in the feature/instances branch. Also, from now on big features should happen in a separate branch to avoid breaking the master branch too often.

There are a couple of challenges (besides figuring out what's the best way to use the instancer) associated with this task. Mostly regarding callbacks. We'll need to create a large number of extra callbacks to track visibility and update transformation values for each instance, including a smart caching of the data. Instancers work via re-creating transformation matrices for each instance via translate / rotate / scale, and for now, they seem to be the only option to support instances. Same goes for tracking visibilities.

Deleting instanced nodes are not trivial either, especially when we delete the master and Maya makes the next instance the master. That'll probably require a full rebuild of instancer / source mesh.

Also, I'm not sure how can we assign separate materials to each instance.

@sirpalee sirpalee self-assigned this Nov 21, 2018
@sirpalee
Copy link
Contributor

Pushed back an initial implementation (and merged it to master) to features/instances that support static instances (movement updates are not applied, deleting instances doesn't work either etc).

@sirpalee
Copy link
Contributor

Updates, hiding / unhiding and deleting instances (except the first instance) works well now.

There are a few problems left:

  • Deleting the master instance causes problems with the shader/material/normal and instance start to look different.
  • Reparenting the master instance does not work.
  • Selecting any of the non-master instances doesn't show the wireframe properly.

@sirpalee
Copy link
Contributor

Solved several issues with the latest commits in feature/instances.

  • Deleting the master instance recreates the instancer with the new master's path now.
  • Reparenting the master, or any of the instances.
  • Adding new instances to a set of existing instances.
  • Adding new instances when the old master is created as a normal primitive.

The code is just thrown together and needlessly overcomplicated at this point now; I'm going to take a look at simplifying the changes before focusing on the other problems.

There are some unresolved issues left:

  • Selection does not behave the same way as in Maya. Selecting any of the transforms and nothing is shown with wireframe.
  • Selecting the master instance highlights everything.
  • All the instances will get material assignments from the master shape.

@sirpalee
Copy link
Contributor

Note: once #28 is closed, handling instances will be much more streamlined.

@sirpalee
Copy link
Contributor

I'm creating tickets for the remaining issues, so fixing those could happen after the initial release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants