ThreeJS ColorMaps (LookUpTables -- LUTs)

1.3k Views Asked by At

I'm converting a project from canvas2D to webgl/webgl2, and looking at using ThreeJS.

One issue is using colormaps. I typically use a 256 colormap, thus colors are Uint8 Attribute arrays as indexes into a Uniform colormap: an array of 256 colors.

This requires the Vertex shader to convert the Uint8 color Attribute (the 1 byte index into the Uniform array of colors) into a Varying color to be passed to the Frag shader which then uses it for the color.

How do I do this in Three? Or possibly I should a different 3D library (https://twgljs.org/, say)

More generally, I need to understand how to integrate or create extensions for three.js. Any docs or help of any sort? The three.js site does not, I think, include this.

0

There are 0 best solutions below