Hi Shapespark community,
I’m working on a project where I need to dynamically modify the HSL properties of materials using a JavaScript script. I’m leveraging the Shapespark API to access baseColor
and its getHSL
and setHSL
methods.
The issue I’m encountering is that HSL changes are reflected correctly on materials with solid colors, but they do not appear to work for materials with textures assigned to baseColorTexture
. My goal is to modify the HSL values for both solid color materials and textured materials.
Here’s what I’ve done so far:
- I retrieve the material via the
onNodeTypeClicked
event and access itsbaseColor
. - I modify the HSL values using the
setHSL
method. - I call
viewer.requestFrame()
to force a render update.
The HSL values seem to update correctly based on the logs, but the changes are not visually reflected in materials with textures. However, in the Shapespark editor, it is possible to adjust HSL values for textures, which suggests this functionality should be achievable.
I noticed that there doesn’t seem to be any equivalent getHSL
or setHSL
for baseColorTexture
. This leads me to wonder:
- Is there an additional step required to apply HSL changes to materials with textures?
- Is it possible to dynamically overwrite texture properties using only HSL adjustments, or is there a different approach I should consider?
I would greatly appreciate any guidance or examples on how to address this issue.
Thank you in advance for your help!
Best regards.
Angel Castro