Cannot read property 'registerPlugin' of undefined
fred-hu opened this issue · comments
"pixi-filters": "^3.0.3",
"pixi-layers": "^0.2.2",
"pixi-lights": "^2.0.3",
"pixi.js": "^5.1.5"
i didnt move pixi-lights to v5 yet. are you usre that you need normal lights, and not something easier?
I also need to use illuminatorMaps to achieve an effect. so stuck at the same problem.
@ivanpopelyshev is there any easier filter to get the lightening effect?
We've used ColorMatrixFilter
to some success in simulating something like this. In its current form, it's not a perfect replacement for pixi-lights, but it suits our needs: we still use the normal map image but use the orientation of the entity to determine whether to show highlight or shadow for a given normal.
Here the walls and rotating spinners update the light top edges and dark bottom edges as the box and spinners rotate so that the top is always highlighted and the bottom is always shadowed.
Something like
matrix[0] = matrix[5] = matrix[10] = red;
matrix[1] = matrix[6] = matrix[11] = green;
matrix[2] = matrix[7] = matrix[12] = 0;
matrix[4] = matrix[9] = matrix[14] = (red < 0 ? -red : 0) + (green < 0 ? -green : 0);
matrix[17] = -0.7;
matrix[18] = 0.7;
where red
and green
are dot products of the direction of light and the x
and y
axes. The alpha channel makes normals close to perpendicular with the light source direction transparent.
I think there's probably a way to use ColorMatrixFilter
to more closely mimic pixi-lights, but I don't have a deep enough understanding of the filter to pursue that... I just kept running tests on ideas until I achieved something close enough. 😅