Home Unity

3ds max shader to unity pbr shader mobile

polycounter lvl 7
Offline / Send Message
zwow polycounter lvl 7
what is the work flow for this? how can i do it with minimum effort or without redoing shader in unity for mobile

Replies

  • Eric Chadwick
    Unity Standard shader apparently is supposed to be very efficient, it disables unused attributes automatically. They talk about this on the Unity blog.

    The trick with mobile though is usually fillrate. They recommend to use their Mobile shaders.

    I bet PBR is too expensive for mobile GPUs. Test it out and see!

    Some great info in the Unity manual... https://docs.unity3d.com/Manual/MobileOptimisation.html

    If you want to make an equivalent shader in 3ds Max for previewing while you work, check out Shader FX. You will have to recreate your Unity shader, there's no direct import. But it's pretty easy to use.
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    We've used Shaderforge PBR successfully on several mobile projects now. That said, definitely not with deferred rendering, very very low number of lights etc etc. Obviously trying to keep the shaders simple and atlassing stuff heavily and so forth. Oh and they weren't traditional games (mostly VR "experiences"), so less game logic and that kind of stuff for the phone to handle.
  • zwow
    Offline / Send Message
    zwow polycounter lvl 7
    im doing for mobile VR too is Shaderforge  good?
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    I've done nearly exclusively VR stuff on mobile over the last year, and I use Shaderforge for basically all shaders I build.

    The general optimization limitations above apply, and there are a few settings in SF itself you should probably toggle: Forward Rendering, "Single Directional" Light count if possible, disable "per-pixel light probe sampling", disable "per-pixel screen coordinates", possibly even switch "Normal Quality" to "Interpolated". There're also SF nodes that are heavy to calculate, I'm sure Eric is more knowledgeable than me in that area (somebody compiling a fully researched list would be all kinds of awesome). Noise is heavy, the Blend node, various sin/tan, Power, and so on. Some nodes I have no way of estimating, though.

    Other than that, watch your Alphas obviously, pack textures, etc. I also force SF into SM 2.0 mode, but more for compatability reasons.

  • RyanB
    Shaderforge is a great prototyping tool but I had to learn how to manually optimize to get better performance.  You can often get huge performance increases if you invest the time.
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    If you had any hints or tips, I'd be all kinds of grateful. Not had too many performance problems yet, but basically all we've targetted have been S6's or S7's, nothing further downstream.
  • RyanB
    cptSwing said:
    If you had any hints or tips, I'd be all kinds of grateful. Not had too many performance problems yet, but basically all we've targetted have been S6's or S7's, nothing further downstream.
    Post it and let us hammer on it.  Might be fun to see how far a group effort could optimize it.  
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    RyanB said:
    cptSwing said:
    If you had any hints or tips, I'd be all kinds of grateful. Not had too many performance problems yet, but basically all we've targetted have been S6's or S7's, nothing further downstream.
    Post it and let us hammer on it.  Might be fun to see how far a group effort could optimize it.  
    Well, nothing I have right now, though the last project is yet to go through perfomance testing - might take you up on the offer then. I was inquiring in more general terms, really. 'Tis a shame there isn't much development ongoing in Shaderforge, mobile performance is likely one of the areas where it could improve.
  • Xenobond
    Offline / Send Message
    Xenobond polycounter lvl 18
    @cptSwing, better knobs and options to optimize for mobile are really lacking in Shaderforge. A second pass on the shader code itself is usually common to do some cleanup work. I usually make a copy of the shader in the same directory with a '.' at the beginning so Unity doesn't see it. Then I go through and switch down most of the existing floats to half or fixed. There are also some lines that are usually easy to condense/remove.

    That being said, always check the compiled code to see the stats on the shader. For mobile vr, a shader that has 57 math calculations and 5 texture reads might not be desirable on a very large object in your scene.
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    Xenobond said:
    @cptSwing, better knobs and options to optimize for mobile are really lacking in Shaderforge. A second pass on the shader code itself is usually common to do some cleanup work. I usually make a copy of the shader in the same directory with a '.' at the beginning so Unity doesn't see it. Then I go through and switch down most of the existing floats to half or fixed. There are also some lines that are usually easy to condense/remove.

    That being said, always check the compiled code to see the stats on the shader. For mobile vr, a shader that has 57 math calculations and 5 texture reads might not be desirable on a very large object in your scene.
    Aye, much agreed. Especially since I'd assume that the Unity platform still leans more towards mobile development than other engines. As for changing float to fixed, that is actually possible in Shaderforge itself, you need to unhide their display in the settings. Not being too SL-savvy, I can't really walk through the shadercode SF generates though, I wouldn't really know what to delete ;-)
  • Xenobond
    Offline / Send Message
    Xenobond polycounter lvl 18
    SF doesn't expose precision options for all of it's nodes, so I always go back in and drop them down unless it causes visual anomalies. Haven't run into any problems with it on OpenGLES 3.0+, but got some interesting bugs on some 2.0 devices.
  • Monteiro
    Offline / Send Message
    Monteiro polycounter lvl 7
    I'm doing some vr myself, and i've found some of the same issues, the material composition on shader forge for iOS and its limitations, like, what can i use, and what will be rendered, you guys have been of great help.

    now, i'm having some trouble with my ilumination, in the stand alone version i used more complex ilumination and light probes, reflex probes etc. Mobile builds are new to me, and some of my compiled shaders show black when i try to visualize them now.

    what are the limitations on the ilumination i have when using these settings?
Sign In or Register to comment.