hw3web Posted August 7, 2015 Share Posted August 7, 2015 Hi there I try to load babylon file from STRING, I found : BABYLON.SceneLoader.Load("", "data:...", engine, function (newScene) { }); on : http://doc.babylonjs.com/exporters/Working_with_Blender but it just don't show model , even if it is only box . I am interested can I put something like var scenetexture = "data:image/png;base64,iVBORw0KGgo ...";var scenebabylon = "data:{ .......}"; BABYLON.SceneLoader.Load(scenetexture, scenebabylon, engine, function (newScene) { }); and fallowing question if that possible , can we use more then one texture in string as texture for model in babylon scene ?? Regards Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 8, 2015 Share Posted August 8, 2015 can you setup a small playground to see what is going wrong? Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 8, 2015 Author Share Posted August 8, 2015 http://www.babylonjs-playground.com/#1OIKHP#4 I try use one texture , if that could be corrected how to do with 2 textures ? Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 10, 2015 Author Share Posted August 10, 2015 So still nobody can tell me why it don't want to loaded ? Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 10, 2015 Share Posted August 10, 2015 That playground somehow doesn't work for me. I get an error: Compilation errorCannot read property 'replace' of null Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 10, 2015 Share Posted August 10, 2015 Your error is that the way the SceneLoader.Load() function should not receive a picture "scenetexture" but a path where this file .babylon is.Then load this file .babylon to find images. but if it does not exist (the images) the scene returns an error. I think your method to load the scene on the playground, is not a good method. Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 10, 2015 Author Share Posted August 10, 2015 Hi there that is a reasons why I put this topic on: to ask if anyone know how to load scene from string not file that was suggest on : http://doc.babylonjs.com/exporters/Working_with_Blender I know is not working but I tried use structure BABYLON.SceneLoader.Load("", "data:...", engine, function (newScene) { }); I try to get it to work so is there anyone who will be able to solve this miss use loading Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 10, 2015 Share Posted August 10, 2015 Hi, Sorry, I did not watch the first post I do not think the playground it may be possible models with textures from external link.maybe manually adding external links in babylon file. and add an http link in the playground. maybe it could work. BABYLON.SceneLoader.Load("http://www.link.com/folderMeshAndTextures/", "mesh.babylon", engine, function (newScene) { }); Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 10, 2015 Author Share Posted August 10, 2015 Question is different : how to load scene from STRING ?? and in this same time with textures ??? you can playground load mash from other server : http://playground.babylonjs.com/#1VOQP6#6 and here you can see I loading mesh from string not link, But how to load full scene that will also keep textures as well in strings !???? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 10, 2015 Share Posted August 10, 2015 I really do not understand what you try to do. here:BABYLON.SceneLoader.Load("", scenelink, engine, function (newscene) { You load a file name is path. and in the way you leave blank The first parameter of the Load function is not a name like ImportMesh function but with a path to the file szene. BABYLON.SceneLoader.Load("path", "file.babylon", BABYLON.SceneLoader.ImportMesh("name", "path", "file.babylon", Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 10, 2015 Author Share Posted August 10, 2015 What I try to do is load scene and texture from browser storage not server if that make any sense . to be able to do this I need have texture(s) and scene in string not as files So I have all in strings texture(s) and scene in string value and now I try load it on stage. Quote Link to comment Share on other sites More sharing options...
rodrigop Posted August 10, 2015 Share Posted August 10, 2015 Try to look at here:https://github.com/BabylonJS/Babylon.js/blob/1f3b216f2e91117c9876e634de24b99764f19654/src/Loading/babylon.sceneLoader.ts#L32 On that file you can also look at the declaration of Load. Seems like the loader is plugin based, and depends on the extension of the filename. Anyway you can create your own loader plugin like this: here https://github.com/BabylonJS/Babylon.js/blob/1f3b216f2e91117c9876e634de24b99764f19654/src/Loading/Plugins/babylon.babylonFileLoader.ts#L1351 Hope that helps. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 10, 2015 Share Posted August 10, 2015 OK I see. Your "data:" string maybe not good. and you must call images from external links. see mistakes in the Console (f12) Quote Link to comment Share on other sites More sharing options...
rodrigop Posted August 10, 2015 Share Posted August 10, 2015 Maybe you can also look at overriding the Tools LoadFile Fn: https://github.com/BabylonJS/Babylon.js/blob/53c95c2fbf0cc4776d1e1f0ed1883ae61e2d5c34/src/Tools/babylon.tools.js#L201 Or even overriding XMLHttpRequest.open()?http://stackoverflow.com/questions/7775767/javascript-overriding-xmlhttprequest-open Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 10, 2015 Share Posted August 10, 2015 @hw3web : This works for me, I can see the loaded scene and texture from your data string Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 11, 2015 Author Share Posted August 11, 2015 I found problem if I want to use BABYLON.SceneLoader.Load and scene is string data:{ ..... works when I want load via BABYLON.SceneLoader.ImportMesh("name", "path", "data: { ...} ", bat not with Load as full scene - I am not sure why ??? Anyone any idea ?? I even try file: Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 12, 2015 Share Posted August 12, 2015 Repro on playground ? Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 12, 2015 Author Share Posted August 12, 2015 OK is look like all is fine, string for texture and scene loading from string texture is replace by overwrite BABYLON.TOOLS http://playground.babylonjs.com/#1VOQP6#20 , but 1) why I see picture without transparency - as it is png with alpha as cloud, 2) and why this message about camera !??? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 12, 2015 Share Posted August 12, 2015 Sounds better The error is because the playground checks if the returned scene contains a camera and in your case there is no returned scene so a default one is created with no camera. Your scene is only created when the file is loaded. So just do not take care of this message For the texture, as there is no extension due to string loading, you have to manually get the texture once loaded and set hasAlpha = true Quote Link to comment Share on other sites More sharing options...
hw3web Posted August 12, 2015 Author Share Posted August 12, 2015 is this {"name":"1texture.png","level":1,"hasAlpha":1 not enought ??? directly on scene !??? - or should exporter be updated ? in string is image/png information provided Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 13, 2015 Share Posted August 13, 2015 Ok I found why: just remove "checkReadyOnlyOnce":true because the first check is done when the texture is not loaded and thus alpha testing is set to off and remains like this hw3web 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.