Points with lighting

PointsMaterial does not yet support lighting. But if you use MeshPhongMaterial on a Points object, you can use lighting, but then you won’t have the material features like sizeAttenuation or size, so the points will have a constant size of 1.

In the following demos, a point light moves around the scenes, causing the points to shimmer:



Let’s extract Takahirox’s PointsMaterial with lighting into a lib perhaps, so that we get the full options.

This was already discussed at GitHub: PointsMaterial + light support · Issue #17618 · mrdoob/three.js · GitHub

I do not vote to move this code into the lib since it’s highly questionable whether points and lines should support lights or not. Simply because they have no normals by definition. There are workarounds for this (by working with just distances) but frankly I don’t like it. It does not work with existing physically correct lighting computations in the engine and thus introduces inconsistencies/wrong expectations.

1 Like

That’s the same issue I linked to. Makes sense that distance-based brightness of point color is not flexible enough for use cases people may want.

Just opening a thread here for discussion on lighting points in general.

For something that would go into core, it would more likely need to be a system that has options like flicker, shimmer, translucency, shape, reflective, or similar, etc, so that one could get the effect of rain drops, dust particles floating through beams of light (god rays), fireflies, etc, depending on the what values they set for the options.

Sorry, did not see this. I though this is a link to a third-party repository.

I don’t think it’s the number of features which decides whether this lands in core or not. Because of the conceptual restrictions, I don’t think it’s appropriate to add any kind of lit point or line materials to the core.

Having external repositories with such features seems more appropriate to me. Besides, I think stuff like that will be easier to implement in the future with the new node material.

1 Like

Yeah true. Totally fine as a 3rd-party lib. That’s what I was suggesting originally anyway. It would be something configurable that would be useful for more cases than just color based on distance.

Just jotting it down as a place to get ideas going. :slight_smile:

Hello Michael, do you know if something changed in MeshPhongMaterial that no longer allows lighting on points? I don’t a mention in the migration guide.

I can no longer achieve the same effect with MeshPhongMaterial + Points + PointLight in some testing I’ve done recently, but maybe I goofed.

It would be a big help if you could determine the release that introduced the breakage. I can then have a look at the release notes.

BTW: Since point clouds with lights were never official supported, do not expect a fix for this.

I’m not sure yet, but I think it might be a Windows vs Linux thing. I switched to my Linux machine and it is working. Confirming…

Just going to mention this as a demo of what lit points could look like:

1 Like

Indeed, particles lit by light is a perfect example. Super simple effect too!