Karl Hulme Posted June 30, 2016 Share Posted June 30, 2016 Hello, What is the correct format of a .babylon file so that it can load an HDR texture into the reflectionTexture slot of a PBRMaterial? I know how to do this in code: var hdrTexture = new BABYLON.HDRCubeTexture("/g/test/interior.hdr", scene, 512); But I can't achieve the same thing with a .babylon file that is loaded with BABYLON.SceneLoader.ImportMesh. This is the last format I tried: { "materials": [ { "customType":"BABYLON.PBRMaterial", "name":"Material", "id":"Material", "alpha":1, "backFaceCulling":true, "albedoTexture": // the albedo loads fine! { "name":"DefaultMaterial_Base_Color.png", "level":1, "hasAlpha":0, "coordinatesMode":0, "uOffset":0, "vOffset":0, "uScale":1, "vScale":1, "uAng":0, "vAng":0, "wAng":0, "wrapU":true, "wrapV":true, "coordinatesIndex":0 }, "reflectionTexture": // this causes an error on load! { "name":"interior.hdr", "level":1, "hasAlpha":0, "coordinatesMode":3, "size":512, "uOffset":0, "vOffset":0, "uScale":1, "vScale":1, "uAng":0, "vAng":0, "wAng":0, "wrapU":true, "wrapV":true, "coordinatesIndex":0 } } ], "meshes":[{...}] } The model loads fine. As does the albedo texture (shown) and the reflectivity and normal textures (not shown). But when I include the Reflection texture it fails. The message in the console is: "babylon.js:3 BJS - [12:09:33]: Error while trying to load texture: /g/test/interior.hdr". Any help much appreciated. kind regards Karl Quote Link to comment Share on other sites More sharing options...
Sebavan Posted July 1, 2016 Share Posted July 1, 2016 Hello, Well Spoted, I ll fix it this week end, thanks for the feeddback ! CU Quote Link to comment Share on other sites More sharing options...
Sebavan Posted July 1, 2016 Share Posted July 1, 2016 Hello, The fix is in a pull request and should then be available by tomorrow evening in the repo: https://github.com/BabylonJS/Babylon.js/pull/1244 Basically, you ll only need to add this line in your json to fix it after updating to the latest version: "customType": "BABYLON.HDRCubeTexture", { "reflectionTexture": // this causes an error on load! { "customType": "BABYLON.HDRCubeTexture", "name":"interior.hdr", "level":1, "hasAlpha":0, "coordinatesMode":3, "size":512, "uOffset":0, "vOffset":0, "uScale":1, "vScale":1, "uAng":0, "vAng":0, "wAng":0, "wrapU":true, "wrapV":true, "coordinatesIndex":0 } } Hope that will help you. Karl Hulme 1 Quote Link to comment Share on other sites More sharing options...
Karl Hulme Posted July 2, 2016 Author Share Posted July 2, 2016 Cool, thanks @Sebavan Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 4, 2016 Share Posted July 4, 2016 It's online:) NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Karl Hulme Posted July 4, 2016 Author Share Posted July 4, 2016 Marvellous! Thanks to both of you. 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.