Anti-aliasing on iOS

Just to round off this topic, we’ve been talking in DMs.

The Babylon example didn’t have shadow casting on 7 spotlights while the PlayCanvas one did.

Disabling the shadow casting in PlayCanvas on those 7 lights increased the framerate massively and using less lights, also further improved the performance.

As it was a static scene, the suggestion given to keep the quality of lighting was to use the lightmapper to bake the lighting and shadow.

Edit: We have engine examples of using the lightmapper at runtime too:

http://playcanvas.github.io/#/graphics/lights-baked
http://playcanvas.github.io/#/graphics/lights-baked-ao

2 Likes

Hi!

Could you tell me if my findings about using lightmapping in PlayCanvas are correct?

  1. You can’t use it without UV1s.

  2. .glb conversion doesn’t support extra UVs, so you can only use it with .json.

  3. The .json variant is bigger in size than the .glb variant (twice the size for my model).

Conclusion: You’ll have to see if you either want to use build in lightbaking and sacrifice for model size or you create external lightmaps and sarcifice for their size in loading.

  1. For runtime or editor lightmapping, yes you need UV1

  2. GLB conversion does support extra UVs if the UVs are set in the modelling package and exported. We have a bug where it says that UV1 cannot be found when they are really there. https://github.com/playcanvas/editor/issues/620 . Unwrapping UVs in the Editor is not supported for GLBs though.

  3. JSON variant is roughly the same size when gzipped but does take longer to parse. Faster Load Times with glTF’s GLB Format! | PlayCanvas

Conclusion: You’ll have to see if you either want to use build in lightbaking and sacrifice for model size or you create external lightmaps and sarcifice for their size in loading.

See 2. As long as the UV1 map is created on the model before import, it should be fine despite the editor error message.

Parts of my model do have 2 UV maps, but it doesn’t work anyway. In the editor it looks fine, but in Play mode it’s all wrong.

Hmm, that’s a bit worrying as the two should match.

Is it something that could be shared publicly or be able to post screenshots?

Not for public, but at this point I’ll add you to take a look, ok?
Do you need write access?

Actually only platten_A/B/C have a second UV map, but that should suffice for testing right now

Ok I noticed that when I refresh the project, the lightmaps reset or something. They still don’t match the play mode, but are far from the correct lighting I get when I untick the lights Affect Lightmapped and retick it again. When Affect Lightmapped is activated again it “bakes correctly”. Probably not actually correct, but why does it work in the project?

Sorry, I didn’t get time to look at this today. I will try to find some time tomorrow.

1 Like

Is it okay to share screenshots of the project here?

thats fine

I added an updated version of my model, light now behaves very unexpected. I have to disable Lightmapped/Bake Lighting for the light to be present at all. With the play mode being different from the editor still.

It literally only shows the shadow on the ground in play mode if it’s not showing in editor and vice versa.

Hey,

I’m going to give you write access I guess. The lighting behaviour right now makes absolutely zero sense to me. I don’t know how it got this way.

Sometimes you get the spotlights to pop up in the editor, but no changes in play mode.
The directional light has to have “bake lightmap” unticked but “affect lightmapped” ticked for it to affect the scene. Like what the f? Affect Lightmapped is even greyed out when bake lightmap is off. Why would it need to be ticked then. I’m pretty lost right now, would appreciate any help.

Could you please describe what lighting do you want to have set up and how this should work on different mesh types? Should every light and mesh be lightmapped, or are you aiming for a combination of realtime and lightmapped?

My goal is to have everything light mapped since everything is static anyway. That would be the most performant way right?

You should probably use these settings for render / model components:

castShadowsLightmap: true,
lightmapped: true,
castShadowsLightmap: true or false,

and this for lights:

affectDynamic: false,
affectLightmapped: true,
bake: true,
castShadows: true or false,

Please keep it professional.

Your light settings basically make it a realtime light, not lightmapped, which works on lightmapped meshes.

That’s the issue! All my meshes are lightmapped so the light should not behave like this or I’m not seeing some apparent problem. Do you want to take a look at the project?

Please try some simple project (using cubes and similar) to see if you can get this working.
Also, launch the project in debug mode and look at the browser’s debug console … perhaps you will find some warnings that meshes do not have UV1 and cannot be baked?

No warnings!

This is what’s messing with me. I don’t understand why the editor is different from playmode and also shadows reset when refreshing the editor.
That’s why added @yaustar to the project, to see if he can find some issue. Or maybe for him the project is fine?