I was asked to swap a texture in an existing .babylon scene. I thought I would use the Sandbox for that.
Initial state: .babylon scene containing inlined texture data.
Steps:
import original .babylon file,
locate mesh, follow the link to the material,
under ‘channels’, delete the existing Albedo texture,
under ‘channels’, click ‘add Albedo texture’, and import the new texture in PNG format.
verify visually that the new texture is applied properly to the model. It is!
under 'tools, click ‘export to Babylon’.
Problem:
If I import the modified .babylon file to the sandbox, the texture is gone. More exactly, instead of inlining the new texture data or referencing the file on my drive, both the “url” and “name” parameters are now set to something like … "blob:https://sandbox.babylonjs.com/ab655475-8fb3-496e-91b8-b88407bf9ff2"
… and I can see that I get an error in the console: Security Error: Content at https://sandbox.babylonjs.com/ may not load data from blob:https://sandbox.babylonjs.com/ab655475-8fb3-496e-91b8-b88407bf9ff2.
Is this the expected behavior or am I missing something?
No problem @sebavan , thanks for all the hard work!
I’ve been playing with the Sandbox some more tonight, and I have had similar issues. I will report my findings here, as it feels all this might be related.
This time I was trying to downgrade the quality of a texture present in the same .babylon file used so far.
Steps in FireFox 78.14.0esr (CentOS 8.4)
import original .babylon file,
select texture to be modified in scene explorer,
under ‘preview’, click ‘edit’,
change both width and height, and click ‘resize’,
click ‘save’; this produces an empty PNG file, but with the right dimension,
close texture editor; the inspector shows the updated texture dimensions,
click ‘edit’,
click ‘save’; this time the expected texture file is produced (right dimensions, not empty),
under ‘tools’, click ‘export to babylon’; the exported file does not take into account the texture modification.
add .png extension to texture file, which for some reason was missing in FF,
under ‘preview’, click ‘load texture from file’ and load the texture file created in step 8,
Repeat step 9. This time the new .babylon file takes into account the texture modification.
Similar story in Chrome version 93.0.4577.82, except for the following:
the .png extension is added automatically,
once the correct PNG is generated (on second attempt in Chrome too), it is about twice as large as the file generated by FF.
this size difference seems to cascade once the files are imported back to the scene: when diff’ing the babylon scenes obtained in Chrome and FF, the ‘url’ field for the modified texture contains about twice the data in Chrome.
I cannot share the files that I am working on, but if you can’t reproduce the issue, let me know and I will try to produce a stripped down version of the original file.
@sebavan thanks for the fix! I can confirm that the first issue I posted about is gone, at least in FF
@DarraghBurke unfortunately I still have the same issues described in my 3rd post (both in Chrome and FF). I guess your fix should be live by now? If not, do you know when I should try again? Let me know if I can assist you with the troubleshooting. Thanks!
@DarraghBurke , I finally got a chance to test again tonight.
Saving a texture to disk directly after an edit does work now, at least in Chrome.
However I still experience the second part of the issue, both in Chrome and FF : the changes made to the texture are discarded when I export a new .babylon file.
Hey, quick update: I found the cause of the issue and have opened a PR to fix it. However, we’re not sure if this is the right approach to go with and need to complete some tests first. I’ll let you know as soon as we’re done
Sounds good @DarraghBurke
I had the 3D artist downscale the textures for us, so as far as I am concerned this is no longer high prio. But I think it will be a handy little feature to have. Keep up the good work!