How to show labels to Legend of LUT

Hello All,

I have added legend using Sprite but I am unable to add labels to the legend.
When I am setting the labels using lut.setLegendLabels then I am getting the below warning :
THREE.SpriteMaterial: 'useScreenCoordinates' is not a property of this material.
I am using the below code:

lut = new THREE.Lut("rainbow", 1024);
lut.setMax(1);
orthoCamera = new THREE.OrthographicCamera(- 1, 1, 1, - 1, 1, 2);
orthoCamera.position.set(0.5, 0, 1);
uiScene = new THREE.Scene();

lut.setLegendOn({ layout: "Horizontal", position: { x: 5, y: 5, z: 5 }, dimensions: { width: 10, height: 10 } })
lut.setLegendLabels({ title: "Title", um: "Unit", ticks: 10, decimal: 2 });
sprite = new THREE.Sprite(new THREE.SpriteMaterial({
	map: new THREE.CanvasTexture(lut.legend.canvas)
}));
sprite.scale.x = 0.08;
uiScene.add(sprite);

Please help me to add labels to the legend.
Thanks in advance!

I am also facing similar problem. I am getting error setLegendOn and setLegendLabels are not defined. Could you solve the issue.

Thanks

The Lut class was refactored in R104 last year. Methods like setLegendOn() and setLegendLabels() have been removed. Please develop your code according to the latest official example:

https://threejs.org/examples/webgl_geometry_colors_lookuptable

Hi, docs aren’t up to date, they are still mentionning these deprecated methods

1 Like

Thanks for pointing this out. Should be resolved with the next release: