• Content Count

  • Joined

  • Last visited

Everything posted by arek3D

  1. It was like this: 1. I imported .babylon files which were exported from 3DS Max. So they had StandardMaterials. 2. Then I decided to put on them PBRMetallicRoughnessMaterials to try to solve FB issue with strange reflections, and I used dispose() function for all StandardMaterials from the scene. 4. Then I saved to .glb the whole scene and the size of the file was bigger, above 3MB (so maybe dispose() method didn't delete std materials immediately or completely). 5. So I decided to come back to Standard Materials and tried to convert it properly to GLTF. 6. Now I know that this is impossible, because during the conversion metallicFactor -> 0, and to look decently on Facebook it should be 1.0 in my case (Which was not too obvious, because I did not want to have reflections at all). Unlit extension helped in my project, but it would be great to have the possibility to choose it during the exporting to a .glb file. As I said I reported this issue to Facebook at 14th Nov, but haven't received any response yet. Their engines display the same file differently on desktop and mobiles.
  2. function _solveForRoughness(specularPower) { var t = Math.pow(specularPower / P3.x, 0.333333); return _cubicBezierCurve(t, P0.y, P1.y, P2.y, P3.y); } var diffuse = babylonStandardMaterial.diffuseColor.toLinearSpace().scale(0.5); var opacity = babylonStandardMaterial.alpha; var specularPower = BABYLON.Scalar.Clamp(babylonStandardMaterial.specularPower, 0, this._maxSpecularPower); var roughness = _solveForRoughness(specularPower); var glTFPbrMetallicRoughness = { baseColorFactor: [ diffuse.r, diffuse.g, diffuse.b, opacity ], metallicFactor: 0, roughnessFactor: roughness, }; return glTFPbrMetallicRoughness; }; Thank you for your answer. Yes, Modo exports Roughness=1 and Metallic=1 and this is the reason of difference! I checked that on Facebook and the effect is the same. Thank you! I noticed that in babylonjs.serializers.js the metallicFactor is always = 0 in _solveForRoughness() function. I need to use StandardMaterials on my objects, so my materials always will use this function (if I use PBR materials in Babylon I exceed the 3MB Facebook limit for the 3D post). I noticed also that StandardMaterial in Babylon JS has the roughness property (it helps to define how blurry the reflections should appears in the material). Don't you think that during conversion from Standard Material to PBR it should be like this: f(specularPower) -> metallicFactor f(roughness) -> roughnessFactor Instead of: 0 -> metallicFactor f(specularPower) -> roughnessFactor What do you think @bghgary? Thank you very much for help!
  3. The method in the Babylon JS Serializers "GLTF2Export.GLBAsync()" exports actualy the same visual result like 3dsMax exporter. The only difference I saw in the HEX Editor was the file from 3DS Max has Roughness = 0.99 instead of 1. The object exported using GLBAsync() is shiny despite of roughness=1, metallic=0 on mobiles on FB. And it is distinctly brighter than e.g. from Modo also on desktop. White color from Modo is closer to #FFFFFF than from Babylon JS, and Modo also uses glTF and PBR metallic roughness model. But of course these reflections from Facebook scene could affect colors on the object and the problem could be only with roughness and metallic part. Thank you @bghgary for the information about unlit extension and your glTF-Shell-Extensions tool. It helped to avoid weird reflections on Facebook on mobiles exported from Babylon JS, but of course it is only workaround, because there is no shading at all.
  4. Thanks for your help @bghgary! Yes, I know that pure black or white with no reflections do not exist in the real world. But Modo also uses PBR materials and the range of colors is wider. Also, the roughness is greater. The darkest box exported from Babylon JS looks distinctly brighter than e.g. the black frame of my LCD screen. Also, I can see a lot of objects around me that are more rough than this box on FB mobile. It is very shiny despite of roughness = 1. I hope that glTF working group will fix those inconsistencies between the most popular renderers. Or maybe Facebook developers will allow changing the reflection map from their scene to have more control of the final effect. What do you mean by " add the unlit extension manually to the glTF file"? I have tried to add those lines to the material in the text editor, but I have noticed before, that every try of editing .glb file causes an error during Facebook upload and I do not know why. Maybe I use incorrect encoding?
  5. Thanks @Deltakosh but I also tried that and also used PBR materials with roughness=1, metallic=0 etc. I cannot achieve totally black and also totally white color on mobiles without any reflections. This is possible from Modo, so I do not think it is an Facebook's issue, however I reported this also to them. I have not received any response yet. Here is the playground: And here is my test scene. I use the newest exporter for 3DS Max 2016 (ver. 1.3.9): Hope it will help
  6. Hi, I have noticed that there is a difference in displaying .glb files between desktop and mobiles e.g. on Facebook. The files exported from babylonjs.serializers using GLTF2Export.GLBAsync() or 3DS max + Babylon JS plugin has strange reflection despite of specular=0, roughness=1, metallic=0 etc. I have tried many combination with Std and PBR materials and I always have this strange reflection on mobiles. I decided to try Modo and the effect is much better. So probably you have a bug in babylonjs.serializers and 3DS max plugin. I have noticed that in attached file called "babylonJS.glb" which was exported from 3DS max "roughnessFactor" is 0.9 and should be 1.0 if I use standard material with specular = 0. GLB files: babylonJS.glb Modo.glb Screenshot from the smartphone (Android/iOS, the effect is the same), 3DS max + Babylon JS plugin and the same effect after using babylonjs.serializers.js GLTF2Export.GLBAsync() method: Screenshot from the smartphone when Modo was used (on smartphone the box is totally black - so the effect is actually perfect). And the effect which we can see on the desktop web browser (as you can see the file exported from Babylon JS is not totally black, but it should be. However the worst thing is this reflection on mobiles):
  7. I am working with meshes where are huge amount of faces. This is only an example but the behaviour is the same. I think the second part of your answer is the reason. So here is the next question - how to weld these vertexes to have one object instead of bunch of faces?
  8. Hi! I have created a custom mesh like this: new BABYLON.Mesh("custom", this.scene) And after added simplify() method, nothing has been changed. I have created a playground for testing this issue. As you can see, the same settings in simplify() method change the structure of sphere, but do not change my custom mesh: Is it a bug, or it is impossible to add simplify() method to custom mesh?
  9. Ok, I have found why my string was empty when I console.log my custom mesh. I do not have UV data in my model and in OBJExport.OBJ() method there is a condition which skips such meshes: if (!trunkVerts || !trunkNormals || !trunkUV || !trunkFaces) { continue; }
  10. Hi, I have a problem with export an .obj file using custom mesh. Should it work with this kind of mesh? I created a geometry which is displayed correctly in canvas and after console.log the list of vertexes is empty. I tested that with a standard cube and it worked correctly. Here is how I am doing it (more or less): this.customMesh = new BABYLON.Mesh("custom", this.scene); //... a lot of "positions.push" var normals = []; var vertexData = new BABYLON.VertexData(); BABYLON.VertexData.ComputeNormals(positions, indices, normals); vertexData.positions = positions; vertexData.indices = indices; vertexData.normals = normals; vertexData.applyToMesh(this.customMesh); var mat = new BABYLON.StandardMaterial("mat", scene); this.customMesh.material = mat; var obj = BABYLON.OBJExport.OBJ([this.customMesh],true,'birdie'); var objlink = BABYLON.Tools.FileAsURL(obj); var mtl = BABYLON.OBJExport.MTL(this.customMesh,true); var mtllink = BABYLON.Tools.FileAsURL(mtl); console.log("obj = ", obj); console.log("objlink = ", objlink); console.log("mtl = ", mtl); console.log("mtllink = ", mtllink);
  11. Yes, I had been using 0.5.0 version and it worked perfectly.
  12. Hi, I have installed a new version of Babylon exporter using this: Max/ I upacked this, unblock, then deleted previous version and paste those dlls. Here is what I get: Exportation started Exporting nodes Exportation cancelled: External component has thrown an exception. Have you had similar issues?
  13. Thank you @Wingnut for your workaround!! I wrote proper UV values for my meshes and it works! In my free time, I will try to fix that issue with the newest exporter, which I had and I will test this strange UV behavior once again. Or maybe I should change 3ds max to 2017 version
  14. I think UV channel is correct in my mesh (this is default plane from 3ds max 2016. So UV must be correct. Moreover, I made a PG which prove that UV is incorrect only if I use DynamicTexture (in this example textures are swapped in the loop every 60 frames) This is quite strange, isn't it?
  15. Thank you very much for your answers! I will check that PG tomorrow. But how to explain the fact that when I put a standard texture, it works well on the same plane? Imho without UV channel it would not be possible. I use 3ds max 2016, with max2babylon exporter, but not the newest version, because it shows errors.
  16. Yes, right, but I do not know how to import my .babylon file on playground Is it possible? Mesh:
  17. Oh, I didn't know about this rabbit This is simple plane from 3ds max with proper mapping. Typical texture works fine on that. But if I use DynamicTexture I get something like this: Could you try with attached file? Thank you for your help! plane2.manifest plane2.babylon
  18. Hello, I have noticed that there is a problem with UV mapping, if I use a dynamicTexture on my mesh, imported from .babylon file. I am sure that my mesh has proper UV mapping, I have checked it by using standard texture. If I use normal texture on this mesh, everything is ok. If I use dynamic texture on BABYLON.Mesh, everything is ok. If I use dynamic texture on my mesh, I have seen something like that: I can't find an example on the playground with a mesh with proper UV mapping, so I have chosen the skull Playground:
  19. I have tested it on this sample scene on my HDD, and it WORKS! So I think it will be similar in my project, I will check it tomorrow ;D I didn't know about this parameter in engine costructor, but I tried to set stencil's flags by myself, and there was not any effects: engine.isStencilEnable = true; engine._isStencilEnable = true ; Anyway, thanks a lot @Deltakosh!!
  20. Hello, I think the simplest way is to make a condition with camera.radius and a flag (to check is it before explosion) in registerBeforeRender() function:
  21. I don't have any idea, how it is possible, but I had implemented this in my project and it didn't work. After many hours I decided to download this scene from Playground, and test it on my HDD, and it didn't work too. It is a big surprise for me :/ @Deltakosh, do you have any idea what is going on here? Chrome doesn't show any errors. The only error message I got, was in Mozilla Firefox console, but I doubt that it is related to this issue. Error: WebGL: Failed to create WebGL context: WebGL creation failed: * Error during ANGLE OpenGL init. * Error during ANGLE OpenGL init. * Error during ANGLE OpenGL init. * Error during ANGLE OpenGL init. * Error during ANGLE OpenGL init. * Exhausted GL driver caps. babylon.js:4:12713 BJS - [14:20:55]: Babylon.js engine (v3.0-alpha) launched babylon.js:3:22931 Error: WebGL: texImage2D: Conversion requires pixel reformatting.
  22. This is exactly what I wanted to achieve. You are a God here. No doubt. Thank you sooo much!!
  23. Hello, what do you think, what is the best way to show this green tree only at this gray box. I would like to hide every pixel which is outside the box, even if I will rotate a camera. This plane will be pickable and the user will be able to move it above 3D object, but it is necessary to hide pixel outside. I tried to make a layer/foreground, put there a texture made by RenderTargetTexture of gray box and mask every planes which I will add. But this solution is not good, because in this function I need to have an URL of the image, not a texture: new Layer(name, imgUrl, scene, isBackground, color) Do you have any ideas how to get this effect? Thank you in advance!
  24. I was thinking about that solution before, but I have one big file and only few small textures, so it wouldn't look rightly I think. So I see two ways: 1) make fake loading progress using setInterval() and variable with logarithmic increase. 2) Change AssetManager to SceneLoader. Thank you very much @Wingnut and @Deltakosh!
  25. Hello, I have a problem with get information how many percent of all mesh/textures were loaded, while I use AssetsManager. I have seen a similar topic, but there SceneLoader is used. Is it possible to get those information about loading progress, while I use AssetsManager?