Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base64String data #21

Closed
vortice3D opened this issue Oct 16, 2017 · 26 comments
Closed

base64String data #21

vortice3D opened this issue Oct 16, 2017 · 26 comments

Comments

@vortice3D
Copy link

vortice3D commented Oct 16, 2017

Hi Julian:

First of all, I´d like to apologize for the inconveniences, as this is probably not the place to submit this kind of question (not an issue I hope), but indeed is has been the only (an one question at HTML5DevGames BJS forum) way I have found in order to contact you about one think I´d like to resolve, related to your superb BJS Editor.

We, in our company, are trying to use your BJS Editor as a main tool in our Web RT 3D workflow.

The guys at CGI and Art department like the PBR way to manage materials. Current BJS Exporter (Blender) version doesn't implement this kind of materials. Fortunately, your last version of BJS Editor does.

Sadly, when we export scenes (as a .babylon) from your BJS Editor, we obtain really huge files.

Sniffing in the code we see several "base64String" fields, that seems to be responsibles of such a big size:

"albedoTexture": {
    "tags": null,
    "url": "columna_basecolor.png",
    "uOffset": 0,
    "vOffset": 0,
    "uScale": 1,
    "vScale": 1,
    "uAng": 0,
    "vAng": 0,
    "wAng": 0,
    "isBlocking": true,
    "name": "columna_basecolor.png",
    "hasAlpha": false,
    "getAlphaFromRGB": false,
    "level": 1,
    "coordinatesIndex": 0,
    "coordinatesMode": 0,
    "wrapU": 1,
    "wrapV": 1,
    "anisotropicFilteringLevel": 4,
    "isCube": false,
    "gammaSpace": true,
    "invertZ": false,
    "lodLevelInAlpha": false,
    "lodGenerationOffset": 0,
    "lodGenerationScale": 0.8,
    "isRenderTarget": false,
    "animations": [],
    "base64String": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAEAAAABAACAIAAAB9wbNAAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgAElEQVR4nOzdO27bQABF0Rjwprj/gstiCgKC4a8sDU1e8pwqSBxlCjly8S7nZVmWfwAAAAAAAAAAAAAAwLG97n0AAAAAAAAAAAAAAADg . . . (excerpt) . . . AABgQAAAAAAAAAAAAAAAAYEAAAAAAAAAAAAAAAAGBAAAAAAAAAAAAAAAAAgAEBAAAAAAAAAAAAAAAABgQAAAAAAAAAAAAAAAAYEAAAAAAAAAAAAAAAAGAgscGvDKLC+w0AAAAASUVORK5CYII="
}

Here my questions:

  • Is the "base64String" data:image/png data the same that we already have in the url "columna_basecolor.png"?
  • If yes, can we obtain the .babylon files w/o this apparently redundant info?
  • Anyway, can we directly delete this field (base64String property) of the "albedoTexture" object?

Addendum:

In the case of environment (.DDS) base64String strings are referring as a URL not to a file but to a data, and so may be it is not possible the url-only way I asked for before:

"environmentBRDFTexture": {
    "tags": null,
    "url": "data:EnvironmentBRDFTexture",
    "uOffset": 0,
    "vOffset": 0,
    "uScale": 1,
    "vScale": 1,
    "uAng": 0,
    "vAng": 0,
    "wAng": 0,
    "isBlocking": true,
    "name": "EnvironmentBRDFTexture",
    "hasAlpha": false,
    "getAlphaFromRGB": false,
    "level": 1,
    "coordinatesIndex": 0,
    "coordinatesMode": 0,
    "wrapU": 0,
    "wrapV": 0,
    "anisotropicFilteringLevel": 4,
    "isCube": false,
    "gammaSpace": true,
    "invertZ": false,
    "lodLevelInAlpha": false,
    "lodGenerationOffset": 0,
    "lodGenerationScale": 0.8,
    "isRenderTarget": false,
    "animations": [],
    "base64String": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR4Xu19Z7PtTHbW1g3jMMbGmGDAZAMm5xxMLD . . . (excerpt) . . . BLavolXEyAM6obnTMzHEqoMuc09HxKv2rbTPAVYZO/ydUbXfkKP4/BnecprBuissAAAAASUVORK5CYII="
},

My question:

  • can we change that data:EnvironmentBRDFTexture to a .DDS file url? (of course deleting also the base64String)

Thanks for your time.

Best regards.

@julien-moreau
Copy link
Contributor

