Hersir Posted May 31, 2017 Share Posted May 31, 2017 Hi, I used EnvironmentMapGenerator to generate hdr texture. I tried to use it from code it works great but I would like to add it inside babylon file. { customType: "BABYLON.HDRCubeTexture", name: "some.babylon.hdr", size: 256 } If I add size I get error Bad HDR Format but without size option I get byte length of Int32Array should be a multiple of 4. (standard hdr works great). Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted May 31, 2017 Share Posted May 31, 2017 @Hersir, I don't have the chance to test it out, try this and report back, as it seems to work for other people: { "reflectionTexture": { "customType": "BABYLON.HDRCubeTexture", "name":"some.babylon.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 } } Quote Link to comment Share on other sites More sharing options...
Hersir Posted May 31, 2017 Author Share Posted May 31, 2017 No this doesn't help. Will check code on babylonjs to see where could be difference between adding HDR in code and from babylon file. Also weird that hdr that is not altered by EnvironmentMapGenerator is working properlly Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted May 31, 2017 Share Posted May 31, 2017 Was gonna do that but github was down. Let's see! Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted May 31, 2017 Share Posted May 31, 2017 @Hersir, here is the line (https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/HDR/babylon.hdr.ts#L87) var line = this.readStringLine(uint8array, 0); if (line[0] != '#' || line[1] != '?') { throw "Bad HDR Format."; } First character should be "#" or the second one "?". Could you upload the HDR file you are trying to use? I think the problem is there and not on babylon side. Quote Link to comment Share on other sites More sharing options...
Hersir Posted June 1, 2017 Author Share Posted June 1, 2017 @Nesh108 I found it . If hdr is enhanced by EnvironmentMapGenerator , isBABYLONPreprocessed is needed; Working version: { customType: "BABYLON.HDRCubeTexture", name: "some.babylon.hdr", isBABYLONPreprocessed: true, hasAlpha: 0, level: 1, coordinatesMode: 3 } Nesh108 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.