PlayCanvas Editor Feedback

When I add a new asset to an asset array (script attribute) it is added at the beginning of the array, so the index of every existing asset in the list is increased. It would be better to add the new asset at the end, so existing indexes would stay as they are.

Added multi-material editing, select many materials and edit their properties, and other tiny improvements.
It is a hard task in terms of UX so your feedback will be appreciated.

Next: entities multi-selecting.

Hello guys.
There was some pause in my work and then I come back I noticed that the ā€œeditorā€ version of my project looks very dark compared with the ā€œcompiledā€ version that I make some time ago.
Here is the screen:

There is some changes with lightmap visualisation or something? Because I donā€™t make any changes and there is now diffuse data in the assets materials, there is only lightmaps.
Thank you.

1 Like

Does ā€œeditorā€ also mean new compiled builds as well? What gamma value do you use? There was a bug that LDR lightmaps were always treated as linear data, and adding gamma correction on top of them would make them lose precision. LDR lightmaps then were changed to act as sRGB textures:


But it implies that lightmaps are baked with gamma 2.2.
You can also use linear HDR lightmaps now (imported as exr/hdr) without any gamma applied.

Looking at your screenshot, I think it might make sense to make each textureā€™s gamma configurable (e.g. youā€™d choose if texture should be treated as sRGB or linear manually, with some default values)ā€¦

Currently a quick fix would be either apply 2.2 gamma to lightmaps (possible precision loss) or patch shaders with a script. Something like:

for(var i=0; i<app.scene.drawCalls.length; i++) {
 var mat = app.scene.drawCalls[i].material;
 if (mat) {
  mat.chunks.lightmapSinglePS = "\
   uniform sampler2D texture_lightMap;\
   void addAmbient(inout psInternalData data) {\
    data.diffuseLight = texture2D(texture_lightMap, $UV).$CH;\
   }\n";
  mat.update();
 }
}

Wow, thanks for the detailed answer! Now I undertand. I just apply the 2.2 gamma correction to my png lightmaps and it works fine for me.
Thanks a lot!

Hello, the collision -> mesh is not working :frowning: .

Thereā€™s a slight difference between editor and game when it comes to opacity.

In the editor it looks like:

And in the game engine:

Also: with additive alpha, the internal part disappears from both.

Looks like something has broken in the Bloom effect? Or something is up with my project.

Seems to happen since the update today:

Hmm, yes. Looks like itā€™s not initializing the script attributes properly. Iā€™m taking a look.

UPDATE: Fixed and deployed, should be working now.

Itā€™s not something as obvious as the difference between the background color?

Any ideas? @mr_f

Thanks :smile:!

Quite a lot of my project broke with the update - I notice that the method I used to initialize early Javascript functions no longer works. Would be really good to be able to get either a way of running code on startup without the need to create a ā€œscriptā€ per se or to be able to specify files to be loaded before any of the other scripts are executed.

For instance my pc.script.create(ā€˜xxxā€™, function(uuu) {}) now runs before all of my JS is loaded. Iā€™ve got a workaround - but I have a function I would prefer to execute inside that script around my script constructor to create a state machine. This no longer works so Iā€™ve bodged it together by screwing with proto but ugly hack.

Before it looked like var MyScript = pc.createStateMachine(function MyScriptConstructor(entity) {});

But that no longer works as the pc.extend isnā€™t running before the call back to execute the pc.script.create.

Iā€™ve changed it to using a similar background color and the problem persists.
Hmm, it changes with what I have selected as well. It I have the object selected it doesnā€™t have the middle bit, if I donā€™t have it selected, then it does have the middle bit. Weird. Are you optimizing the opacity when an object isnā€™t selected?

ON a more general note, Iā€™m not sure that additive alpha is correct. If I have an additive-alpha material with the colour:
R:1
B:0.5
G:0.25

Now if I have two objects, one behind the other, then the colors should add and become:
R: 1
B: 1
G: 0.5

But both the overlapping and non-overlapping bits are both the original material color. Overlaying two additive alpha objects doesnā€™t add the colors.
Or am I misunderstanding Additive Alpha?

Can you post some screenshots? Because it works for me: https://playcanvas.com/editor/scene/370057 (added you)

I had a look and went:
ā€˜It works for you and thatā€™s not fairā€™

Is there something you have to change in the project settings? It seems that in your project creating a new material and enabling additive alpha makes it ā€¦ additive alpha, but in my project it doesnā€™t.

Have a look at this project:
https://playcanvas.com/editor/scene/370059
(I think Iā€™ve given Mr_F write access)

Disable material depth write in ā€œotherā€ section. Otherwise your nearest cube was blended on top of the background, but farthest was first occluded by nearestā€™s depth, and then also blended, and blend between cubes didnā€™t happen due to occlusion treating objects as opaque.

Yup, that works.

You may want to add a note about that in the additive alpha panel. Because I would never have tried that. (Is it documented anywhere?)

Would be absolutely amazing if access to the scripts and script editor was possible from within the editor. (Without opening a new window).

What is the biggest reason you want them in the same window?
I can only find limitation having in same window, rather improvements, except for editing shader code for example.

workflow for scripts is a bit awkward. say I want to edit a script, I have to

-change tab to script editor, edit, save
-go to the designer tab, press reload script
-go to the live tab, reload

Or am I doing it wrong?

In the Editor you only need refresh the script if youā€™ve changed or added a script attribute. So you can probably drop the second step.