MackeyK24 Posted December 2, 2017 Share Posted December 2, 2017 @dsman wrote: Once again thanks for creating Unity Toolkit, it is so much helpful for our startup. There are few issues. If you can point out where to fix probably we can contribute to toolkit as well. When we apply a PBRMetalicRoughness Babylon material (Material drop-down -> BabylonJS -> PBRMetalicRoughness) to any surface and then export the scene, the uv tiling is different for both basic albedo texture and Bump Map (Normal map in Unity). If we have 10x 10 tiling for main albedo texture, the bump map is applied at 1x1. Surprisingly it didn't happen in on another mesh with tiled albedo. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted December 2, 2017 Share Posted December 2, 2017 Did you set the scale on both texture in the exporter ? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 2, 2017 Author Share Posted December 2, 2017 Yo @dsman I fixed this in 3.1 beta ... but for now in SceneBuilder.Materials for both standard and pbr after setting the normal texture: DumpStandardMaterial() AFTER // Normal map bMat.bumpTexture = DumpTextureFromMaterial(material, "_BumpMap"); if (bMat.bumpTexture != null && material.HasProperty("_BumpScale")) { bMat.bumpTexture.level = material.GetFloat("_BumpScale"); } ADD THIS if (bMat.diffuseTexture != null && bMat.bumpTexture != null) { bMat.bumpTexture.uScale = bMat.diffuseTexture.uScale; bMat.bumpTexture.vScale = bMat.diffuseTexture.vScale; bMat.bumpTexture.uOffset = bMat.diffuseTexture.uOffset; bMat.bumpTexture.vOffset = bMat.diffuseTexture.vOffset; } DumpPBRMaterial() AFTER // Normal babylonPbrMaterial.bumpTexture = DumpTextureFromMaterial(material, "_BumpMap"); if (babylonPbrMaterial.bumpTexture != null && material.HasProperty("_BumpScale")) { babylonPbrMaterial.bumpTexture.level = material.GetFloat("_BumpScale"); } ADD THIS if (babylonPbrMaterial.albedoTexture != null && babylonPbrMaterial.bumpTexture != null) { babylonPbrMaterial.bumpTexture.uScale = babylonPbrMaterial.albedoTexture.uScale; babylonPbrMaterial.bumpTexture.vScale = babylonPbrMaterial.albedoTexture.vScale; babylonPbrMaterial.bumpTexture.uOffset = babylonPbrMaterial.albedoTexture.uOffset; babylonPbrMaterial.bumpTexture.vOffset = babylonPbrMaterial.albedoTexture.vOffset; } Quote Link to comment Share on other sites More sharing options...
Sebavan Posted December 2, 2017 Share Posted December 2, 2017 @MackeyK24 Is it working with this ? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 2, 2017 Author Share Posted December 2, 2017 Should be... the scene file has proper values for BOTH textures now I am still having issues with the latest 3.1 beta REALLY slowing my scenes down that are using cannon... I cannot figure out what changed and why this is happening... All I know is that using the Alpha version which is in toolkit... I made the space shooter demo... if I simply replace the babylon.js with the current 3.1 beta EVERYTHING having to do physics SLOWS DOWN... All the asteroids and laser shots and every I move around with setLinearVelocity is just DOG SLOW... I can pin point what the issue is BUT IS REALLY SLOW... I know that pretty generic... I cant repo in playground because it was a whole game already ... All I can do is make available the FINISHED BUILD project folder with all scene assets an script code... So I just been waiting to hope it just GETS FIXED But when ever it does, I have plenty more fixes for Terrains and a a few project build fixes for faster export/builds the the toolkit 3.1 Beta Release Yeah look at all those smiley faces Quote Link to comment Share on other sites More sharing options...
Sebavan Posted December 2, 2017 Share Posted December 2, 2017 So physics might be the slow down we were looking for @RaananW ? any idea ? Quote Link to comment Share on other sites More sharing options...
dsman Posted December 2, 2017 Share Posted December 2, 2017 @MackeyK24 Thanks for the fix. You are great. So are you saying we I should clone the latest commit (Nov 11) and make above changes and build the ToolKit locally? I know C#, I can make changes but would be great if tell me more about build instructions. Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 5, 2017 Share Posted December 5, 2017 @MackeyK24 - about cannon, what is your world scale? there was an issue with the step time we provide to cannon, which was fixed for 3.1 . so if your world scale is very big, it will seem like the scene is slower. in reality, it is physically correct. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 19, 2017 Author Share Posted December 19, 2017 On 12/5/2017 at 12:06 PM, RaananW said: @MackeyK24 - about cannon, what is your world scale? there was an issue with the step time we provide to cannon, which was fixed for 3.1 . so if your world scale is very big, it will seem like the scene is slower. in reality, it is physically correct. Hey @RaananW Dunno where i would set this... if you are just talking about the scale of the geometry ... i guess that would be the default unity scaling. Can you please take a look at Space Shooter Demo - 3.2 Alpha if you need to see what the one was like using 3.1 alpha... Working 3.1 Alpha Demo Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 19, 2017 Author Share Posted December 19, 2017 On 12/5/2017 at 12:06 PM, RaananW said: @MackeyK24 - about cannon, what is your world scale? there was an issue with the step time we provide to cannon, which was fixed for 3.1 . so if your world scale is very big, it will seem like the scene is slower. in reality, it is physically correct. Yo @RaananW i cant seem to find anything about setting world scale... What is that and where would i set that... In babylon ??? Quote Link to comment Share on other sites More sharing options...
dsman Posted December 19, 2017 Share Posted December 19, 2017 @MackeyK24 Please tell me how do I use Toolkit 3.1 Beta. If it's not committed to the repository, where do I do code changes you mentioned in above post? Will I have to build binaries for Toolkit after making changes? Please let me know. These fixes are very crucial for our us. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 20, 2017 Author Share Posted December 20, 2017 Yo @dsman There is something wrong with the way cannon js plugin is working with my Unity Exported content. I think it may have something to do the "World Scale" changes some of the BIG DOGS who maintain the babylon js codebase. Anyways... There is no working 3.1 Beta or 3.2 xxxx. My toolkit seems to be stuck on 3.1 Alpha until the physics issues get fixed (or someone tells me how to address the changes they put in BabylonJS codebase) Sorry Quote Link to comment Share on other sites More sharing options...
dsman Posted December 20, 2017 Share Posted December 20, 2017 @MackeyK24 Ok. I understand. But then if you can tell me where can I make code changes you suggested to fix the issue of normal map tiling, at least we can continue using the current Toolkit version. I simply need file name of above code changes you suggested and instruction to build/compile the Toolkit. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 20, 2017 Author Share Posted December 20, 2017 On 12/1/2017 at 4:46 PM, MackeyK24 said: Yo @dsman I fixed this in 3.1 beta ... but for now in SceneBuilder.Materials for both standard and pbr after setting the normal texture: DumpStandardMaterial() AFTER // Normal map bMat.bumpTexture = DumpTextureFromMaterial(material, "_BumpMap"); if (bMat.bumpTexture != null && material.HasProperty("_BumpScale")) { bMat.bumpTexture.level = material.GetFloat("_BumpScale"); } ADD THIS if (bMat.diffuseTexture != null && bMat.bumpTexture != null) { bMat.bumpTexture.uScale = bMat.diffuseTexture.uScale; bMat.bumpTexture.vScale = bMat.diffuseTexture.vScale; bMat.bumpTexture.uOffset = bMat.diffuseTexture.uOffset; bMat.bumpTexture.vOffset = bMat.diffuseTexture.vOffset; } DumpPBRMaterial() AFTER // Normal babylonPbrMaterial.bumpTexture = DumpTextureFromMaterial(material, "_BumpMap"); if (babylonPbrMaterial.bumpTexture != null && material.HasProperty("_BumpScale")) { babylonPbrMaterial.bumpTexture.level = material.GetFloat("_BumpScale"); } ADD THIS if (babylonPbrMaterial.albedoTexture != null && babylonPbrMaterial.bumpTexture != null) { babylonPbrMaterial.bumpTexture.uScale = babylonPbrMaterial.albedoTexture.uScale; babylonPbrMaterial.bumpTexture.vScale = babylonPbrMaterial.albedoTexture.vScale; babylonPbrMaterial.bumpTexture.uOffset = babylonPbrMaterial.albedoTexture.uOffset; babylonPbrMaterial.bumpTexture.vOffset = babylonPbrMaterial.albedoTexture.vOffset; } Yo @dsman .. I Already posted these instructions And the actual source is automatically compile by unity when you save changes (it actually complies all the source for the project even time you open the project as well) Basically find the DumpPBRMaterial and DumpStandardMaterial functions in the SceneBuilder.Materials.cs file and follow snippets above Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 20, 2017 Share Posted December 20, 2017 Hi, about world scale - sorry, I should have explained better. What is the scale of 1 unit in your scene. If an object has height set to 1, is it one meter, centimeter, kilometer? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 20, 2017 Author Share Posted December 20, 2017 19 minutes ago, RaananW said: Hi, about world scale - sorry, I should have explained better. What is the scale of 1 unit in your scene. If an object has height set to 1, is it one meter, centimeter, kilometer? Unity 1 Unit = 1 meter Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 20, 2017 Share Posted December 20, 2017 Should be fine then. It would be great to see the scene reproduced somewhere, so I can check why it is so slow. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 20, 2017 Author Share Posted December 20, 2017 2 hours ago, RaananW said: Should be fine then. It would be great to see the scene reproduced somewhere, so I can check why it is so slow. You can... http://mackey.cloud/games/space2 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.