Hey Mario, thanks a lot for this awesome feedback!
I don’t understand why there is the key « base64String » on a texture which was loaded using drag’n’drop I guess? I can check in 1h!
For the BRDF texture I know the issue: the fact is this texture is created dynamically by Bjs giving à base 64 string so the editor is just taking it as a user created texture (it is saved each time it is referenced when serializing textures of the scene). I can try to find a smart fix :)

I give you a feedback as soon as possible

@julien-moreau
Copy link
Contributor

I'm trying to reproduce the issue but unfortunately I do not find how: the scenes I take as example, even big/complex/pbr, I cannot see any base64String key except for BRDF texture.
To fix faster, is it possible to get one of your scenes or a reproduction with a minimal scene from yours?

Thanks for your answer !

@vortice3D
Copy link
Author

Good night Julien (we're here at CET time).

First of all let me thank you very much for your immediate response!

I agree with the way to proceed you're suggesting.

Please, let me coordinate this with the guy in charge of the 3D contents (I'm only the sw developer here) and we will send you (let me know the way) as many scenes as you need.

Btw, it would be very fair if we can ask you different doubts we have about you great tool, we have a (not very long) list.

See (write) you tomorrow (remember, CET time).

Best regards.

@julien-moreau
Copy link
Contributor

Thanks for helping me!
Let's discuss on twitter "@luaacro" (https://twitter.com/Luaacro) by private messages and then send our email addresses :)

@julien-moreau
Copy link
Contributor

I keep this issue opened until I find a fix!

@vortice3D
Copy link
Author

Hi there Julien, 3D guy here (you can call me joie);

I've made a very simple and embarrasing scene with a kind of simple PBR material on the object, you can download it here.

As Mario said, our file is huge even with this simple scene.

The way I use to import all the textures is not by drag and drop but by going to "edit->edit textures", so a textures editor comes up. Then I browse and open all the textures.

There comes our first issue: There is no way to import a .HDR environment texture created by us (no problem browsing for the HDR file coming with the default scene though). So I converted the HDR file to DDS and then I am able to open it in the editor. The problem is that the .dds file is much bigger than the original HDR file.

Other issue: Even when I import our three textures (the PBR ones), the editor creates other textures I haven't created (related to environments)

Another issue: When I finish the babylon scene in the editor, I can reopen it inmediately, but I'm unable to open it if I close Firefox and try in a new tab. The editor throws the following errors:

BJS - [10:47:13]: Babylon.js engine (v3.1-alpha) launched babylon.max.js:6243:13
ERROR: Cannot insert node with id=EditorCamera (text: EditorCamera) because another node with the same id already exists.
BJS - [10:47:22]: File: cajadeluz_bwspecularhdr.dds not found. Did you forget to provide it?

That is everything I can think of.
Thank you very much in advance.

@julien-moreau
Copy link
Contributor

Thanks for all these informations!
I reproduced and I now understand! Because the texture is added using the texture editor, the editor saves its value by default, in case you'll not provide the texture again the next time you load the project. I can add an option to not save the base64String when exporting the project.

What do you think?

  • like a "Save content" which can be a checkbox in the texture's row in Textures Editor ?
  • like a "Save textures content" as a main option of your project ?

Also, for HDR, it is still supported by the editor (I mean the loading process) but Babylon.js tells me "Generation of Babylon HDR is coming back in 3.1." pinging @sebavan for more informations :)

@vortice3D
Copy link
Author

joie here;

That option would be really great, that way oyu could have large textures without affecting the babylon file size.

On the other hand, Could you, please, try to open the hdr file I put in the weTransfer link?, when opening, the editor freezes forever.
Also, the editor's default scene doesn't have an HDR environment but a DDS. Do you have any pipeline recommendation for creating DDS files from HDR or EXR?.

Thanks in advance.

@julien-moreau
Copy link
Contributor

Cool! Then I add this option and come back with a fix ASAP! :)

For HDR, you can follow this tutorial to create your DDS files: http://doc.babylonjs.com/overviews/physically_based_rendering hope this will fit your needs!

I also tested to import the HDR file but BabylonJS does not support it since version 3.0 and it comes back in version 3.1. I’ll ask @sebavan if it is in his todo list

@vortice3D
Copy link
Author

vortice3D commented Oct 18, 2017

Mario, here.

First of all, let me thank you very much, Julien.

We got our DDS (from HDR) using that recommend tool: IBLBaker. Anyway, we are going to try now to follow the recommendation of setting the specular resolution to 128 or 256, in order to reduce the output size. We will keep you up to date with further details on this.

