Hello. I decided to add another asset to my game today, so I uploaded it to the playcanvas website as a .fbx, then downloaded it as a model archive, the normal way.
Upon including it in my project, it wouldn’t load. Playcanvas spouted ‘data.parameters not defined’, and the callback from “app.assets.loadFromUrl()” simply never ran.
To check to see if it was my version of playcanvas being out-of-date, I grabbed the latest build from github.
Now it didn’t even spout an error, loading simply stopped with no errors, and the callback never runs.
Upon inspecting the material file, I noticed that the path to the image the file uses has not been refered to anywhere. Closer inspection reveals a couple surprising things:
The exported zip file has 6 files representing the material, all with the same name, but some are different to each other. They are really small.
These .json files are different to what they used to be:
Old material files start off:
The asset works fine in the playcanvas online editor, and in game there, so it isn’t the asset that’s wrong. So at the moment I suspect it’s the export model archive utility, or that you’ve changed the material handling and haven’t pushed the changes through to github.
The material format has indeed changed, but model loading should be fine. It seems to work with some of the models I’ve tried. It’s not possible to not push changes to Github as the PlayCanvas Editor uses the latest version of the engine (which is on Github).
Can you maybe PM me a zip of your model export so I can test locally?
Here’s the model that I got using the ‘export model archive’ button:
Note that there are six files in the one folder, wach with the same name.
I’ll try grabbing the engine again, maybe I did something funny.
On the other hand, I assumed it was the new file that was breaking things, because the old ones still loaded, and the new one looked different, and if I commented out the lines getting it, my game resumed working.
Is there still support for the old material format? Or do I need to re-convert my old models?
Ah there was a bug in our resource loader. I pushed a fix in the engine master branch. Let me know if that fixes your issue - seems fine here after the fix
But when it exports, there is not even a diffuseMap entry in the json file, or anywhere else as far as I can see. There is nothing linking to the Particles.jpg texture sheet.
As a result, or perhaps for some other reason, when I try to load the model, I can’t see it. No model I export has a reference to any image textures, so it looks like the export is broken.
So inside the project there are two model assets:
One is called ‘SixShip.’ When it exports it creates a material file including ‘diffuseMap=’/path/image’.
The other asset is called ‘Laser.’ When it exports it’s material file does not include a diffuseMap entry to it’s material, though the material does use a diffuse texture map.
I’ve put a new laser bolt in the project, and this one uses only a single plane per ‘sprite,’ relying on the ‘Cull Mode’ to ensure both sides are drawn. This is exported (The entry “cull” appears in the json), but is not changing much.
I tried manually setting the values in the material file, and the changing the value has very little affect. There are two settings:
The value 2: Show Nothing
Any other value: Normal Back-face culling.
Yeah, I know, I should just add in the extra planes
Hmm, so I’d expect pc.CULLFACE_NONE to make both sides of a face to appear identicle? Makes sense to me.
So with the laser model above, I stuck it in the default spinny-load-model-example. You can see that the faces do not appear the same from all angles. No idea why. May be a problem with the model. Demonstration
You’ve got light in that scene, and faces are illuminated based on their normals.
For such basic material, you could use pc.BasicMaterial which ignores the lighting.
Alternatively, use the pc.PhongMaterial but set diffuse and specular to black and set the texture as emissive. Then lighting won’t affect the geometry.