chriseibel Posted April 10, 2018 Share Posted April 10, 2018 Hello everyone. First of all I would like to say thank you, the posts in this forum often helped me. You guys have a great community! Now to my Problem. I need to create a PBRMaterial out of 4 different textures. There is a BumpTexture, an AlbedoTexture, a Metallic- AND a RoughnessTexture but I only found a way to create this by using a combination of MetallicRoughness. Actually I am using the code below: let pbr = new BABYLON.PBRMaterial("pbr", this._scene); //Create bumpTexture and flip normal. (DirectX <-> OpenGL) pbr.bumpTexture = new BABYLON.Texture("materials/" +filePath +"/02_Texturepack/" +materialName+"Normal.png", this._scene); pbr.bumpTexture.level = -1; //Create albedoTexture pbr.albedoTexture = new BABYLON.Texture("materials/" +filePath +"/02_Texturepack/" +materialName+"BaseColor.png", this._scene); //Create reflectionTexture pbr.reflectionTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("textures/environment.dds", this._scene); //Create metallicRoughnessTexture pbr.metallicTexture = new BABYLON.Texture("materials/" +filePath +"/02_Texturepack/" +materialName+"MetallicRoughness.png", this._scene); //Set metallic and roughness to 1 to use it from the metallicRoughnessTexture pbr.metallic = 1.0; pbr.roughness = 1.0; //set channel with metallic and roughness pbr.useRoughnessFromMetallicTextureAlpha = false; pbr.useRoughnessFromMetallicTextureGreen = true; pbr.useMetallnessFromMetallicTextureBlue = true; //set new material to mesh this._activeMesh.material = pbr; Is there any possibility to seperate the metallic and roughness informations in two different images? At the moment I am editing the metallic texture with photoshop and put the information of roughness into the green channel and the metallic information into the blue channel which works pretty well. unfortunaly thats not a solution, because customer have thousonds of texturepacks I need to show in Babylon without merging metallic and roughness. Greetings, Chris. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted April 10, 2018 Share Posted April 10, 2018 Could you place your roughness/glossiness texture in the microSurfaceTexture property of the pbrMaterial. It is here to answer your use case. The value will be fetched from the r channel. Quote Link to comment Share on other sites More sharing options...
chriseibel Posted April 11, 2018 Author Share Posted April 11, 2018 10 hours ago, Sebavan said: Could you place your roughness/glossiness texture in the microSurfaceTexture property of the pbrMaterial Thank you Sebavan, looks like I skipped this function in the documentation... That works for me. Problem solved. Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted April 11, 2018 Share Posted April 11, 2018 (and just a little tip: instead of setting bump level to -1, I think you can play with invertNormalMapY / X) Sebavan 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.