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.
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!
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.
Thanks !
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.