Skip to content

Conversation

@kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented Oct 11, 2025

After pygfx/pygfx#1208 we can have per-vertex scatter markers 🎉 . After this PR I think we cover the full space of the pygfx points API.

  • VertexMarkers buffer manager for fancy indexing of markers
  • UniformMarker graphic feature
  • PointsRotations buffer manager
  • UniformEdgeColor
  • EdgeWidth
  • UniformRotations
  • sprites implementing by passing an array to ScatterGraphic(image=...)
  • gaussian and basic material
  • tests
    • scatter point features
    • VertexMarkers buffer manager
    • PointsRotations buffer manager
  • examples
  • I think search sorted can be used to map user marker -> "standard" marker string, not just the ints which is already done, let's skip this until we hit performance issues for a use case.

This PR also makes a few other changes to graphic features that aren't specific to scatters:

  • property_name is now an instance attribute instead of a class attribute. And the value of the type field of the emitted event dict comes from the property_name instance attribute. This let's us use the VertexColors buffer manager for both per-point vertex face colors AND edge colors and keep their property_name different when used within the same graphic. Similar thing for TextureArray

@almarklein the only usecase of per-vertex rotations is for points right, I don't see how that would make sense for any other type of object (ex: lines).

The PointsMaterial that is chosen depends on the marker mode (basic, marker shapes, image (sprites), or gaussian). By default it will use PointsMarkerMaterial because distinct markers are the most common scientific use case. Once an object has been instantiated you can't switch between the materials. I think let's keep it that way unless someone has a usecase, I can't think of one @almarklein @clewis7 .

I wonder what the purpose of the basic PointsMaterial is when we have markers. @almarklein have you benchmarked performance?

@almarklein
Copy link
Collaborator

@almarklein the only usecase of per-vertex rotations is for points right, I don't see how that would make sense for any other type of object (ex: lines).

Yes it's purpose if to rotate the marker; the little image that we draw at the position of the point. So very specific to the PointsMarkerMaterial even.

@almarklein
Copy link
Collaborator

Once an object has been instantiated you can't switch between the materials. I think let's keep it that way unless someone has a usecase, I can't think of one

Someday, a user will come by with a use-case 😉 But I agree that in this context its fine to select at instantiation. And ppl can always modify the graphic.world_object, right?

@kushalkolar
Copy link
Member Author

Once an object has been instantiated you can't switch between the materials. I think let's keep it that way unless someone has a usecase, I can't think of one

Someday, a user will come by with a use-case 😉 But I agree that in this context its fine to select at instantiation. And ppl can always modify the graphic.world_object, right?

Yea I could implement it but I don't want to do it now. For example if you go from markers to sprites, you have to clear the geometry markers buffer and anything related to markers and then create a new texture. Lots of things to keep track of.

@kushalkolar
Copy link
Member Author

OK I need to change GraphicFeature.property_name from a class attribute to an instance attribute so we can VertexColors buffer manager can be used for scatter point edge colors too.

@kushalkolar
Copy link
Member Author

kushalkolar commented Oct 12, 2025

basics work, but I just realized a str is also a Sequence so I need to undo a lot of what I thought was cleanup 🤦

image

messing around with rotations 😂

bah-2025-10-12_01.26.48.mp4

This was referenced Oct 12, 2025
@kushalkolar
Copy link
Member Author

kushalkolar commented Oct 20, 2025

Added all scatter tests (I think) and all scatter backend tests passing 🥳 .

@clewis7 r4r, and I can make the ground truth screenshots for this PR after rebasing on main oncee #919 is reviewed and merged!

@kushalkolar kushalkolar marked this pull request as ready for review October 20, 2025 22:51
@kushalkolar
Copy link
Member Author

Need to update the garbage collection test nb because depending on the scatter mode some features can be None. 🤔

@kushalkolar
Copy link
Member Author

It's going to fail with the release version until pygfx/pygfx#1219 is in the release.

@kushalkolar kushalkolar mentioned this pull request Oct 21, 2025
5 tasks
clewis7
clewis7 previously approved these changes Oct 22, 2025
Copy link
Member

@clewis7 clewis7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clewis7 clewis7 merged commit 1284981 into main Oct 23, 2025
19 of 36 checks passed
@clewis7 clewis7 deleted the per-vertex-markers branch October 23, 2025 00:28
@kushalkolar kushalkolar mentioned this pull request Oct 23, 2025
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

Successfully merging this pull request may close these issues.

4 participants