JohnM Posted July 6, 2018 Share Posted July 6, 2018 Hey all, I am trying to use a dds file as a cube texture. it works fine if i link to it in the usual way, but i am trying to instead load a file into my html5 page of which would then be turned into a cube texture as so - new BABYLON.CubeTexture(reader.result, scene); i have got this working with a normal texture as so - new BABYLON.Texture(reader.result, scene); so im wondering, is it the base64 encoding that is messing up the dds file? if so does anyone know a better way of doing this? the dds file im using is from the playground textures many thanks! Quote Link to comment Share on other sites More sharing options...
Guest Posted July 6, 2018 Share Posted July 6, 2018 Can you try something like that: new BABYLON.CubeTexture(reader.result, scene, null, false, null, null, null, BABYLON.Engine.TEXTUREFORMAT_RGBA, false, ".dds"); This will force the system to use the DDS code path Quote Link to comment Share on other sites More sharing options...
JohnM Posted July 9, 2018 Author Share Posted July 9, 2018 hmm this still doesnt seem to work for me, reflection texture still appears as undefined. here is a PG of what i am trying to do on a very basic level. although there seems to be an error that I am not getting on my local project so not sure if this will actually work with PG hope that helps Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 9, 2018 Share Posted July 9, 2018 @JohnM I would use the PVRTexTool to help figure out the format of your DDS file. Also, read the following post, as it's full of info: DB Quote Link to comment Share on other sites More sharing options...
JohnM Posted July 9, 2018 Author Share Posted July 9, 2018 thanks for the link it was interesting indeed however - I would assume seeing as the .dds file i am using is included in many of the babylon examples that its the best .dds format i could get with regards to compatability? ? also the .dds file does work when used "normally" but when i want to insert it dynamically, this is where my issue is. so i would then assume my problem is how I am passing the data from reader to babylon as i dont have much experience with reader Quote Link to comment Share on other sites More sharing options...
Guest Posted July 9, 2018 Share Posted July 9, 2018 The CubeTexture expects that you send data as base64 which seems to not be the case here dbawel 1 Quote Link to comment Share on other sites More sharing options...
JohnM Posted July 10, 2018 Author Share Posted July 10, 2018 seems to be base64 to me? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 10, 2018 Share Posted July 10, 2018 You have the right Base64. I've created a PG that works for me: https://playground.babylonjs.com/index.html#JPMIF9 JohnM 1 Quote Link to comment Share on other sites More sharing options...
JohnM Posted July 10, 2018 Author Share Posted July 10, 2018 thats perfect, thank you! fixed what ever my issue was. dont really understand what i was doing wrong, only thing i see different is that you didnt use onload or onloadend? 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.