How to make material highlight,like mesh hightlight?

https://www.babylonjs-playground.com/#5NIBE1#28
I want the material group set in blender to also have the effect of highlighting. How to achieve this?

Pinging @sebavan

I am not sure about the issue :frowning: Why not adding all the meshes from the group to the highlight layer ?

:joy:I need to highlight different parts of a 3D human body, but I hope not to divide it and keep it as a whole. There are many material groups in the 3D human body, so I will ask, I know it may not be the right way, but I still hope

Hi guys! Are these “materialGroups”… actual groupings of BJS materials? When imported into BJS scene, do they arrive as… umm… arrays of materials/names, or what? (sorry for inexperience)

I ask because… each material could have an .emissiveColor property and maybe a .level property (on its textures). Let’s stay with .emissiveColor, for example.

If you have a group of materials… in an array… that needs “highlighting”… sometimes it is easiest to set .emissiveColor on the entire group of materials… to make them get lots brighter, even if they are textured materials. AND, you can pulsate/cycle colors/brightness… using animation on the .emissiveColor… to make a group of materials do “color throbbing”. You might wish to darken all non-highlighted materials… perhaps by reducing their texture.level or darkening their diffuse or emissive colors.

I have never played-with Color3.scale(x)… but scaling a color3 WOULD be a way to make it lots brighter for a while, and still be able to return it to its ORIGINAL color… after un-highlighting. (by scaling the color back to 1). Same with down-scaling the colors of all other materials in the scene… another way of highlighting ONE set of materials… the un-darkened group. After darkening via scaling colors .5, scaling back to 1 should return to original brightness/colors.

The objective: Put the user’s “focus” upon something… and when it comes to ONLY having materials to work-with… coloring (including animating colors) is the only highlighting tool you have.

Aside: You might want to ponder using Volumetric Light Scattering (god-rays)… as a materials-based highlighting tool… although that is a very strange idea. I can’t remember if VLS is based upon materials or mesh or both. Godrays as highlighting… could also have troubles with depth-sorting… material still produces godrays toward camera, even when material is on backside of mesh, out of view.

Back to colorizing-to-highlight, you would probably want to invent “Color-Highlighting Management System” for yourself… build yourself a tool that allows emissivePulsingManager.startPulsing(materialGroup, color1, color2, animRate); :slight_smile:

You might “hang” and “unhang” these “animated pulsators” on the renderLoop… using onBeforeRenderObserver.add() and remove(). You could have multiple “pulsators” hanging on the renderLoop at the same time. Remember to name each pulsator that gets added-to the onBeforeRenderObserver, because .remove() needs a name to look-up… so it can find the correct pulsator to remove, later. :slight_smile:

Here is an example of a color-pulser highlighting system (just single materials, not groups). Click some mesh.

Just an idea (and TMI, eh?) Party on!