r3dwolf Posted October 26, 2017 Share Posted October 26, 2017 Hello,I need to convert materials used in unity into babylonjs materials.I'm having trouble with the part of metallic textures and the smoothness parameter (GlossMapScale). This parameter in the exporter is not considered.Has anyone already addressed and solved this problem? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 26, 2017 Share Posted October 26, 2017 Hello, are you using your own exporter or this one: https://github.com/BabylonJS/Exporters/tree/master/Unity 5/EditorToolkit Quote Link to comment Share on other sites More sharing options...
r3dwolf Posted November 7, 2017 Author Share Posted November 7, 2017 Hello @Deltakosh, I'm trying to use metallic textures used in unity and related parameter glossmapscale. I dig into unity to babylon exporter code and I did not find where float glossmapscale parameter is used. Did I miss something? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 7, 2017 Share Posted November 7, 2017 Ping the Unity grandmaster @MackeyK24 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted November 9, 2017 Share Posted November 9, 2017 On 11/7/2017 at 3:16 AM, r3dwolf said: Hello @Deltakosh, I'm trying to use metallic textures used in unity and related parameter glossmapscale. I dig into unity to babylon exporter code and I did not find where float glossmapscale parameter is used. Did I miss something? That would be SceneBuilder.Material.cs - DumpGlossinessReflectivity() The material '_Metallic' is the level of metalness and '_Glossiness' is used for PBR.microSurface. But metallicGlossMap is a texture that would get assigned to PBR.Material - reflectivityTexture and PBR.Material - reflectivity = meatless * albedo Color It all in DumpGlossinessReflectivity() function Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted November 9, 2017 Share Posted November 9, 2017 On 10/26/2017 at 10:38 AM, r3dwolf said: Hello,I need to convert materials used in unity into babylonjs materials.I'm having trouble with the part of metallic textures and the smoothness parameter (GlossMapScale). This parameter in the exporter is not considered.Has anyone already addressed and solved this problem? There is no 'Smoothness' in BabylonJS.... I Basically go: (1.0 - Smoothness = Roughness) But now in Unity 2017.2 there is a 'Standard (Roughness Setup)' If you use the Toolkit, there is nothing special you have to do to use PBR material. Just assign the Unity PBR (Standard, Standard Roughness or Standard Specular)... If you wanna us a 'Metallic Glossmap', just set the 'Metallic' property in the Material Editor... and just use Smoothness in Reverse... Or you can now use Standard Roughness and use the roughness value as expected. Quote Link to comment Share on other sites More sharing options...
r3dwolf Posted November 13, 2017 Author Share Posted November 13, 2017 Hello @ MackeyK24, ok for roughness value, but I think it's also necessary to invert (1-value) the alpha channel of the metallic gloss map (unity takes the values of that channel as smoothness), or I'm wrong? Could you add a property to the PBR material to also support smoothness in the alpha channel? then in the shader, if useSmoothnessFromMetallicTextureAlpha, reverse the value of the channel. Quote Link to comment Share on other sites More sharing options...
r3dwolf Posted February 13, 2018 Author Share Posted February 13, 2018 I tried the latest version of the toolkit, but there must be something wrong. The materials in source scene are all with standard shader with albedo texture, bumpTexture and metallicTexture, no light in scene only HDR. In BJS the materials seem to have no metallicity and the objects in the scene are much darker. How i can fix this? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 13, 2018 Share Posted February 13, 2018 I dont know, send me a copy of scene in a unity package and i take a look at it Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 14, 2018 Share Posted February 14, 2018 Yo @r3dwolf ... If you want me to FIX these kind of issues... you gotta send me the scene so I can take a look and fix the toolkit accordingly Also... The darker scene... I get that too... I dont know if that is just the Difference in Lighting from Unity to Babylon or what... That is what there is a Lighting Section on the Default Scene Controller that you can use to SCALE the various lighting properties... So if you want to boost the Ambient Lighting in your Babylon Scene cause its just a bit darker than what unity is show... try setting the Ambient light scale to 1.5 (or something higher... not toooo high where it is TOOOO intense)... I made those various switches there so you can play with the final Babylon lighting output. We need to get some Unity guys to explain the difference in lighting... why is darker... I think it may have to do with Unity Precomputed Lighting... I bet if we could take that off somehow and unity just use the light value setup in the scene (like we have too for our babylon scene) it would be the same ... that way we would have a WYSIWYG editor experience including the lighting... But remember ... THIS IS NOT A MAGIC UNITY CONVERTER. We a Creating our own babylon scene and simply SCRAPING as much information from the current scene in unity and RE-CREATE that in babylon by serializing directly to a json babylon scene file (which including alot of unity metadata) and the Scene Manager Extension that drive the whole client side Scene Component Life Cycle and parses all the Unity metadata... That is how we actually get the final game output Maybe @Deltakosh or @Sebavan can chime in on the lighting difference... an why things look darker ??? Quote Link to comment Share on other sites More sharing options...
r3dwolf Posted February 14, 2018 Author Share Posted February 14, 2018 Thanks for your answer @MackeyK24, The settings in unity lighting panel are the default settings, where the lighting is taken from the cubemap (hdr) with intensity one. I have several projects / scenes of unity to be converted into BJS and I'm trying to figure out how this conversion should be done to get the same result, in particular as regards the graphic rendering. This is the scene package used for the screenshots above: https://www.dropbox.com/s/8ce5q4r13na5j8b/motore_1.unitypackage?dl=0 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 14, 2018 Share Posted February 14, 2018 Yo @r3dwolf ... I think I found the issue(s). This is why I say send me the scene... Im out here in Maui by myself and doing this toolkit by myself (with quite a bit of forum help). But I need real help, developers to actually work with me ... speak real human words to each other and work together over like gotomeeting or something like that and work out these issues... I really need @Deltakosh to work WITH me on a couple things to really get this thing closed up... Mainly My animation system... I gotta get him to help me blend weight animations... so I can blend a left strafe animation with a walk forward animation with going diagonally up/left... otherwise looks cheesy without proper weighted blended animations. I also need help with coming up with some kind of "Update-Over-Time" system for my Shuriken Style Particle System that sits on top of the BABYLON.ParticleSystem. Anyways... To your problems... Firstly I based the PBR export off the original Unity3DBabylon exporter. In that code they were putting the GLOSSINESS on everything by simply taking the "Metallic" texture and apply the SMOOTHNESS as gloss. If no metallic texture it would create a dummy texture and apply gloss to that... NO REAL material.metallic and material.roughness workflow.... I thought that was wrong... So I implemented the real metallic/roughness workflow where as far as Unity is concerned roughness = 1.0 - smoothness ... basically we flip this value since Unity uses it as "SMOOTHNESS" and we use it as "ROUGHNESS"... The new Unity Standard Roughness shader is Simply the Standard Shader WITH the roughness value MEANT for roughness, so no need to flip when using the new Standard Roughness Shader... the new Roughness shader does NOT have metallic texture... you actually set the Metallic and roughness values directly... (Same as Standard but the toolkit flips smoothness to roughness for you)... Anyways... That works great for the metallic/roughness workflow... But apparently When you use a Texture in the metallic slot, Unity sets the "Metallic" value to 0... it also hide the metallic slide from view. This is why the left 4 balls that use metallic texture have metallic = 0 in the unity json file. So the old way the exporter was HALF right... I will change the toolkit to something like this: If there is a metallic texture, then set metallic and roughness to NULL ---> NO METALLIC WORKFLOW I will then take the metallic texture, make a copy of that and apply the glossiness (The smoothness value) to the metallic texture and save that as the Material Metallic Glossmap... If NO Metallic Texture... then we use the regular metallic/roughness workflow which WONT be ZERO unless you make it zero. I will let you know the progress Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 14, 2018 Share Posted February 14, 2018 Yo @r3dwolf ... Also note ... My toolkit DOES NOT SUPPORT so it WONT export any kind of specular highlights ... that is a Unity Forward Rendering Feature... You must turn off "Specular Highlights" on the PBR material... Or simply ignore them because they wont show in unity... Now if anyone (like @Sebavan or @Deltakosh) can tell me how to some "Add" those specular highlights to the "Material Output" kinda the same way we are using the Metallic texture and applying glossiness to that as the the Metallic Gloss Map... Or we will shortly I will see if I can check if that is on and Warn about those specular highlights ... so you know to at least not expect them to show up in your babylon scene Quote Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2018 Share Posted February 15, 2018 To help on animation I need a really simple case to understand your need (remember that I'm not american nor english so long texts scare the hell out of me ). Perhaps you can have a look at the Unity to gltf exporter? They are supporting both specular and bones animation: https://github.com/sketchfab/Unity-glTF-Exporter JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 15, 2018 Share Posted February 15, 2018 Yo @Deltakosh thanks for replying.... I will make a small and clear video showing the help I need with he BabylonJS side of Blended Weight Animations... But in the meantime, I am trying to address HDR Reflections for @r3dwolf and other using PBR and HDR Reflections When ever I use a normal HDRCubeTexture for reflections ... the reflected image in a sphere for example seems to off... I dont know of it rotated funny or flipped or inverted, but it does not match the orientation of the original usage. Take for example the UNITY shot from @r3dwolf ... I using a skybox, there is a WINDOW in the reflection that SHOULD be directly behind ... Checkout Red Annotation Square on Black sphere ... All the sphere show the window from the skybox DIRECTLY BEHIND CAMERA But when I use that HDRCubeTexture in BabylonJS... Things are off: Looks like the HDRCubeTExture is being Rotated for some reason... I will make another example in next post that is a little clear to see Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 15, 2018 Share Posted February 15, 2018 Yo @Deltakosh Here a more clear example. In unity the reflection is right behind me. Unity Full editor setup how reflection show look: But in Babylon its rotated like the Balls from Above in TOP post Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 17, 2018 Share Posted February 17, 2018 On 2/14/2018 at 3:26 PM, Deltakosh said: To help on animation I need a really simple case to understand your need (remember that I'm not american nor english so long texts scare the hell out of me ). Perhaps you can have a look at the Unity to gltf exporter? They are supporting both specular and bones animation: https://github.com/sketchfab/Unity-glTF-Exporter Yo @Deltakosh This is a snippet from another post describing what I need to do: Hi guys I'm writing the locomotion algorithm for a character I created in blender. What I'm trying to achieve is a blend tree that will allow me to blend between the "walk-front", "strife-left" animations according to the velocity of my character (something similar to https://www.youtube.com/watch?v=Xx21y9eJq1U&feature=youtu.be&t=1263). I've been able to blend between two frames, by calculating a weighted average of the transformation matrix for each bone, so far so good. Now before going on with my development I'm asking myself the following design question. Supposing I will have a state machine to control the character, should I write an update(dt) method called at each engine tick and reposition its bones individually or rather bake at run-time a new animation with frames each time the direction/velocity changes? I just do not know the pros/cons sticking with Babylon Animations versus going on with my own update method. What I like of using Babylon Animations is the fact that I can fast up / slow down my walk cycles so to simulate faster/slower velocities. Thank you in advance for any feedback, Joez Now... I need to know where is the best place to HOOK into the animation system so I can get to the MATRIX for for bone RIGHT before the animation system is going to use that keyFrame's matrix value to set the pose of that bone for that frame... I can then go get the other matrix from the other animation for that time and LERP the second matrix values with the BlendFactor as the the leap value... Then feed that BLENDED BY WEIGHT matrix into the animation instead of the original matrix... That should give blended animations.... Left strafe blended with walk forward on that frame should give a diagonal looking animation... But I dont know where to hook into the babylon animation system to do this stuff... Of worse have to write the timing for this and MANUALLY set the pose each frame... I dont know... I need your help on making the MOST OPTIMIZED approach to animation weight blending... Pretty please Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 18, 2018 Share Posted February 18, 2018 On 2/14/2018 at 3:26 PM, Deltakosh said: To help on animation I need a really simple case to understand your need (remember that I'm not american nor english so long texts scare the hell out of me ). Perhaps you can have a look at the Unity to gltf exporter? They are supporting both specular and bones animation: https://github.com/sketchfab/Unity-glTF-Exporter Yo @Deltakosh This is not quite what I meant ... I need help on getting to the nitty gritty of the babylon animation stuff... So I can blend the bone animation matrix (RIGHT BEFORE IT GET USED BY BABYLON TO SET THE POSE) and BLEND IN OTHER animation matrix ... I assume I just need to LERP each animation frame matrix together using the blend factor (from user input 0 to 1) to blend them all together... I need to know where in the code Babylon Framework to make those kind of changes But the info about the sketch lab was great... I am already doing all that stuff to a native babylon json... but I was good to see I was pretty on track with everything they are doing already... I did some stuff on metallic gloss mapping pixel combining that I am going to STEAL Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 18, 2018 Share Posted February 18, 2018 Yo @Deltakosh .. I did try the bounding Box ... but that did not help the funny rotation I seem to get when using HDR panorama Cube Textures... Note... if use just regular 6 side cube textures (BABYLON.CubeTexture), things are rotated perfect... but BABYLON.HDRCubeTextures look like above Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted February 18, 2018 Share Posted February 18, 2018 Yo... Very cool graphics btw. Great skybox. : ) Quote Link to comment Share on other sites More sharing options...
r3dwolf Posted February 20, 2018 Author Share Posted February 20, 2018 Hi @MackeyK24 I did not understand how you got that result . Ok, the hdr has a counterclockwise rotation of 90 degrees, but it is decidedly better than what I was able to export ! Did you get it with the EditorToolkit? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 20, 2018 Share Posted February 20, 2018 10 hours ago, r3dwolf said: Hi @MackeyK24 I did not understand how you got that result . Ok, the hdr has a counterclockwise rotation of 90 degrees, but it is decidedly better than what I was able to export ! Did you get it with the EditorToolkit? Yep Using EditorToolkit (I am the develop of the Toolkit). But yeah, this is a work in progress version... Since we were not getting the GLOSSY and METALNESS ... I was forced to re-do the PBR Export Pipeline. Still workin on the "Encoding The Metallness" in to a glossmap. But as you can see its coming along JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 20, 2018 Share Posted February 20, 2018 On 2/17/2018 at 5:03 AM, MackeyK24 said: Yo @Deltakosh This is a snippet from another post describing what I need to do: Hi guys I'm writing the locomotion algorithm for a character I created in blender. What I'm trying to achieve is a blend tree that will allow me to blend between the "walk-front", "strife-left" animations according to the velocity of my character (something similar to https://www.youtube.com/watch?v=Xx21y9eJq1U&feature=youtu.be&t=1263). I've been able to blend between two frames, by calculating a weighted average of the transformation matrix for each bone, so far so good. Now before going on with my development I'm asking myself the following design question. Supposing I will have a state machine to control the character, should I write an update(dt) method called at each engine tick and reposition its bones individually or rather bake at run-time a new animation with frames each time the direction/velocity changes? I just do not know the pros/cons sticking with Babylon Animations versus going on with my own update method. What I like of using Babylon Animations is the fact that I can fast up / slow down my walk cycles so to simulate faster/slower velocities. Thank you in advance for any feedback, Joez Now... I need to know where is the best place to HOOK into the animation system so I can get to the MATRIX for for bone RIGHT before the animation system is going to use that keyFrame's matrix value to set the pose of that bone for that frame... I can then go get the other matrix from the other animation for that time and LERP the second matrix values with the BlendFactor as the the leap value... Then feed that BLENDED BY WEIGHT matrix into the animation instead of the original matrix... That should give blended animations.... Left strafe blended with walk forward on that frame should give a diagonal looking animation... But I dont know where to hook into the babylon animation system to do this stuff... Of worse have to write the timing for this and MANUALLY set the pose each frame... I dont know... I need your help on making the MOST OPTIMIZED approach to animation weight blending... Pretty please Pinging @Deltakosh (or anybody who can help me get to the NITTY GRITTY of the animation code) Please review post above.... I REALLY need to get Animation Blending done Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted February 20, 2018 Share Posted February 20, 2018 Hey @MackeyK24 possibly create new thread specific to "nitty gritty of animation code"? Ping me there, happy to try to help with that question ... separate of pbr or unity textures? : ) Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted February 21, 2018 Share Posted February 21, 2018 Yo @r3dwolf Here is what I got so far... I end up tweaking on the version metallic and roughness properties based on the current Skybox lighting model... Each workflow (MetallicRoughness, MetallicTexture and SpecularGlossiness) has it own "Light Scaling" applied to EMULATE what unity does as well. For Metallic Texture I just end up take a bunch of WHITE pixels that are the size of the metallic gloss map... I then multiply the RED or BLUE channel from the metallic texture INTO the white surface pixels/texture... I also INVERT and use the alpha from the metallic texture in the WHITE pixels and use that FIXED up metallic texture as babylonMaterial.metallicTexture. Check this out : BJS Toolkit - PBR Materials Update ... Video ready 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.