About the "base64String" lines, as a "fast-and-dirty" solution we're directly deleted them and it works, but with the following console output:
Error: WebGL warning: texImage2D: No texture is bound to this target. babylon.js:5:24832
Error: WebGL warning: texParameter: No texture is bound to this target. babylon.js:6:15978
Error: WebGL warning: texParameter: No texture is bound to this target. babylon.js:6:16035
Error: WebGL warning: texImage2D: No texture is bound to this target. babylon.js:6:6225
Error: WebGL: No further warnings will be reported for this WebGL context. (already reported 32 warnings)

Any information about how to proceed (with our expeditious method) in order to not have these errors?

Thanks for your time.

@vortice3D
Copy link
Author

Mario here again.

About the IBL change of the specular resolution to 128 or 256, it has decreased dramatically the size of our DDS, thank you very much fort the valious link.

Joie is going to write you with some additional requests for your great BJS Editor in a moment.

Best regard.

@vortice3D
Copy link
Author

joie here;

This is an idea in order to improve your fantastic editor.

When importing a mesh frmo a 3D package, the editor imports also the materials of the scene. It imports them as babylon standard materials though and we need them to be PBR.

Would it be difficult to be able to change the material type inside the editor?.
Now, our workflow is as follows:

  1. Import the 3D scene
  2. Select one mesh and create a new PBR material for it. Now we have two materials because it is impossible to delete the old standard one (as far as I know)
  3. Change the material ID to something meaningful although we can't, in the name of God, change the material name itself, which is "new_material" followed by several alphanumerical text and that makes material assignments very difficult
  4. Assign each material to the corresponding mesh, which is a pain in the ass because of the material name issue

That workflow could be much improved if we could just change the standard material coming from the 3D application to other type, like an options drop menu or similar.

Cheers.

@julien-moreau
Copy link
Contributor

I'm still adding the setting to not export textures content.

Good catch! I'm fixing the material name righ now! I did a mistake: I modify the "id" but I draw the "name", sorry :)

@vortice3D
Copy link
Author

vortice3D commented Oct 19, 2017

Hi Julien:

Btw please note the repetition of "Use Roughness From" labels, at the Metallic group:

typo

Best retards

@julien-moreau
Copy link
Contributor

Unfortunately not, the options are "from alpha" and the other is "from green"
Recently I noticed that all the texts are not displayed correctly if they are too long (it is in my todolist)

@julien-moreau
Copy link
Contributor

Just fixed the check-boxes and texts thanks to @samjoch

@julien-moreau
Copy link
Contributor

The new version introducing the fixes will be up this evening!

@vortice3D
Copy link
Author

Thanks Julien:

We can't wait to test it!

@julien-moreau
Copy link
Contributor

Deploying! Will be up in 5 minutes :)
To find the settings, you can select the scene in the graph and access the settings tab to uncheck

For the BRDF environment texture (automatically generated), I'm trying to find a solution. Your scene now takes 160KB instead of 6MB once exported by the editor

I keep the issue opened until I find a solution for the BRDF texture :)

@julien-moreau
Copy link
Contributor

You can now access http://editor.babylonjs.com/ which as been updated!

@julien-moreau
Copy link
Contributor

Ok I found a solution and deployed the solution!
Let me know if it works for you :) Thanks!

@vortice3D
Copy link
Author

Dear Julian:

First of all I want to thank you for the effort and dedication with all our questions and requests.

We are going to check closely this new version of BJS Editor tomorrow, all day long. This way I think I'll come here again with news on next Monday.

Best regards.

@julien-moreau
Copy link
Contributor

Your welcome, it’s always a pleasure to have users and this kind of really interesting feedbacks!

Thanks for your Feedbacks and don’t hesitate if you have new or improvement proposals: the user experience can be improved by you! :)

@julien-moreau
Copy link
Contributor

To access the settings you can select the "Scene" node in the graph on the right side for instance:
capture d ecran 2017-10-19 a 20 05 06

@vortice3D
Copy link
Author

Thanks Julien, "Settings" tab is perfect for the UX:

We are collecting a series of possible enhancements for the Editor, in order to submit then for your consideration. We'll be in touch with you using the communication channel you indicate.

In any case I think this issue is solved and can be closed.

@julien-moreau
Copy link
Contributor

Thanks! I'm then closing this issue :)
I'm really happy that you have some enhancements to submit, nothing better to improve the editor!
Don't hesitate to create issues like this one, this is a cool tool to follow the advancements

Can't wait for your future issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants