Search Unity

► DirectX 11 Low Poly Shader ◄

Discussion in 'Works In Progress - Archive' started by Arkhivrag, May 24, 2016.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Wireframe effect is enabled per-shader. All meshes using that shader will be effected.
    You can just reduce wireframe color A value and it will become completely invisible.
    Or copy shader file (rename file and shader name inside file) and enable wireframe effect on it.


    There is no such control as 'size of low poly'. Mesh completely becomes faceted.



    VacuumShaders - Facebook Twitter YouTube
     
  2. Mihai77

    Mihai77

    Joined:
    Aug 7, 2013
    Posts:
    8
    Hi,

    Can you please add Emission map (texture,color and intensity)?

    Thanks you in advance.
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Added to a wishlist.



    VacuumShaders - Facebook Twitter YouTube
     
  4. LoryColo

    LoryColo

    Joined:
    Jun 21, 2017
    Posts:
    2
    Hi, i have a procedurally generated terrain made of different planes and the i aplly some textures on it based on the Y value, will this shader make the terrain low poly? can i apply this via script at runtime?
     
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    This shader will not reduce triangle count, if it is what you are asking. Shader will just render mesh in lowpoly style.



    VacuumShaders - Facebook Twitter YouTube
     
  6. Starkium

    Starkium

    Joined:
    Oct 13, 2017
    Posts:
    2
    Is there any chance you could ever get this on unreal engine? Or maybe walk an unreal dev like myself through the process?
     
  7. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    663
    I'm sure there already is a DX11 shader like that for Unreal. It's not a Unity feature but a custom shader he did.
     
  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Headache I have with Unity is enough, thanks.



    VacuumShaders - Facebook Twitter YouTube
     
    theANMATOR2b likes this.
  9. Winseral

    Winseral

    Joined:
    Jul 9, 2017
    Posts:
    11
    Hi,

    What is the process of adding the Shader to terrain, is their documentation I can read about the Low Poly shader.

    I have enjoyed this Asset, and have been having fun changing my models to low poly, but need to get my terrain and skybox to show in low poly?

    Thanks
     
  10. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Or you can just use Unity?! :)
     
  11. Ruben_Chris

    Ruben_Chris

    Joined:
    Mar 10, 2013
    Posts:
    94
    Look at this quote here:
    I'm not sure if you can apply the shader to skyboxes though. Note:If the colour of the terrain is wrong after adding the terrain material you need to save the scene and the colours should be applied correctly.
     
  12. Ruben_Chris

    Ruben_Chris

    Joined:
    Mar 10, 2013
    Posts:
    94
    @Arkhivrag I would just like to say that it would be nice if you added support for multi-tile terrains (multiple terrains that is used to represent one). You can clearly see the difference between the terrain edges. I would personally pay twice the price just to get that :) Great asset by the way, it improved the performance of my game substantially.
     
  13. Coltenney

    Coltenney

    Joined:
    Mar 10, 2015
    Posts:
    25
    Potential buyer here, would this work with the voxel terrain engine, Voxeland?
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    If custom shaders can be used within Voxeland then YES.



    VacuumShaders - Facebook Twitter YouTube
     
  15. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    I'm using the Low Poly Mesh Generator and am liking it, curious if I should switch over to this. Looks to be a lot more efficient. I don't understand how you're getting the memory usage so low, are textures/materials dumped out of memory after they're sampled?

    Your link to the Geometry Shaders test is broken. I'm assuming this should work on most popular platforms and consoles?
     
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    You can switch to DirectX 11 Low Poly shader if your project is for devices with GeometryShader support.
    Link fixed.



    VacuumShaders - Facebook Twitter YouTube
     
  17. jmargaris2

    jmargaris2

    Joined:
    Mar 20, 2015
    Posts:
    34
    Hi Arkhivrag,

    I think I have a pretty good idea of how this works but you probably don't want to get into super technical detail about it. I do have two questions though:

    1. How does this compare to using DDX/DDY to compute a flat normal, in terms of performance and quality?
    2. Any plans to support the full range of options / shader math in the Unity standard shader?

    The issue with Geometry shaders in general is that since they don't support surface shaders making them use the same lighting math as the Standard shader is fairly difficult.

    In theory it's possible for a vertex/pixel shader to still call UNITY_BRDF_PBS with the right params, do shadow coord stuff, etc, and come out looking the same as the standard shader. Any plans to support this?
     
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    You can not achieve same quality with DDX/DDY to compute a flat normal. Geometry shader pass is necessary to re-create new normals and calculate per-vertex color (+ new tangent, shadow coords etc.)
    Shaders use the same lighting math as Standard shader.



    VacuumShaders - Facebook Twitter YouTube
     
  19. AtomsInTheVoid

    AtomsInTheVoid

    Joined:
    Jul 27, 2015
    Posts:
    251
    Hey there!

    So are you saying that if I save my FBX as "smooth" shading in blender, it will turn it to flat shading in Unity?!

    I can't get the image to display here but here's a link to what i mean:
    https://imgur.com/a/KKQVT

    This is the EXACT same tree, with Flat vs Smooth shading. Would your shader make my smooth tree look exactly like the flat tree, but with the smooth tree's vert count?!
     
  20. AtomsInTheVoid

    AtomsInTheVoid

    Joined:
    Jul 27, 2015
    Posts:
    251
    Darn was hoping for a reply by now, really wanna try it out!
     
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Yes!



    VacuumShaders - Facebook Twitter YouTube
     
  22. AtomsInTheVoid

    AtomsInTheVoid

    Joined:
    Jul 27, 2015
    Posts:
    251

    Ok, wow.. so that should save me about a million verts. Amazing.

    I think it's so ironic that Low Poly is High Vert
     
  23. thestrandedmoose

    thestrandedmoose

    Joined:
    Jul 21, 2015
    Posts:
    70
    Really cool product- loving it so far. I have a question though: Is there any way to "bake"/export the texture/material as a standard material/shader once you have a look you like?

    I am getting some errors when I try to export a WebGL build like:

    "Error building Player: Shader error in 'Hidden/VacuumShaders/DirectX 11 Low Poly/ZWrite': '[' : syntax error syntax error at Shader/Shaders/cginc/Geometry.cginc(33) (on gles)"

    If theres a way I can export the lowpoly into a standard material? I think it would be a lot easier on processing power and won't cause errors when I try to make a build
     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    WebGL currently does not support GeometryShaders.



    VacuumShaders - Facebook Twitter YouTube
     
  25. thestrandedmoose

    thestrandedmoose

    Joined:
    Jul 21, 2015
    Posts:
    70
    Ah ok that's why.
    I was attempting to do a webGL build and it seems to have broken the entire shader... Guess I will have to reserve the lowpoly version for only desktop and mobile!

    Do you know if theres any way to "bake" the texture/material out to a standard or built in unity shader like Toon? I love the look of your shaders but I'd really like to make my builds have a little dependency on 3rd party plugins as possible. Your shader seems pretty complicated so I know it's a longshot, but just wondering!
     
  26. Bionicle_fanatic

    Bionicle_fanatic

    Joined:
    Jun 8, 2013
    Posts:
    368
    I'm interested in buying this asset for a single reason; That being, that Unity's built in Cloth component doesn't allow flat shading for its meshes. Would This shader be a way around that, or do cloths still shade smooth with it on?
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    There is no way to 'bake', but you are free to modify shaders.


    Cloth component needs SkinnedMeshRenderer and this shader can be used with it.



    VacuumShaders - Facebook Twitter YouTube
     
  28. EgoJacky

    EgoJacky

    Joined:
    Aug 15, 2017
    Posts:
    28
    I just discovered this vertex count problem in my current project and your shader would be the perfect solution. Is this Shader still available for Unity 5.6.1? If Yes, where can I find it?
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Will definitely work with Unity 5.6.4



    VacuumShaders - Facebook Twitter YouTube
     
  30. uberwiggett

    uberwiggett

    Joined:
    Jun 26, 2015
    Posts:
    105
    so this shader would replace the ones in the mesh materialiser pack?
     
  31. alteredmatter

    alteredmatter

    Joined:
    Sep 14, 2016
    Posts:
    26
    Hi @Arkhivrag, we've been using these shaders on a game we're working on, and we were seeing much better vertex counts while keeping the flat look we're looking for, so it's been great!
    However, we are now testing these on the newer versions of Unity (2017.2.1p2)., and on consoles we're getting errors when trying to build the game (the build fails showing the same error for multiple shaders). Previously on 5.6.2p2 we didn't see these, we could build the game successfully.

    I'm adding more details on a DM.

    Do you know what could be causing these?

    Edit: OK, the fix was just adding an "else return 0;" statement in the function from the error. Thanks for the help!
     
    Last edited: Feb 14, 2018
    theANMATOR2b likes this.
  32. alteredmatter

    alteredmatter

    Joined:
    Sep 14, 2016
    Posts:
    26
    Hi @Arkhivrag, I just wanted to know if it would be possible to add Rim Light to these shaders, as it would be another nice extra feature to have. We also use your Subsurface Scattering Shader, and we have seen that those have the option on them. Having it implemented on the Low Poly ones would be good for us, since we sometimes use it to simulate extra colored 'reflections' on some environment meshes.

    Just to see if it was possible, I've tried to add it to the 'PBS_Opaque_Diffuse', adding the rim calculation into the Emission. I'm still new to shaders, and the DX11 Low Poly is more complex than what I'm used to, so I don't know if this could break other things or not.
    Code (CSharp):
    1. ...
    2. [VacuumShadersLabel] _RIMLIGHT_LABEL("Rim Light", float) = 0
    3. _RimColor ("Rim Color", color) = (1, 1, 1, 1)
    4. _RimPower ("Rim Power", Range(0.01, 10)) = 1
    5. _RimIntensity ("Rim Intensity", Range(0, 10)) = 1
    6. ...
    7.  
    8. // And this both on the Forward Base and Deferred passes (around lines 250 and 620):
    9.  
    10. fixed4 _RimColor;
    11. fixed _RimPower;
    12. fixed _RimIntensity;
    13.  
    14. //DirectX 11 Low Poly////////////////////////////////////////////////////////////
    15. // Rim
    16. fixed NdV = dot(IN.worldNormal, worldViewDir);
    17. fixed rim = _RimIntensity* pow(1.0 - saturate(NdV), _RimPower) * _RimColor.rgb;
    18. ...
    19. o.Emission = (...) + rim;
    20. //////////////////////////////////////////////////////////////////////////////////////////////////
    21.  
    The result:
    low_poly_rim_3a.PNG

    Is what I'm doing correct? Right now it appears to achieve the effect I was looking for for this specific shader.

    Also, would it be possible to achieve the faceted look for the rim light on all lighting modes? I've seen that the lighting can only be "low poly" on Forward and not on Deferred, but I don't know if it would be possible to add the RimLight before calculating the "lowpoly" color/emission (if I'm not mistaken, right now I'm adding the rim light after this calculation has been done).

    If this could be 'officially' added to the collection of shaders I think it would be great! :) (Another interesting idea that came to mind would be to also have transparent objects that still have a full rim light, in order to simulate crystals or force shields for example).

    Thanks!
     
    Last edited: Feb 14, 2018
    theANMATOR2b likes this.
  33. fonkler

    fonkler

    Joined:
    Jan 10, 2017
    Posts:
    9
    Tom, I am struggling with the same problem (adding the shader to water + animating the water with waves). Could you give me more details on how you achieved this?
    Thanks a lot!
     
  34. IDreamofIndie

    IDreamofIndie

    Joined:
    Dec 24, 2014
    Posts:
    38
    I am having trouble getting the shaders working. I cant get a successful build. Using Unity 2017.3.0f3. Is this version not yet supported?

    Errors for windows build: Shows the 3 Test Shaders (4.0, 4.6, 5.0) Green in Tester Scene WindowsBuildErrors.png

    Errors For Android Build: Device Shows the 3 Test Shaders (4.0, 4.6, 5.0) When Using The Test Shaders. AndroidBuildErrors.png

    Any help would be appreciated.
    Thanks
     
    Last edited: Mar 7, 2018
    KlausK likes this.
  35. KlausK

    KlausK

    Joined:
    Jul 12, 2017
    Posts:
    1
    Hi there,

    I have exactly the same problem with unity 2017.3.1p2, is there any solution for this?
    As we are trying to build our game here, any help would be much appreciated.

    Cheers,
    Simon
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Sorry, I was unsubscribed from this thread (do not know why) and did not receive notifications about activate here.
    Unity 2017.3 shader compilation bugs are fixed, just download new version from the Asset Store.



    VacuumShaders - Facebook Twitter YouTube
     
    Deadlyapples likes this.
  37. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    @Arkhivrag Could you add a triplanar shader ?

    It's for use in a voxel engine, on one single material I want to use a texture or color for X-Z oriented geometry and another texture or color for Y oriented geometry. For example, green for grass and grey for rock.

    And another less precise request : do you think you could do something to get procedural color gradients like in the game cubeworld ?
     
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Added to a wish-list.



    VacuumShaders - Facebook Twitter YouTube
     
  39. taylorjames9

    taylorjames9

    Joined:
    Nov 21, 2012
    Posts:
    4
    I'm building a scene for standalone MacOS X using this shader. It works just fine when I play the scene in Unity Editor, but when I build for mac, the shader doesn't work at all. Are there settings that I should check before building? Please let me know.
     
  40. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Do this test shaders work?



    VacuumShaders - Facebook Twitter YouTube
     
  41. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    Is this compatible with Unity 2018.1? Also would Voxel models made in MagicaVoxel work with this (see attached image)? Since I cannot find a suitable terrain to voxel converter (blocky like MineCraft but uses smaller cubes), I plan to just convert Voxel models to have that low poly faceted look instead so it would be consistent. But not sure how it would look. What would be more ideal to use, the DirectX 11 Low Poly Shader or your Low Poly Mesh Generator?

     
    Last edited: Jun 5, 2018
  42. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Low Poly Mesh Generator bakes texture directly into a mesh, has limit on mesh vertex count (max allowed is 21000), but works on any device with any shader supporting vertex color.
    DirectX 11 Low Poly Shader requres device with Geometry Shaders support (mostly not available on mobiles).



    VacuumShaders - Facebook Twitter YouTube
     
  43. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    It looks like DirectX 11 Low Poly Shader will work best for me. But the main thing still bugging me is whether the produced effect will be that noticeable for my type of blocky models. I am currently deciding whether to either use this tool for all my models and terrain to have a consistent low poly look -or- just stick with mixing blocky models with an ordinary terrain look if I cannot find a suitable tool. Have you tried using this with blocky type models? Do you have a sample screenshot of the result?

    Sorry for all the trouble but I have already been burned with buying another tool by a different developer which claimed to convert models and terrains to blocky style instead. But that didn't work and I now cannot seem to reach the developer anymore to get a refund. Thus I have to be a little careful now.
     
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Send me one of your blocky models with textures. I'll show you how it will look using DirectX 11 Low Poly Shader.



    VacuumShaders - Facebook Twitter YouTube
     
  45. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    Alright, sent the 617KB ZIP file to your Vacuumshaders Gmail address.

    Edit:
    By the way, sent you another ZIP file w/ a .DAE updated model for the boat that has some glass transparency, emission, and metallic shaders. Are these supported? Can you use this as test?
     
    Last edited: Jun 13, 2018
  46. windwolfx_23

    windwolfx_23

    Joined:
    Jan 15, 2015
    Posts:
    11
    @Arkhivrag hi, I love your shaders, but I want make it work with vertex animation, Houdini offered a couple of vertex animation shader(fluids, fragments, cloth), but I don't know how to combine them to your shader , I thought just need to put houdini vertex shader vert function before your vert function, but it didn't work, my shader scripting sucks... could you give me a hint about how to modify.
     

    Attached Files:

  47. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    Hi, will this work well within a 2d game (using sprites)? Thanks.
     
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    No.



    VacuumShaders - Facebook Twitter YouTube
     
  49. WelchCompositions

    WelchCompositions

    Joined:
    Sep 30, 2013
    Posts:
    29
    I want to apply this to a webcam texture to give the webcam feed a low poly effect. Is this supported? If not can I contract you to add that support?
     
  50. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    663
    @WelchCompositions My guess is no, as this is a shader attached to the mesh and makes the light hitting the 3D mesh look as it does. A webcam texture is just that, a 2D texture. There are no normals with light information.