javalang Posted August 20, 2017 Share Posted August 20, 2017 @Deltakosh Hello, sorry for the trouble, I red the Doku "Master the Physically Based Rendering" again and again, but I can't figure out the flags "FromMetallicRoughness to PBRMaterial": First of all I think there is something semantically wrong, maybe a typus?: Quote useAmbientOcclusionFromMetallicTextureRed: the metallic texture contains the ambient occlusion information in its alpha channel. Besides this, there are some other points unclear, I also analyzed the sourcecode, but without having success. Ok, starting easy with Roughness: can be either in Alpha or Green in the MT, so far so clear. But what happens on 1) ? Suggestion: only one flag: "useRoughnessFromGreenInsteadFromAlpha" ? Regarding the statement below, does this mean if UMFMTB==false the Red channel is used for Metallness? If this is the case then 7) is conflicting or there must be another statement: if UAOFMTR==true then metallness must be in BLUE ??? Quote useMetallnessFromMetallicTextureBlue: the metallic texture contains the metallic information in its blue channel (it is considered in the red channel by default). And at least, I cannot figure out the meaning of "UseAmbientInGrayscale" ==true (9). It seems to be a redundant flag? Perhaps it would be good to know about the priority how these flags are processed, maybe this gives a bit light in my darkness Anyway, I put my insights into a truth table, thanks in advance. PS: Maybe a much better way to give a clear overview is to define three selectors: a RoughnessSelector, MetallinessSelector and AOSelector. Each of these selectors can then be assigned with a number representing the channel of the Metallic/Ambient Texture. Quote Link to comment Share on other sites More sharing options...
javalang Posted August 21, 2017 Author Share Posted August 21, 2017 Regarding "From Specular Glossiness to PBR Material" I have also some questions: I've found out that the ambient color has no effect on the PBR MAterial. Is this a bug or a feature? Reading the two statements below, how can the AO value retrieved from the metallic texture when this texture is null or undefined? Is this flag obsolete? Any help is welcome, thank you Quote The following properties need to be null or undefined: metallic roughness metallicTexture Quote useAmbientInGrayScale: the ambient occlusion is forced to read only from the red red channel of the ambient texture or from the red channel of the metallic texture. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 21, 2017 Share Posted August 21, 2017 Hello, useAmbientOcclusionFromMetallicTextureRed means the ambient is used from the red channel of the metallic texture (I have just fixed the doc). useRoughnessFromGreenInsteadFromAlpha is a nice idea. I kept both flag for back compat purpose but I agree it could be one boolean. If both useRoughnessFromMetallicTextureAlpha and useRoughnessFromMetallicTextureGreen are false, the roughness will be only retrieved from the scalar value which is a nice setup if you want to rely on a separate microSurfaceTexture. useMetallnessFromMetallicTextureBlue this forces to use the blue channel instead of red for the metalness. This can conflict with useAmbientOcclusionFromMetallicTextureRed if not carefully setup as both ambient and metal would be taken from the same channel. UseAmbientInGrayscale helps switching from using the luminance of the occlusion texture instead of the red channel only. Depending on the tools you are using to create your AO texture this might help. If useAmbientOcclusionFromMetallicTextureRed has been set, you will only use the red channel anyway. I do agree this is lot of options and this was the main purpose for us to create the two new simpler versions: PBRMetallicRoughnessMaterial and PBRSpecularGlossinessMaterial. Those have a limited set of features available ensuring the reduced confusion. Regarding the selector, it is a really cool idea, feel free to submit a PR for it, I would happily integrate it in. Quote Link to comment Share on other sites More sharing options...
javalang Posted August 21, 2017 Author Share Posted August 21, 2017 @Sebavan thanks Sebavan, I didn't know that there first was the PBRMaterial and after then the specialized versions were created, I thought it was the opposite way. I understand the problem with the backward compatibility , anyway it is a bit clearer for me now, I will try to integrate these parameters to my fresh PBR Composer. But there is another question just now: once started with the Glossy setup (with metallic, roughness and metallicTexture =null), then changed to the Metallic setup everything works fine, but I cannot switch back to the Glossy setup (with setting metallic, roughness and metallicTexture again to null). Is there a special function to bring the material back to initial state? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 21, 2017 Share Posted August 21, 2017 This one is a bug, the fix will be in in one hour. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 21, 2017 Share Posted August 21, 2017 Done : https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/PBR/babylon.pbrBaseMaterial.ts#L704 Thanks for reporting it. Quote Link to comment Share on other sites More sharing options...
javalang Posted August 21, 2017 Author Share Posted August 21, 2017 @Sebavan Thanks for the ultra fast service! Quote Link to comment Share on other sites More sharing options...
javalang Posted August 21, 2017 Author Share Posted August 21, 2017 @Sebavan Sorry, its again me, I just found out, the micrSurfaceTexture and the MetallicTexture doesn't recognize the .level property. Is this a design specifica? On the other hand it would be nice to fine-adjust these textures... Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 21, 2017 Share Posted August 21, 2017 It is by design for performance. as it is multiplied by the respective scalar eg mettalic or roughness, you can control it there and it prevents one MUL :-) Quote Link to comment Share on other sites More sharing options...
remotedeveloper Posted March 13, 2021 Share Posted March 13, 2021 Hi, Not sure if this is related or not but when setting the various values of a pbr material on a loaded glb file I cannot set the metalic value successfully. Roughness and albedo seem fine but when I set the metalic value in code it does not change. If I then view the scene the value in the debugger the metalic vale is 0 and not as I had set it in the code but if i move the metalic slider tiohas the desired effect but setting it in code doesn't seem to and its limited only to the metalic value of PBR material. This seems to be the case only when I load a glb model and then try and set the metalic value on the already assigned pbrMaterial. Thanks in advance, Kev 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.