Search Unity

Advanced Surface Shaders - RELEASED

Discussion in 'Assets and Asset Store' started by MattCarr, Jul 23, 2011.

  1. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Sure. It wouldn't work with Unity's terrain system, but you could get the exact same effect as what they're doing in those videos. You'd have a terrain mesh with vertices displaced by a heightmap and then give it a tessellation shader with a higher resolution heightmap for the displacement mapping. If you're using Unity's terrain then it would not work out of the box, but integrating it with another terrain system or simply a terrain mesh should be fine. You might have a bit of a hard time handling collision with dynamic GPU deformation on that scale though.

    You can create shaders that combine tessellation with normal maps in this package.
     
  2. snow404

    snow404

    Joined:
    Dec 1, 2012
    Posts:
    11
    Very very nice ! Thank you very much for your answers ! Can't wait to have some time to buy and try it out. I do not need collisions for now so your shader pack seems to be a very nice solution! Thanks again !
     
  3. bigzer

    bigzer

    Joined:
    May 31, 2011
    Posts:
    160
    Was going to say the same so I absolutely agree with that one. For bigger projects it reduce even further needs to make shaders manually.
    Take my 10 votes on that one ^^

    I highly recommend this package to anybody who hesitate.

    Regards
     
  4. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Thanks.

    I'm definitely thinking about this approach and how best to accomplish it without making the code too difficult to maintain and without impacting performance. It should be possible, but I think I'll need to recreate the generator tool to more intuitively accommodate the extra functionality. I might try to get this done for the next build and include some of the other advanced features I was planning for mobile shaders. I'll make sure it remains easy to use for those that don't need these extras and I'll separate this advanced stuff into an optional section.
     
  5. rosevelt

    rosevelt

    Joined:
    Oct 23, 2012
    Posts:
    47
    Hello Matt,

    I mostly use defered rendering.
    What kind of shader can I expect to be fully supported for defered rendering?

    Thanks
     
  6. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Everything will work with deferred rendering. Some of the unique shaders, primarily the skin shading, will render with forward rendering whether in deferred rendering mode or not in the current version (due to the lighting function needing light direction vector which is not available in deferred rendering). There is an approximation effect I can do to achieve similar shading results in deferred rendering for the skin shader and I'll include alternative skin shader versions in an upcoming update that use deferred rendering.
     
  7. rosevelt

    rosevelt

    Joined:
    Oct 23, 2012
    Posts:
    47
    Thanks.
     
  8. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Maybe I'm pushing my luck, but could we have tessellation in the skin shader?
     
  9. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Possibly. At the moment I'm not sure how to use a vertex shader in the way the Unity's tessellation system expects and also as I'd need to for what's required in the skin shader. One way or another it will be possible. I'll look into it.
     
  10. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Ok, cool... I am still having a blast with the skin shader, these realistic results have never come so easy...
     
  11. snow404

    snow404

    Joined:
    Dec 1, 2012
    Posts:
    11
  12. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Good morning, Matt... I am still using the skin shader and I am noticing some artifacts when I am using an intense light source such as a flame (I am also in Deferred Rendering and Linear colour space) and these artifacts are hare to get rid of... do you know when you will be able to allow the skin shaders to work in Deferred Rendering? Thanks man...

    SIDENOTE: The Skin Shader will artifact if you have some of your settings put too high...
     
  13. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Should be the next update. I've been getting a lot more work for this time of year than I expected so I haven't been able to roll out the new build yet, but it should be ready for release soon.
     
  14. mph

    mph

    Joined:
    Mar 19, 2009
    Posts:
    2
    Hi - I purchased this shader pack back in Aug 2012.

    When I tried to import them into a new project today, Unity crashes on startup.

    I'm currently running Unity 3.5.2f2.

    Do I have to upgrade to Unity 4 to use these shaders?
     
  15. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    No, but there seems to be an issue with Unity 3 importing certain types of assets from Unity 4. It looks like Material files are the culprit. If you don't import the "ExampleData" directory in the package or only import the non-Material (.mat) files from that directory then it should go into Unity 3.5 without issue. If you've got the package imported already then just delete the ExampleData directory or the Material files and it should load properly.

    Thanks for bringing this to my attention. I'm guessing this would be considered a Unity bug because I doubt they intended that sort of failure on import assets, but maybe it works in 3.5.7.
     
  16. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    Quick question: can I use these shaders to achieve DX11 tessellated terrains, based on the detail textures?
     
  17. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    hi,

    Nice shader,i love to use dx 11 shaders,before i buy your package,in your package have dx11 rim shader,dx11 skin shader, dx11 hair shader?

    Dev
     
  18. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    This has been asked a couple of times, seems to be a popular feature :). Here's my answer on the previous page.

    Hi, the package contains rim and skin shaders that aren't made just for DX11, but will work fine in DX11 as well as DX9 and OpenGL. There's no DX11 hair shader in the package at this time.
     
  19. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Oh DX11 displacement shader, damn wish i had DX11 graphic card.
     
  20. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    hi,

    thanks for reply,have you skin and rim shaders with tessellation?

    dev
     
  21. Jebus

    Jebus

    Joined:
    Sep 17, 2011
    Posts:
    18
    Is it possible to purchase a version of this asset that's compatible with Unity v3.5.6f4, but still updatable through the asset store once we purchase Unity v4?
     
  22. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Hi - I've still never managed to get the mobile rim shader to work for iOS. Is there a trick to it?
     
  23. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Yeah, you can combine the Rim effects with Tessellation effects. The included shader generator allows you to select the effects you want to combine to create the shader syou need. Currently the Skin shaders are separate from that though and can't be mixed with the other effects so there's currently no skin shading with tessellation combination.

    Sure, the package will work fine in Unity 3.x, but you will need to delete either the ExampleData folder or the material files in that folder because for some reason the Material files created in Unity 4 can cause Unity 3 to crash on import. That data is only there to demonstrate some of the effects and is not necessary for usage.

    Double check that the Graphics Level in the Other Settings area in the Player Settings is set to OpenGL ES 2.0. There could be an issue in the current version so I'll also do some investigation and get back to you. I have been working specifically on the mobile shaders recently and will have an update for them shortly.
     
  24. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    im trying to get the shaders to work woth highlighting effect but after i copy the shaders to plugins directory bump specmap dosn't compile at line 27
    is there something i must copy or change in the shader to make it compile please ?
     
  25. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    You need to keep the two include files (AdvancedSS.cginc and AdvancedSSFunctions.cginc) in the same relative location to the shader files. So a Bump Specmap shader will be in Shaders/Bump and the include files are one directory above that ("Shaders/") so you need those include files to be one directory above wherever you've moved the shader to.

    You can duplicate the include files and have them in multiple locations if you have the shader files in multiple locations.
     
  26. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    its working thanks !!
     
  27. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    111
    Very usefull shaders, this package is awesome.
    I'm wondering if it's possible to get the Volume shader working on custom meshes ?
     
  28. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hello Matt, I hope all is well for the new year...and I am sure you are very on exciting things... I am working with the skin shader again, and I would like to pass on a suggestion that I believe will work out for more control. On the skin shininess, you have the Gloss set to the red channel, and you have specular set to green. Is there a quick way to change the shader code so that I can use the RGB for gloss and the Alpha for the specular? I figured it would be great for more control... thanks a bunch.

    Kashif

    EDIT: Removed Code
     
    Last edited: Feb 23, 2013
  29. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    I've added this as a new shader just now and it will be in the next update which I'll be submitting this weekend.
     
  30. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Sweet :)
     
  31. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
    Bro this is awesome, I'm going to buy this right away. :)
     
  32. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Hi,

    The asset store wont let me buy your product because I'm still on 3.5.7 and it says I need version 4.0.0 instead of showing me the buy button :(

    Any ideas?
     
  33. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    That's just Unity way to make you upgrade :p
     
  34. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    hi,


    How to make Relaxed Cone normal map because only normal map not work proper. help me

    which soft.. make better Cone normal map. plz......msg me


    regards


    play_edu
     
  35. oscarAbraham

    oscarAbraham

    Joined:
    Jan 7, 2013
    Posts:
    431
    Does the volumetric shader work with Unity Free?
     
  36. vellum

    vellum

    Joined:
    Dec 16, 2012
    Posts:
    3
    Hi Matt,

    I am having issues with the Volumetric Shapes and NGUI. For some reason, the Volumetric shaders won't display when being rendered by the NGUI camera. The camera settings are all identical to a non-NGUI camera I confirmed was working.

    I looked through the sphere volume code, but couldn't fine anything that would be affected. Is there something that you know if that would make the the volumetrics non-compatible with NGUI?

    Thanks,
    Brian
     
  37. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Apologies for the lack of updates and replies recently. I was overseas for a while.

    It is one of the few effects in the package that requires Pro because it needs camera depth texture support.

    Typically NGUI's camera is rendered at a later depth to add GUI elements over the top of what the other camera(s) have rendered which shouldn't cause any issue with rendering the volumetric objects.

    If you actually need the NGUI camera to render them for some reason then there's a couple of issues. First the camera should be using a perspective projection, not orthographic for the volumetric objects to work correctly. If that's how you're using your NGUI camera then the other thing you'll need to do is set it to render the depth texture. You could do this by applying a script to the NGUI camera that sets it. I'll post example code below. You'd probably not want to use the default "Depth Only" clear flags for that camera either.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class CameraDrawDepth : MonoBehaviour
    5. {
    6.     private void OnEnable()
    7.     {
    8.         if (camera)
    9.         {
    10.             camera.depthTextureMode |= DepthTextureMode.Depth;
    11.         }
    12.         this.enabled = false;
    13.     }
    14. }
    15.  
     
  38. vellum

    vellum

    Joined:
    Dec 16, 2012
    Posts:
    3
    Hi Matt,

    Thanks for the reply! I decided to remove the NGUI camera, and use main camera instead. This removed the issue of having the Volumetric spheres either directly on top or behind my 3D gui menu. Your response definitely helped!

    My next question is regarding the ability to batch your Mobile/Standard/Diffuse Rim shader. I am creating a 3D menu with several dozen rim shaded objects, and noticed that none of them are being batched. They are all using the exact same material, but I am not sure how Unity handles batching. Any idea how to make this more efficient in draw calls, or am I SOL because of the nature of dynamic shaders such as rim.

    Thanks,
    Brian
     
  39. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    I don't believe the shader would prevent batching. Are they batched if you use another simpler shader?
     
  40. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Hi MattCarr,

    Is it possible to combine parallax occlusion and triplanar mapping?

    Thanks
     
  41. Deleted User

    Deleted User

    Guest

    The relaxed cone stepped map (a.k.a relief map) is just a normal map but with the heightmap(or displacement) as the alpha. The heightmap must be inverted to get the right results.

    Usually I use Substance Designer for this, but you also can use Photoshop or gimp.
     
  42. Jerry-Stanley

    Jerry-Stanley

    Joined:
    May 8, 2013
    Posts:
    2
    I just bought this pack and imported it. As soon as I did that all of my textures on the terrain disappeared. I can't re-paint any textures. I even tried using these materials, I just imported them. Any idea how to get all my terrain back?
     
  43. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    That's not currently available, but could be for the next version.

    That's not actually the case. What you describe is what is used for Parallax mapping or Paralllax Occlusion mapping, but the Relaxed Cone texture is a more abstracted texture which you'll need software (like xNormal) to generate.

    Hi Jerry, sorry to hear about that. It's not something I've heard anyone else have issue with and I can't reproduce that myself. What version of Unity are you using? Did you import any other packages (particular those that include terrain shaders which this does not) recently?
     
  44. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Hey man, I don't mean to be rude or anything but I've a favor to ask, could you please take a look at this:
    http://graphicsrunner.blogspot.com/2009/01/volume-rendering-101.html
    http://graphicsrunner.blogspot.com/2009/01/volume-rendering-102-transfer-functions.html
    http://graphicsrunner.blogspot.com/2009/02/volume-rendering-201-optimizations.html
    http://graphicsrunner.blogspot.com/2010/05/volume-rendering-202-shadows-and.html

    Since you've include some volumetric effect in your package, you might be interested as well, could you please do the Volume Rendering effect suggested here (Ray-marching algorithm I believe)
    It would be nice if a custom gradient texture look-up could be done too!

    He is showing some other really cool stuff in his blog as well, would be nice to have them run in Unity3d in the (hopefully near) future ;)
    http://graphicsrunner.blogspot.com/2010/08/water-using-flow-maps.html

    I hope it interests you as well :)

    Thanks in advance :)
     
  45. samid

    samid

    Joined:
    Dec 4, 2012
    Posts:
    4
    Hi, sorry Matt, just wondering whether we can get a follow up on this? Image below is just a torus, you can see the issue...you think there's an easy solution?

    $volume.JPG
     
  46. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    The way I'm planning on incorporating custom meshes for volumetric effects first will work best with convex meshes. I am however also going to support 3D Textures for volumetric effects similar to some of what Curious posted above, so that might be the best way to handle concave shapes going forward.

    I recognise it has been a while since the update of the package and I'm actively working on an update right now :).
     
  47. samid

    samid

    Joined:
    Dec 4, 2012
    Posts:
    4
    Awesome, looking forward to it. Thanks for the reply.
     
  48. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Awesome, Raymarching shaders coming right up :D
    Can't wait to see what the outcome will be ;)
     
    Last edited: Jun 5, 2013
  49. blackpixel

    blackpixel

    Joined:
    Dec 1, 2012
    Posts:
    6
    Hi!

    I just bought your shader pack, only to find out that the volumes don't work for stereoscopic rendering ( Oculus Rift ). Only one eye displays it correctly. The other one has cutouts of the objects standing inside the volume ( camera depth texture problem ? ).

    Is this fixable ? Everything else seems to work just fine :)
     
  50. MattCarr

    MattCarr

    Joined:
    Jul 5, 2009
    Posts:
    339
    Thanks for letting me know. I'll take a look at it asap and get it working. I have used the volumetric objects with stereoscopic rendering before and it worked fine, but I haven't tested with the Oculus Rift setup.
     
    Last edited: Jun 10, 2013