[Helper,Visual] Visualize scalar field on meshes using color palette#6192
Merged
Conversation
Contributor
Author
|
Note that I did not implement |
bakpaul
approved these changes
Jul 23, 2026
fredroy
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds visual coloring capabilities to mesh rendering by introducing vertex value-based color mapping. The implementation creates a color mapping system that converts scalar values to colors using a color palette, enabling temperature visualization in heat diffusion simulations. This enhancement provides a direct way to visualize scalar fields like temperature across mesh elements through color gradients.
Changes:
TrailRendererchanges the type of the DatacolorfromRGBAColortoColorMap(breaking). This allows to use gradients of colors for the trail, including fading effect.VisualMesh. If vertex values are provided, they are converted to colors using aColorMapand rendered on the mesh.DrawTool: introduce an overload ofdrawLineStripwhere a vector of colors is provided. This allows to create color gradients in theTrailRenderer. It is implemented inDrawToolGL.DrawColoredMesh: introduction of reusable class to draw a mesh with colors. Used inVisualMesh.ColorMap: refactoring (breaking):ColorMapis only created using presets. It is no longer the case.Possibilities to define a color map in a scene:
Tip: use https://coolors.co to generate your own palette, or explore existing ones https://coolors.co/palettes/trending
Diffusion example:
raptor_diffusion.mp4
Trail renderer:
pendulum.mp4
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if