exc_html5 Posted May 29, 2016 Share Posted May 29, 2016 Howdy Babylonians! When I used the unity3d to babylon exporter it currently takes my cubemap and exports it out to a series of JPGs for the different faces of the cubemap. I would like to have use PNG files instead. I can fix this on the exporter side fairly easily by switching the command to from File.WriteAllBytes(faceTexturePath, tempTexture.EncodeToJPG()); to File.WriteAllBytes(faceTexturePath, tempTexture.EncodeToPNG()); and then also changing the output naming convetion from case CubemapFace.NegativeZ: faceTexturePath += "_nz.jpg"; to case CubemapFace.NegativeZ: faceTexturePath += "_nz.png"; When I change these it makes the PNG and names them correctly, but the exported BJS scene doesn't read in the reflection textures correctly. Here is what it looks like when I export the JPG version: - What it looks like when I switch everything over to PNGs - When I load the scene into the babylon sandbox it says " [15:15:49]: Error while trying to load texture: file:ReflectionProbe-0_pz.jpg " So it's still looking for the jpgs insted of the PNGs. Here are the settings for the shader: { "name" : "babylonjs_sample_material_reflection", "id" : "fb8dec12-8352-4e22-8ec5-83008b1780c1", "backFaceCulling" : true, "wireframe" : false, "ambient" : [1, 1, 1], "diffuse" : [0, 0, 0, 1], "specular" : [1, 1, 1, 1], "emissive" : [0, 0, 0, 1], "specularPower" : 53.588665, "alpha" : 1, "diffuseTexture" : null, "diffuseFresnelParameters" : null, "ambientTexture" : null, "opacityTexture" : null, "opacityFresnelParameters" : null, "reflectionTexture" : { "name" : "ReflectionProbe-0", "level" : 1, "hasAlpha" : false, "getAlphaFromRGB" : false, "coordinatesMode" : 3, "isCube" : true, "uOffset" : 0, "vOffset" : 0, "uScale" : 1, "vScale" : 1, "uAng" : 0, "vAng" : 0, "wAng" : 0, "wrapU" : 1, "wrapV" : 1, "coordinatesIndex" : 0, "isRenderTarget" : false, "renderTargetSize" : 0, "mirrorPlane" : null, "renderList" : null, "animations" : null }, "reflectionFresnelParameters" : null, "emissiveTexture" : null, "emissiveFresnelParameters" : null, "specularTexture" : null, "bumpTexture" : null } Is there a way I can adjust the unity exporter code to have it look for the PNGs that were created instead? Or if not is there a way to alter the shader settings after the fact to have it look for the PNGs? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 31, 2016 Share Posted May 31, 2016 Hey! unfortunately we try to load jpg only by default: https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/Textures/babylon.cubeTexture.ts#L32 BUT there is a good news You can add the extensions you want to use in the .babylon file: https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/Textures/babylon.cubeTexture.ts#L79 So add a "extensions" property under your reflectionTexture entry in your json file and set its value to: ["_px.png", "_py.png", "_pz.png", "_nx.png", "_ny.png", "_nz.png"] Quote Link to comment Share on other sites More sharing options...
exc_html5 Posted May 31, 2016 Author Share Posted May 31, 2016 Thanks! Hopefully that will do the trick! 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.