Online3DViewer
Online3DViewer copied to clipboard
Feature request: add colors to meshes
Initial need I want to be able to take a screenshot of some 3D models with one or several meshes being colored to "stand out".
Describe the solution you'd like In the Meshes navigator, add an icon/button for every mesh listed, that allows to give it a custom color, in similar way as the selected mesh "highlight" effect.
This icon/button could also be provided in the mesh righ-click menu.
UI Mockup
Icon
There are 2 candidate icons from the Noun Project: color & format color.
I guess it would have to be added to O3DVIcons.woff
. With what tool could that be done? Did you use FontCreator?
Implementation I had a look at the code and it seems to me that most of what we need to implement this is already present:
- inspiration could be taken from Website.UpdateMeshesSelection() & Viewer.SetMeshesHighlight() to set some colored material on some meshes.
- regarding state / information storage, a list of "colored mesh IDs" could be stored as an attribute of the
Website
class - the color picker already used in sidebarsettingspanel.js could be reused. It currently does not have to handle the "no color picked" case, so we should take care about that, as that will even be the default.
Questions
- would you be open to this feature?
- how should this feature behave when some material is associated with a mesh? Maybe the color picker should simply be deactivated in that case?
- regarding the implementation, there are a few points I currently don't quite understand in the code:
- do you follow some kind of separation of concerns in the code? If so, what are the rules?
- while tring to understand the mesh selection / highlight logic, I could not figure out why
updateMeshesSelection()
is called from 3 places... Also, why passing a callback toSetMeshesHighlight
and not simply a boolean?
- what do you think about the following potential extra features once this is implemented?
- persist this coloring: in browser local storage? In the exported model?
- apply the same color to several meshes at once: this implies some "group selection" mechanism for the meshes
Hey, sorry for the late answer. I definitely should write an architectural documentation of the code to answer all your questions. I've created an issue for that: #245.
The proposed solution raises a lot of questions, and I'm wondering if it's the best way to achieve your goals. To understand it better could you please explain the workflow in more details?
I understand that you would like to highlight some parts to stand out. What will happen after that? Who is the target audience? What will be the tool they are checking the result? What happens after they've checked it?
Thank you for your answer.
I understand that you would like to highlight some parts to stand out. What will happen after that?
I plan to simply take a screenshot of it.
Who is the target audience?
I plan to generate 2d illustrations out of some video game levels 3D models. Those illustrations would then be part of a PDF I am crafting, so the audienc would be readers of this PDF.
What will be the tool they are checking the result?
A PDF viewer, to visualize the 2D screenshot made taken from Online3DViewer.