PlayCanvas Editor Feedback


#87

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.


#88

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.


#89

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.


#90

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();
 }
}

#91

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!


#92

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


Collision Mesh question
#93

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.


#94

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

Seems to happen since the update today:


#95

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.


#96

It’s not something as obvious as the difference between the background color?

Any ideas? @mr_f


#97

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.


Script Loading Order
#98

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?


#99

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


#100

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)


#101

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.


#102

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?)


#103

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


#104

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.


#105

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?


#106

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.