Search Unity

[WIP] Tool for converting UE4 materials to ShaderGraph

Discussion in 'Works In Progress - Archive' started by jolly_samurai, Nov 4, 2019.

Thread Status:
Not open for further replies.
  1. jolly_samurai

    jolly_samurai

    Joined:
    Jan 18, 2014
    Posts:
    7
    This is a tool to convert materials from UE4 to ShaderGraph.

    Why?

    The primary use case for this is to more easily access assets that you may have licenses for in UE4.

    What is supported?

    4th November 2019
    • Materials only (instances not yet supported)
    • Add
    • AppendVector
    • Clamp
    • Desaturation
    • LinearInterpolate
    • Multiply
    • ScalarParameter
    • Switch
    • TextureCoordinate
    • TextureSampleParameter
    • VectorParameter
    What this project is not...
    • An easy way to lift assets from UE4 where the license does not permit it.
    • Intended to produce 1:1 visual results. It isn't always possible because of different values and methods of calculation results. It will get you pretty close but parameter values and such might need tweaked as demo'd in the video below.
    Issues

    Currently the project makes heavy use of the internal building blocks of the ShaderGraph which are currently internal to the project. As such a fork of ShaderGraph is required to run the converter.

    Demo

    This particular video is converting a material from one of the free monthly asset packs, although the license doesn't allow for using it in a released Unity project it is merely for demo purposes. I prepared this before this video by exporting all textures.

     
    Last edited: Nov 27, 2019
    Auraion and Mark_01 like this.
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Welll that's one less reason to switch to ue4 lmao
     
    Mark_01 and jolly_samurai like this.
  3. jolly_samurai

    jolly_samurai

    Joined:
    Jan 18, 2014
    Posts:
    7
    Since my initial WIP submission I have been working on turning this from a proof-of-concept in to a product that can be released and supported as a semi-professional project.

    Since the last update
    • Time has been mainly invested in maturing the code. This hasn't increased the supported number of nodes but new features can be more easily added.
    • A simple user interface was added: https://imgur.com/U1kWy4i
    • Meaningful feedback during the conversion process: https://imgur.com/dH3BVGd

    What's next?

    Short-term
    • Support for material instances to make the project useful in the real world.
    • Support for more nodes.

    Long-term
    • Support for "package profiles". The goal of this would be to apply sane scaling values to material parameters used in popular UE4 marketplace products to reduce the need for tweaking after converting.
     
    Last edited: Nov 27, 2019
    Auraion likes this.
  4. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,759
    Seeing this is turning my stomach..its like your here developing to draw people away from Unity, you should be posting this in UE forums, not here. This post should be locked/closed/deleted, as this is a support for UE, not Unity. Not to say that your work isnt good. Is there a forum mod that can take care of this?
     
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    In defense of OP tool, I wouldn't agree.
    In the end, OP is developing tool to bring asset from UE to Unity, not other way round.
    I don't think is anything wrong about it. Personally I wouldn't be using such conversion work flow, but I think there is space for such tools, as long user don't infringe any licences along the way.
     
    Auraion and Hattoriseed like this.
  6. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,759
    This has always been a touchy subject, why would we want UE assets brought over to unity?, we have enough of our own, and some great unity community members that create good assets. Next thing will be a unity to UE asset converter, and as you stated Licence considerations.

    "An easy way to lift assets from UE4 where the license does not permit it"

    How far do we let this go?
     
  7. jolly_samurai

    jolly_samurai

    Joined:
    Jan 18, 2014
    Posts:
    7
    This is clearly not the intention of the tool. This is allowing people, like myself, to more easily bring assets with them when they migrate to Unity. Unreal licensing permits this, it's just the act of converting the assets is laborious.

    You will always have a number of people violating licenses, it's pointless trying to stop it. But let's not use that as a reason not to help people migrate their legally licensed content.

    In the end, having access to an even wider range of assets for your project is a good thing.

    Well....why not? If someone wants to take assets to UE4 from Unity then what is a good reason for not having conversion tools?
     
    warthos3399 and Antypodish like this.
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    People buy models, textures, music all the time, from external sources and use whenever they need to.
    Is just that itself does not require additional tools to import, other than game engine.
    If not for the fact, that Unity and Unreal Engines using different languages as a base, I am sure git repositories would be sharing codes long time ago, on large scale. In fact, partially we do that already, by sharing algorithms.
    We rely on sharing resources.

    And indeed, there is no need for delaying, or trying to stop some advancements. Somebody will do anyway, even in less official way, if that what it will take. So why to hurt ourselfs?
     
    warthos3399 likes this.
  9. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,759
    Some good points...
     
  10. MatthewScott

    MatthewScott

    Joined:
    Aug 25, 2008
    Posts:
    40
    Hi there,

    I was just about to start something similar. Do you have any interest in share the project to get help on development?
    Feel free to PM.

    Thanks,
    Matt
     
  11. jolly_samurai

    jolly_samurai

    Joined:
    Jan 18, 2014
    Posts:
    7
    Hi Matt, I haven't been able to spend much time on this recently. Let me double check there isn't anything sensitive and throw a license on the source code and I'll open up the repo's.
     
  12. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    Any update on this?
     
  13. Nakda

    Nakda

    Joined:
    Sep 27, 2015
    Posts:
    4
    I don't know if you had time to clean the repo, but I wanted to let you know I'm also interested in contributing.
     
  14. jolly_samurai

    jolly_samurai

    Joined:
    Jan 18, 2014
    Posts:
    7
    Apologies guys. I finally found time to cleanup and push.

    https://github.com/iainmckay/com.jollysamurai.unrealengine4-import

    This is the Unity package. As was mentioned in one of my initial posts this relies on a customized version of the SRP which makes all the nodes public. Mine is incredibly out of date but I plan on picking up this project again so I expect I'll fork and make my version available.

    The version I pushed includes some more features since my last update:
    • Various fixups
    • EmissiveColor
    • MaterialInstances
    • EditorComments
    The Unity package contains a compiled version of another project I wrote, a generalized parser for T3D files:

    https://github.com/iainmckay/unrealengine4-t3d

    I'll add a proper README in the near future. The basic instructions are as follows:
    1. Install the Unity package.
    2. Clone SRP and make all the nodes and supporting types public (You can play whack-a-mole with the Unity console).
    3. Export the Unreal materials you are interested in to T3D. You can bulk export directories in the UE4 editor, or just export a single file.
    4. Bulk export the textures for the materials you are going to convert. You can easily do this by applying a Texture filter to the content browser in the UE4 editor then select all the textures and bulk export to the asset folder of your project.
     
    TanselAltinel likes this.
  15. jolly_samurai

    jolly_samurai

    Joined:
    Jan 18, 2014
    Posts:
    7
    I have uploaded an example project which has all the required dependencies. It is currently based on Unity 2020.1 and ShaderGraph 8. It could probably be used to convert assets then copy them to your project so you don't have to rely on my customized version of the ShaderGraph.

    https://github.com/iainmckay/unity-unreal-converter-example
     
    Hattoriseed likes this.
  16. jolly_samurai

    jolly_samurai

    Joined:
    Jan 18, 2014
    Posts:
    7
    Small update. Starting working on a simple map converter.

    Unity (unlit)



    Unreal (unlit)

     
    Last edited: Aug 15, 2020
  17. MatthewScott

    MatthewScott

    Joined:
    Aug 25, 2008
    Posts:
    40
    Just getting caught back up on this project. Looks great! Thanks for organizing the repos. I'll check everything out now.
     
  18. MikeTrusky

    MikeTrusky

    Joined:
    Apr 3, 2018
    Posts:
    4
    Hi jolly_samurai. I cloned an example project from your github, because it looks really good and I want to check it out. But when I open this project in Unity, choose a T3D file, which I exported from UE4 and choose a path in "Destination", I get "Input string was not in a correct format.". The same when I use "Convert a folder" option. What can I do wrong or what should I do to make it work? I use Unity 2020.1.0b14 to open it.
     
    ma21007 likes this.
Thread Status:
Not open for further replies.