Modernizing old borrowed code

I have old code. I have a sphere map. It works! But I don’t know how, so I’m not sure how to make it work with the latest three.js.


It uses this code chunk:

// modify UVs to accommodate MatCap texture (I don't know what this means)
const faceVertexUvs = geometry.faceVertexUvs[0];
for (let i = 0; i < faceVertexUvs.length; i++) {
    for (let j = 0; j < 3; j++) {
        faceVertexUvs[i][j].x = geometry.faces[i].vertexNormals[j].x * 0.5 + 0.5;
        faceVertexUvs[i][j].y = geometry.faces[i].vertexNormals[j].y * 0.5 + 0.5;

But… what is that? Do I need to know how it works, or is there some drop-in replacement that will be compatible with modern three.js?

This question seems related, but I wasn’t entirely clear on the solve: