Sketchfab no longer accept toDataURL()
maps at runtime?! I mean only bump/normal maps. There are changes on channel definitions?
Sketchfab no longer accept toDataURL()
maps at runtime?! I mean only bump/normal maps. There are changes on channel definitions?
var texB = canvasBump.toDataURL()
api.addTexture(
texB, //the new map are transfered to Sketchfab API
function (err, textureDUid) {
.....
api.setMaterial(materialToUpdate, function () {
console.log("Bump material updated");
});
}
);
Yes, It worked 3, 4 hours ago.
Now are working just for diffuse channel (the both workflows), but not for normal/bump channels.
I presume in the "..." aspect of your code you are updating the channel texture UID..?
Did the material originally have a texture and you are uploading a different one ? I ask because if not and you are creating your own texture object the "texCoordUnit" variable is not easy to set. I used to have it set to 1 previously and then one day it stopped working so I changed it to 0. Sadly I have seen even other values for this variable. I really wish there was a concise means to know what this variable should be set to.. @stephomi do you know much about this variable..?
If you are just updating a material that had an existing texture previously then I cant say what the issue is. Then it might be something that changed in the manner the support uploads. Did you check the value of the err argument being passed in , if not null then there is some error , log it and see
Yes, the material originally have a texture. Please see here: http://estudio3d.eu/bespoak/
Add some text. The diffuse are transferred, but the bump/normal, no.
No log errors. Also I have some callbacks that said "texture updated"
ok your code is minified so it doesnt help much , are you setting all the properties of the texture object again or only updating the uid?
var texB = canvasBump.toDataURL({ // the diffuse working canvas transformed into a jpg code
format: 'jpeg',
quality: 1
});
api.addTexture(
texB, //the new map are transfered to Sketchfab API
function (err, textureBUid) {
materialToUpdate = materialHash["upperMap"]; //always, inside tis function, we are update the upperMap, as combination of textures
//console.log("Material to update: ", materialToUpdate);
var texobB = {};
texobB.internalFormat = "RGB";
texobB.magFilter = "LINEAR";
texobB.minFilter = "LINEAR_MIPMAP_LINEAR";
texobB.texCoordUnit = 0;
texobB.textureTarget = "TEXTURE_2D";
texobB.uid = textureBUid;
texobB.wrapS = "REPEAT";
texobB.wrapT = "REPEAT";
materialToUpdate.channels.BumpMap.texture = texobB; //this is the channel we are changing in order to affect the diffuse map
api.setMaterial(materialToUpdate, function () {
console.log("Bump material updated"); // the diffuse colour of the material upperMap was updated
});
}
);
In my utility if the channel originally had a texture in that slot then I only update the UID and dont touch the other variables.. this is because I mentioned the texCoordUnit is not easy to guess
im quite sure this is the problem , try cache the current texture object and only update the uid after uploading a new texture.
I saw your utilities, thanks for your great contribution. I will try to update only the uid
cool lets hope it works , I actually cache the original via doing a deepcopy , or create a new object using some defaults but additionally I support injecting an object with alternate parameters to make sure it is as flexible as possible
We probably broke something with today's release, it should be fixed very soon (hoping today/tomorrow).
Until then, you can try adding "material_packing=0" in the url option of the sketchfab embed, it should fix the issue.
TexCoordUnit is used for multi-UV models, but for the huge majority of models, there's only 1 uv set per material, so texCoordUnit should be 0.
As for your code, it should be correct, except for the "internalFormat" which can only be "LUMINANCE" for a BumpMap (but it shouldn't cause any issues I think).
I have noticed that the normal/bump texture has changed the internal format
was: tex.internalFormat = "RGB";
now it's: tex.internalFormat = "LUMINANCE";
Thank you for clarification, I saw it after I posted.
I am using now "LUMINANCE" and all works fine.
A few hours ago worked with "RGB".
I've got "RGB" from materials
api.getMaterialList(function (err, materials)
There normal/bump was "RGB". Only roughness was "LUMINANCE"
@MadalinBerechet you seem to quote normal/bump as if the are the same except that the are not. A bump map would be greyscale and does not encode direction and I presume sketchfab simply reads from the first color channel here the "r" or red channel , this is suitable for luminance. A normal map encodes direction in the bump and so uses more than one color channel and so luminance would not be a correct fit for this , it should be RGB.
I presume as stephomi mentioned they must have created a bug in the last release.
Yes, you are right.
The confusion comes from the fact that they are on the same button in the editor
But in materials array are completely different.