Sign in to follow this  
AlbertTJames

Import PBR texture from Unity all black

Recommended Posts

Hi,

 

So I have another problem, this time with the PBR textures imported from unity using Babylon2unity. If I am using any light other than Hemilight (pbr material from unity seem to work with it), all the textures show up black. Again it might be solved by some tweaks in the texture objects, so I have been looking for the problem for hours now... I had some successes, failure, a lot of frustration. So I thought i should ask for your help. 

 

On the first image this is the results of my tweaking using an omnilight. So I though I had it figured out, by changing the reflectivityColor and reflectionColor from 0,0,0 to 1,1,1 it seems I get back my texture for the little robot in the middle (the infamous roger robot). With some shadow etc. I also changed the "hasAlpha" in the reflectivityTexture (because it does have alpha) and changed useMicroSurfaceFromReflectivityMapAlpha and useAutoMicroSurfaceFromReflectivityMap to "true" (one of them was already to true, can't remember which one) - that did work with matte region becoming matte, at long last. 

 

So I said Great ! lets change the reflectivity color and reflexion color for one of the tile type (the little hexagons thingy). By doing that I also get back the texture normal color BUT, light does not seem to interact in the same way, the mesh is lighted both in front and behind similarly... the back face should be black no? (see image 2).

 

The last 2 images is with the hemilight (front and back) , it seems the material is behaving normally...   You might be wondering why I am persisting on resolving this issue when I have a perfectly well behaved light source at disposal... and that is a very relevant question.

Any idea(s) ?

 

Light source code:

var hemiLight = new BABYLON.HemisphericLight('hemiLight', new BABYLON.Vector3(0, 0, -30), scene);
hemiLight.intensity = 2;
// var sun = new BABYLON.PointLight("sun", new BABYLON.Vector3(0, 50, 0), scene);
// sun.intensity = 2;

 

Screen Shot 2016-08-25 at 20.13.58.png

Screen Shot 2016-08-25 at 20.34.56.png

Screen Shot 2016-08-25 at 20.42.40.png

Screen Shot 2016-08-25 at 20.42.59.png

Share this post


Link to post
Share on other sites

Don't forget hemilight.groundColor = BABYLON.Color3.Gray()  -  lights up the sides and bottoms of things.  :)  Other than that, I got nothin'.  I'll keep thinking, though.  A careful examination of your .babylon file, perhaps using a nice online json-to-tree viewer, might reveal something, though.  And maybe not.  I also don't know who maintains the unity exporter.

Maybe drop it in the sandbox, too... see what it looks like.  I know there was some changes to materials done today... so make sure you get the latest BJS.  The changes were mentioned in this thread.

What a great help I am, huh?  :D  (sorry)

Share this post


Link to post
Share on other sites

Thank you, it does help :) I've been reading JSON for two days now, i think I will really stop here and do something else with my life :P 

 

I used the material editor to make a standard material with the same texture, you can see on this image the standard material of Roger the Evil Robot reflects far more the hemilight than the PBR material of the boring colored tiles..

 

PS: Some of you might be wondering why the hell I am still trying to use PBR when I have a standard material than is working fine  ... and that again, would be a very valid point.

 

Screen Shot 2016-08-25 at 23.17.41.png

Share this post


Link to post
Share on other sites

About the lights, the PBR is trying to follow some physics for the light falloff:

http://doc.babylonjs.com/overviews/Physically_Based_Rendering_Master#inversed-squared-light-falloff-and-light-radius

An hemi light (being a bit like ambient) does not have any falloff so everything is lit. With point light, the falloff with PBR is huge compared to standard (but physically closer from nature). To use the same light values you are used to in BJS, simply turn the physical falloff off:

pbr.usePhysicalLightFalloff = false;

Let me know if that helps. About roger could you try to export from the specular workflow in unity instead of metalic ? (I guess the conversion is not right for the metallic input, I ll take a look when I ll have more time).

CU,

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.