DylanD Posted November 16, 2018 Share Posted November 16, 2018 Hey everyone, I am trying to use assetManager to preload as much as I can. I already have it preloading all of my sounds. However when trying to preload gui elements (specifically gui images) i get stuck. I can use addImageTask to get a HTMLImageElement, however i dont know how to make that into a gui element. Any ideas? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 16, 2018 Share Posted November 16, 2018 hey! here is how you can do it: https://www.babylonjs-playground.com/#XCPP9Y#718 Quote Link to comment Share on other sites More sharing options...
DylanD Posted November 16, 2018 Author Share Posted November 16, 2018 26 minutes ago, Deltakosh said: hey! here is how you can do it: https://www.babylonjs-playground.com/#XCPP9Y#718 Thanks DK that works great!! Just for future reference (as im sure i will forget sooner or later) here is how i ended up doing it with assetsManager https://www.babylonjs-playground.com/#XCPP9Y#719 Thanks again! hcmetal 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted November 16, 2018 Share Posted November 16, 2018 Flagging as solved! DylanD 1 Quote Link to comment Share on other sites More sharing options...
DylanD Posted November 16, 2018 Author Share Posted November 16, 2018 Hey another question about preloading. What should i use to preload shaders? https://doc.babylonjs.com/how_to/how_to_use_assetsmanager#meshassettask The doc doesnt seem to go over it. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 16, 2018 Share Posted November 16, 2018 your shaders? or the stock shaders? Quote Link to comment Share on other sites More sharing options...
DylanD Posted November 20, 2018 Author Share Posted November 20, 2018 On 11/16/2018 at 5:38 PM, Deltakosh said: your shaders? or the stock shaders? my shaders Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 20, 2018 Share Posted November 20, 2018 You could probably rely on TextFileAssetTask and once the task is done fill the ShaderStore with your custom shaders ? Quote Link to comment Share on other sites More sharing options...
DylanD Posted November 20, 2018 Author Share Posted November 20, 2018 45 minutes ago, Sebavan said: You could probably rely on TextFileAssetTask and once the task is done fill the ShaderStore with your custom shaders ? hmm, im not sure i understand what you mean. To clarify(as i am a novice and want to make sure we are on the same page), i have shaders saved as shaderName.vertex.fx and shaderName.fragment.fx, i want to load them with other preloaded assets, just to make the game a bit smoother on initial load in. I plan on saving them to a global object/global variable in my project. How i have the shaders implemented already is (with having the shaders save like above) i use new BABYLON.ShaderMaterial("",scene, shaderPath, {attributes:[], uniforms:[]}); That works great, however i dont use shader store. So what you are saying is i could use textFileAsset task then use that as the fragment and vertex files or use that text to write to shaderstore? Im not sure i would do that as it seems somewhat complicated for little gain (i have 4 shaders so loaded files) Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 20, 2018 Share Posted November 20, 2018 If you only have 4 it might even be easier to make them as part of your script so you do not have download time again before your game starts ? 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.