Skip to content

Conversation

@frasercl
Copy link
Collaborator

@frasercl frasercl commented Oct 23, 2024

Review time: medium (20-30min). Most of the diff is package-lock.json!

Misc. changes required to incorporate volume rendering from this codebase into Simularium, including:

  • In addition to translation and rotation, volumes may now set their scale. This supports setting the size of volume agents with the Simularium format's "collision radius" field. I also added a field to ImageInfo.transform to correspond to this, even though fields of that object are never read within the core package.
  • Package now exports formerly internal VolumeDrawable type.
  • The common doRender method of VolumeRenderImpl no longer depends on our internal ThreeJsPanel class, and instead accepts the three.js objects it was previously getting from it.
  • RayMarchedAtlasVolume now generates its own fallback empty depth texture on its first render, to allow its render method to be called without a depth texture. (Future work should allow this class to accept the full view space position buffer generated by Simularium in its first render pass in place of a depth texture.) Producing this depth texture currently generates errors in Simularium, which is running a slightly older version of three.
  • Updates a bunch of babel-related dependencies and adds plugin-transform-runtime, to resolve some conflicts.

@frasercl frasercl changed the title Simularium volumes Changes to support Simularium integration Oct 23, 2024
@frasercl frasercl marked this pull request as ready for review October 29, 2024 01:29
@frasercl frasercl requested a review from a team as a code owner October 29, 2024 01:29
@frasercl frasercl requested review from ShrimpCryptid and meganrm and removed request for a team October 29, 2024 01:29
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid left a comment

Choose a reason for hiding this comment

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

Looking really good overall, had a couple questions but once they're clarified I'm good to approve 👍

const { normPhysicalSize, normRegionSize } = this.volume;
// Set offset
this.geometryMesh.position.copy(this.volume.getContentCenter());
this.geometryMesh.position.copy(this.volume.getContentCenter().multiply(this.settings.scale));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does a volume's scale affect its offset position? Is the scaling origin always the origin of the scene?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The offset position is relative to the center of the volume, which for this viewer should almost always be the origin of the scene. It's there to compensate for an irregular subregion. E.g. if the subregion in the x-axis were 0.5 - 1.0, getContentCenter would return 0.25 in the x-axis, because the center of the mesh has to move from the center of the volume bounding box to halfway to its edge:
image
Since that offset is in world units, it also has to account for the scale of the volume.

Copy link
Contributor

@ShrimpCryptid ShrimpCryptid left a comment

Choose a reason for hiding this comment

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

LGTM!

@frasercl frasercl merged commit 3bf7cd9 into main Nov 7, 2024
@frasercl frasercl deleted the simularium-volumes branch November 7, 2024 17:57
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