Search Unity

Importing custom shaders from Maya

Discussion in 'Asset Importing & Exporting' started by cluedo11, May 17, 2017.

  1. cluedo11

    cluedo11

    Joined:
    May 17, 2017
    Posts:
    1
    Hi,
    I'm using alembic import to transfer geometries from Maya to Unity.
    Unfortunately, I'm using custom shaders in Maya, not the built-in ones and I'm looking for a way to import these shaders from Maya. I know that there is no built-in ways in Unity the import custom (or any kind of) shaders from Maya so I'm wondering what would be the perfect and most painless way of doing this.
    I thought that I should write the shader in Unity and maybe create a custom importer that sets the perfect values of this shader for the geometry.
    Is there any chance that I can create this kind of importer? Where should I start Unity scripting?

    Thanks,
    Ferenc
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    You could do a custom export script that writes all the necessary data about the materials / shader into a extra file , then you can use the asset postprocess inside of unity to read this extra data file and do whatever you need to do based on the files data.
    And you would need a script that converts your custome shader to a normal shader just before export so that unity can assign the materials to the corresponding meshes .
     
  3. SSSODITTY

    SSSODITTY

    Joined:
    Jun 5, 2017
    Posts:
    1
    Just rewrite the shader in CG.
    Looks like fffMalzbier doesn't know about shaders and can write magical scripts that do anything.
     
  4. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Even if you rewrite the exact same shader that you use inside of Maya inside of unity, the unity import process does not recognise it and will not use it.
    You you know a option for exporting Maya shader to CG let me know i would like to use it.