Multiple shaders in one object (same faces)

Multiple shaders in one object (same faces)

trs_andre
Collaborator Collaborator
3,900 Views
4 Replies
Message 1 of 5

Multiple shaders in one object (same faces)

trs_andre
Collaborator
Collaborator

Hi everyone,

 

I'm currently in the middle of some experiencing with Unity and Maya, and I'm trying to make Unity shaders look the same way (or as close as possible) in Maya.

 

The problem is, I started with a coded shader in Unity which has multiple (3) passes.

My first approach was to create this same shader in Unity's Shaderforge so I could obtain the same result in nodes, and then create a similar shader in Maya's ShaderFX (the nodes don't differ too much, so it is not very difficult).

 

The difficult part is that, from what I read, in Unity's Shaderforge it is not possible to make a shader handle multiple passes (it's only possible by coding). So what I wanted to know is if it is possible to do it in Maya's ShaderFX.

 

The ultimate goal would be to develop a tool that would convert Unity shaders to Maya shaders, to be used in real time development (modeling, etc.).

 

Looking forward to your answers and thank you in advance for any help!

André Moreira

Game Developer / Technical Artist

LinkedIn

0 Likes
3,901 Views
4 Replies
Replies (4)
Message 2 of 5

sean.heasley
Alumni
Alumni

Hi @trs_andre

 

It's not possible to assign multiple different shaders to one face in Maya.

 

However, if you have one texture file that has multiple textures in it (like an atlas) you can stretch the UVs so it appears to have multiple textures on one face like in this video:

[video]

 

 

I'm just checking in again to see if you need more help with this. Did the suggestion I provided yesterday work for you?

If so, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

 

 

0 Likes
Message 3 of 5

trs_andre
Collaborator
Collaborator

Hi @sean.heasley,

 

Thank you so much for your reply!

I see... so it's not possible in Maya as well 😕

Your example looks good but I think it's more useful when applying different materials to different faces of the same object. What I'm trying to accomplish is having multiple materials overlapping on the same face (in my case, the entire object), but I guess that is not possible (at least without scripting).

 

I only thought of this method because it is possible in Unity through script to have a shader with multiple passes. However, as this is not possible in a node based shader, I thought overlapping each pass as a single shader would do the trick, but it seems it's not as simple as it sounds.

 

I did make some research on Maya's shader scripting as well, and I found that CgFX and I think dx11 shaders accept code files, and with multiple passes, from some examples I found. Would there be some way to convert the Unity shader code to Maya's CgFX shader code?

 

By the way, the three shaders I'm using in Unity are:

 

- One with a texture file, back culling, opaque blending

- One with a simple color, front culling, opaque blending

- One with color and reflections, back culling, additive blending

 

The last one with additive blending, I could not reproduce in Maya. I have no idea how to do it (is it possible?)

 

I'm sorry for the long and difficult post.

I hope there is some kind of way to do it!

Thank you in advance for your help!

André Moreira

Game Developer / Technical Artist

LinkedIn

0 Likes
Message 4 of 5

sean.heasley
Alumni
Alumni

Hi @trs_andre

 

Converting the code would also take some advanced coding knowledge and/or a 3rd party application.

 

And to clarify there isn't a simple way to convert those shaders to work in Maya. I understand it can be frustrating jumping back and forth from Unity to Maya but if you're working on shaders/textures it's generally best to be 100% done with the modeling that way you can stay in your engine or texturing program and just work on the shader.

 

 

0 Likes
Message 5 of 5

trs_andre
Collaborator
Collaborator

Hi @sean.heasley,

 

Thank you once again for your reply!

 

I see 😕

It would be cool to have a feature like this in the future!

The FBX Exporter for Unity brings some new things in this field, but going a step further would be great!

For the time being, I will have to find another way around this.

 

 

Thank you once again for your support!

André Moreira

Game Developer / Technical Artist

LinkedIn