Converting PBR assets to UDK?

I’ve been working for a while with a UDK project and I’m currently in the process of converting a few of my old programmer props into real assets. Unfortunately, UDK next-gen materials are no longer in fashion and not many asset sellers provide standard diffuse + normal + specular maps for their models. Does anyone know of a programmatic way of converting PBR materials into UDK ones?

I’ve been studying a little bit and attemped to merge the AO map into the albedo in order to get a diffuse. It works well, but still some maps end up looking really bland. As for the specular, I have mixed results: sometimes just using the metallic map works, other times I have to apply more/less contrast. And in both scenarios, I feel like just hacking this away. So, anyone knows any tool or maybe a formula to convert PBR into DiffSpecNorm?

There’s nothing magical about PBR. It just has a fancy name. UE3/UDK most definitely can display PBR.

Albedo into diffuse. You can multiply AO by albedo before putting it into diffuse if you want. Try it out. Use some scalar parameters to strengthen/weaken AO and see how it looks.

Metallic into specular. Roughness into specular power. You can multiply them by some scalar parameter values to get it to look right.

Also, you need to use a Fresnel on the normal to increase the specular. The more a surface is perpendicular to your view, the less it reflects. The closer it is to parallel to your view, the more it reflects. You might also want to desaturate a little when the normal is parallel to the camera, but I don’t know that this is entirely necessary.

And then plug the normal into normal. It should be good to go.

PBR needs some more shader math but its possible. There is nothing magicam about PBR but there is “correctness” into it, so just plugging PBR textures into a non-PBR shader will yield wrong results. It wont be tragic but it will still be far from the result you’d see in ue4.

For my game Elium I made something close to PBR with the staple schlick+fresnel shading model and shiny/rough reflections. It doesnt look as good as ue4 but I was able to use PBR textures and especially for metallic things it was much better than the old non-PBR result.

The part that clearly doesnt work is getting local reflections (ue4 used reflection probes + SSR), but for my game I had the same colors everywhere so I got away with using one single ‘generic’ cubemap for reflection.

The rest can be assembled with material nodes but you’d need to research how to make the schlick shading model into CustomLighting. Or you could go even more basic and use phong.

The reflection needs to force a different mipmap depending on the roughness. i.e. 0 roughness = sharp reflection so mip 0, roughneds 1 = blurry reflection si mip 5 or 6 (depends on your cubemap texture size). To force a mip you need a custom hlsl node.
​​​​​​
To blend the reflection: Metallic works by muitplying the reflection with the diffuse, while non metallic works by adding the reflection with the diffuse. For non-metals the specular is the amount that the reflection is added to the diffuse, and for non metals specular has no use. For non-metals the reflection should be dimmed with a fresnel, but not for metals (or only subtly).

That covers the reflection. In the real world that would be it, but in games a speculsr highlight is still added on top (because we’re still not 100% there when it comes to reflecting light in a locally-precise way). So you’ll need to map the metal/spec/roughness into something that makes sense to output as specular and specpower (if you use the schlick shading model its easy, but implementing it is much harder)

About AO - yes it can be multiplied with diffuse to make things pop but that’s also not correct (AO is supposed to appear only on indirect lighting, but with this multiply the AO also appears under direct light)

Oh, but I’m not interested in changing my shaders/rendering in UDK to support PBR. I’m fine with the current setup, I just want to convert PBR materials to the old format so everything looks the same, and has the same maps.

As for fresnel in normal, what do you mean by that?

Are you familiar with the materials editor and what everything does? Try this out just to see how it works:

Make a new material, and drag your normal map into it. Make a Fresnel node and connect your normal map to the Fresnel. Then take the output of the Fresnel node and connect it to the emissive of the material. See what it does? It’s calculating how parallel the surface is to your point of view, and then giving that a value, which is now displayed as emissive brightness.

When building a PBR setup in UDK, you need to use that Fresnel on your normal map to increase your material’s specular. I honestly don’t know the correct formula. (Maybe Chosker does.) But looking at Chosker’s post above, I would guess that the basic way to do it would be to use the metallic map as the alpha in a linear interpolation that you plug into specular, so you have a lerp node that chooses between how to handle specular of a metallic surface and how to handle specular of a non-metallic surface. I would plug a scalar parameter in for the metallic specular input of the lerp, and then as Chosker says above, I would multiply Fresnel by another scalar parameter and plug that into the non-metallic specular input of the lerp. Then I’d make a material instance from the material and play with the parameters until it looks right.

I’m sure there’s a more correct way to do it, but I think that would get you the basic idea.

As others said, if you want just to convert the textures, than you should just take your time.As said as a example, for albedo to become diffuse, you overlay the ambient occlusion map on the albedo one.Also there are programs like bitmap2material that can auto generate textures for you from the existing final difuse or albedo.

Here is a ‘‘messy’’ rar of a few udk pbr ‘‘representation’’ shaders if you want to continue with the original textures.Each folder includes a internet link from where the file came, so that you can investigate its use further.

http://www.filedropper.com/pbrrepresentation

Also, this can help you too:

Is there any way in custom lighting to tell the difference between indirect and direct lighting?

Actually speaking of jjios kismet tutorial demo I’m interested to set up camera perspective view from top-down shooter to third person shooter. As for now on.

no, not properly.
I can’t remember how the dynamic skylight reacts to custom lighting, but you might be able to hack around it and “know” if it’s a skylight vs any other light by what the LightVector produces.
but even then, the shadow pass happens later and there’s no way to get it in your shader so the shadows would destroy that result - pixels that are in shadow from a direct light would act as if hit by that light, so you’d have shadowed pixels without any AO

IIRC this is a limitation even in UE4’s forward renderer, so just as in UE3 the SSAO affects directly-lit, shadowed and ambient-lit pixels (whereas in the deferred renderer the SSAO only affects shadowed and ambient-lit pixels)

I’m so happy and excited that people like us are still interested in udk/ue3.

actually I’m not using UDK anymore :smiley:
I stopped using it entirely about 3 months ago after the last patch for my game.

Thank you all for the awesome insights and attention to this issue.