Texture blending not exported from Blender

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Texture blending not exported from Blender

Postby VincentJonesVR » Sat Jan 16, 2021 1:06 pm

Hey there, I'm experimenting with porting ages around and I'm encountering an issue that I'm not quite sure how to fix.

When I import city.age into Blender, texture blending is working *mostly* properly. As seen in the first screenshot.
Image

But when I export it as an fbx and import into Unity, for example, this happens.
Image

Does anybody know how I can fix this?

EDIT: Actually, you can see as a whole that materials aren't being moved properly. Stretching and so on.

EDIT2: I saw that Sirus was working on a direct importer for Unity. Did you ever get that working with multilayer mats?
User avatar
VincentJonesVR
 
Posts: 3
Joined: Sat Jan 16, 2021 12:52 pm

Re: Texture blending not exported from Blender

Postby Sirius » Sat Jan 16, 2021 2:27 pm

As you can guess from the length of this post, you're walking a long and arduous path, friend :lol: Uru's engine (Plasma), Unity and Blender all have very different ways to handle textures.

In Unity, most people expect each model to just have a single "albedo" texture and that's it - it's also how the Unity FBX importer behaves. But that's not how Uru was made. Let's focus first on Uru and Blender, then we'll see how we translate everything to Unity...

Uru and Blender materials both work with a stack of different "layers" (each with its own texture), with lots of blending options. Each layer draws something new on top of the one under it. This gives the following possibilities:
  • smoothly blending between multiple textures (called "stenciling"). This is what you're seeing on the stalagmite in your first screenshot, with the two textures being brown and grey.
  • add overlays to existing textures (imagine adding a semitransparent crack texture on top of a stone texture)
  • use different UV layers for various textures (to combat stretching, to avoid grid-like patterns...)
  • blend between different textures according to distance to simulate the material being more detailed than it really is
  • add metallic reflections
  • and more combinations which are less often used.
Blender works using the same principle to some extend (which is why the stalagmite looks fine in Blender), but there are a lot of incompatibilities with how Uru does things. It's simply not possible to correctly mimick Uru materials in Blender.

The Age importer isn't completely stupid though, so it automatically detects materials that completely failed to import (other materials may not be completely accurate, but purple ones definitely aren't). This is why you're seeing purple and yellow materials:
  • Purple materials means some layer combination failed to import (or ZLZ didn't understand it)
  • Yellow materials means a layer has a rotation component, which means a UV channel needs to be rotated in order for its texture to show up correctly. The rotation amount is stored as a custom property at the end of the Texture panel in the Property Editor.
  • Cyan materials are a combination of purple and yellow materials.
  • Dark green materials means the material itself simply couldn't be found, and may be located in another PRP.
(This is taken from the importer's Wiki page, if you haven't read it yet)

How do you fix purple materials in Blender ? You have to use PrpShop (included with PlasmaShop) to inspect how the materials are setup, then guess what is the Blender equivalent. Due to the many options available in Uru, there is no guide to this. You'll have to learn through guesswork :?

But fixing stuff in Blender won't fix it for Unity, obviously.

Unity uses shaders - they are far more flexible, but still tricky to understand. You can set them up using either a graphical node editor (recommended), or write a program in a text file. Once again, you'll have to use PrpShop to figure out what the original material is supposed to look like, and try to recreate the material using Unity's shader editor.
On top of that, if you intend to do any lightmapping, you'll notice Unity uses the second and third UV layer for its lightmaps. This is going to cause even more issues.


Whew. Sorry if it's a lot to take in, I still feel like I barely scratched the surface :( It's that complex. You'll have to experiment by yourself. I suggest starting with a very small location like the Nexus instead - starting with the city will just overwhelm you. But feel free to ask more questions, and I'll try to answer them.


VincentJonesVR wrote:EDIT2: I saw that Sirus was working on a direct importer for Unity. Did you ever get that working with multilayer mats?

Yes and no. I cheated. Instead of generating shaders on the fly, I manually wrote text file shaders and pointed the importer to those for each materials.
I wanted to generate the shaders dynamically, but this is absurdly hard to do with Unity.
(That, and I ran into many more issues with the importer in general)

I also manually ported a bunch of Ages to Unity with better results, but gave up - it takes a long time, and I didn't want to bother for Ages that I couldn't release due to copyright issues anyway.
Show Spoiler
User avatar
Sirius
 
Posts: 1372
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Texture blending not exported from Blender

Postby VincentJonesVR » Sat Jan 16, 2021 3:45 pm

Ah man, that does sound like a massive pain.

The city proper isn't my first project. I've actually ported over a few now and worked around these issues largely with lighting choices and AI upscaling existing textures while making my own pbr maps for them.
Such as this entry way for the museum.
Image

There's just a few major areas where it's way harder to properly hide those flaws. Primarily the missing blending between stone textures in the city. As much time as I spend in Unity, I have absolutely no experience writing shaders to fix that up. And even if I did, I use Bakery for lightmapping and that plays best with its own versions of Standard.

EDIT: I *suppose* there's technically no reason I couldn't turn all of the stone structures into one mesh and pull that into substance painter to just repaint the blending.
User avatar
VincentJonesVR
 
Posts: 3
Joined: Sat Jan 16, 2021 12:52 pm

Re: Texture blending not exported from Blender

Postby Sirius » Sun Jan 17, 2021 6:02 am

VincentJonesVR wrote:As much time as I spend in Unity, I have absolutely no experience writing shaders to fix that up. [...] I *suppose* there's technically no reason I couldn't turn all of the stone structures into one mesh and pull that into substance painter to just repaint the blending.

The shader editor in recent versions of Unity is fairly simple to use and doesn't require coding. But if it's not compatible with Bakery, then substance painter is probably your best bet - this way you also don't have to worry about extra UV layers, since you can paint everything into a single texture.
User avatar
Sirius
 
Posts: 1372
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Texture blending not exported from Blender

Postby VincentJonesVR » Sun Jan 17, 2021 4:01 pm

Sirius wrote:
VincentJonesVR wrote:As much time as I spend in Unity, I have absolutely no experience writing shaders to fix that up. [...] I *suppose* there's technically no reason I couldn't turn all of the stone structures into one mesh and pull that into substance painter to just repaint the blending.

The shader editor in recent versions of Unity is fairly simple to use and doesn't require coding. But if it's not compatible with Bakery, then substance painter is probably your best bet - this way you also don't have to worry about extra UV layers, since you can paint everything into a single texture.


Unfortunately, recent versions of Unity are out of the question right now. I primarily use Unity when developing content for VRChat, so I've got to stay on 2018.4.20f for compatibility. I'll give substance a try soon and see if I can recreate the blend that way. I appreciate the help, though!
User avatar
VincentJonesVR
 
Posts: 3
Joined: Sat Jan 16, 2021 12:52 pm


Return to Building

Who is online

Users browsing this forum: No registered users and 3 guests