-
Notifications
You must be signed in to change notification settings - Fork 108
Description
I found a discrepancy between the documentation and the actual behavior of the setColorWeight function in the visualizer. According to the docstring, a weight of 0 should result in 100% of color1. However, in the current implementation, a weight of 0 renders color2 instead.
The comment in the header file states:
@param[in] id instance id
@param[in] weight the color weight
The actual color is linearly interpolated between color1 and color2 which are set by setColor method.
100% color1 when weight is 0.
When I set up instanced visuals like this in the rayDemo2.cpp example file:
auto scans = server.addInstancedVisuals("scan points",
raisim::Shape::Box,
{0.05, 0.05, 0.05},
{1,0,0,1}, // color1: Red
{0,1,0,1}); // color2: Green
// If I set weight to 0.0f
scans->setColorWeight(id, 0.0f);
Expected: The object should be Red (100% color1).
Actual: The object is rendered as Green (100% color2).
It seems the interpolation logic is either reversed or the documentation needs to be updated. Since most users expect weight 0 to be the starting color (color1), this appears to be a bug in the interpolation mapping.