Skip to content

Conversation

@iMeaNz
Copy link
Member

@iMeaNz iMeaNz commented Oct 5, 2025

Overview

Previously, the thumbnails for the models were generated by kinda "guessing" the rough size based on the size value of the TransformComponent. But this was mostly incorrect because every model can be different when imported.
So now, thanks to the PR #426 we have access to the AABB and bounding spheres of the imported models.

Thanks to that, we can simply position the camera to encapsulate the bounding volume of the model in the thumbnail.

Description

The idea is to treat the model’s bounding sphere as the region that must fully fit inside the camera’s view frustum. By knowing the sphere’s radius, the camera’s field of view (FOV), and the aspect ratio, we can compute the exact distance required for the camera so that the entire model is visible without being clipped or cropped.

In practice:

  • The center of the bounding sphere is used as the focus point for the camera.
  • The camera is offset along a fixed viewing direction (kThumbDir) so that it looks directly at the model.
  • The distance between the camera and the model is calculated from the FOV to ensure that the sphere fits perfectly within the viewport.
  • The near and far planes are then tightly adjusted around the sphere to optimize depth precision.

This method ensures that thumbnails remain visually consistent and correctly framed for any model.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 5, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/thumbnails

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@iMeaNz iMeaNz requested a review from Thyodas October 5, 2025 19:45
@iMeaNz iMeaNz self-assigned this Oct 5, 2025
@iMeaNz iMeaNz linked an issue Oct 5, 2025 that may be closed by this pull request
6 tasks
@Thyodas
Copy link
Member

Thyodas commented Oct 6, 2025

Same here, can you add some tests and check out the security hotspots in sonarcloud please?

@iMeaNz
Copy link
Member Author

iMeaNz commented Oct 9, 2025

Same as this comment :
#426 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

feat: model thumbnail previews in asset manager

3 participants