[SOLVED] Rectangle light source

Just added in my project :

pc.LayerComposition.clusteredLightingEnabled = true;
pc.app.scene.layers.clusteredLightingCells = new pc.Vec3(20, 2, 20);
pc.app.scene.layers.clusteredLightingMaxLights = 48;

and i have this warning in Chrome 91 / macOS Big Sur 11.4

[.WebGL-0x7fee69cb5600]GL ERROR :GL_INVALID_OPERATION : glDrawElements: Texture bound to texture unit 0 with internal format GL_DEPTH_COMPONENT32F is not compatible with sampler type GL_SAMPLER_2D

Is there a documentation about these options ?

The API is still in the works, the example is your best bet and you can also check the source code here:

Ok, i have tryied to update parameters but it didn’t change anything.

I have another question on lighting topic. Many elements in my scene are static, like buildings.

If i understand well, using lightmaps could be a good performance improvement.

My building model don’t have “Lightmapped” option activated, so shadows are calculated in realtime. If i activate the option, i have the warning “UV1 is missing”.
When i check the model, i didn’t have the “Pipeline” option on the right panel, like in the doc (Runtime Lightmaps | Learn PlayCanvas)

Link to scene : https://playcanvas.com/editor/scene/1091565

Unfortunately, unwrap UV is not available with GLB at the moment. You would either have to use the older JSON format or unwrap the UVs in the modelling program before importing them

See: UV auto-unwrap is not supported for GLB model assets · Issue #194 · playcanvas/editor · GitHub

1 Like

Good morning @yaustar,

I noticed in my projects that when selecting a model that has a UV1 to be lightmapped, the editor will still say that UV1 is missing. Since I had my own lightmaps, it didn’t affect me much, but seeing this thread, I thought I would mention it here.

Yep, if you have baked the lightmaps outside of PlayCanvas, that works as well.

The UV1 is needed for runtime or Editor lightmapping

I understand,

What I mean is choosing a RenderElement that does indeed have a UV1 will still show as having no UV1 when selected for lightmapping in the editor for runtime lightmaps.

Oh interesting. Can you create an issue on the Editor repo with an example FBX that we can look at please?

Issue submitted: Editor always reports Missing UV1 on RenderComponents · Issue #478 · playcanvas/editor · GitHub

Repro: https://playcanvas.com/editor/scene/1202294


The clustered lighting is a way to go with many lights. I’m not sure what the problem is with that warning you get, it’s not something obvious. Do you not get that warning when clustered lights are disabled?

Without clustered lights, you should be able to enable / disable lights as needed, but each time a new number of lights is used a new shader gets compiled, which takes 100s of ms for more complex shaders. Eventually the cache would contain all variants needed, but that’s not a solution.