Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

RSP - Relief Shaders Pack on Asset Store

Discussion in 'Assets and Asset Store' started by tomaszek, Dec 5, 2012.

  1. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862


    Released:
    http://u3d.as/content/tomasz-stobierski/rsp-relief-shaders-pack

    Please, take a look at documentation here for detailed description:
    http://www.stobierski.pl/unity/__RSP_release_info.pdf

    Latest working demos here (I had to split them into 5 to make them smaller as GLSL may be problematic at precompiling over 20 shaders per demo):
    http://www.stobierski.pl/unity/RSP_demo1/WebPlayer.html
    http://www.stobierski.pl/unity/RSP_demo2/WebPlayer.html
    http://www.stobierski.pl/unity/RSP_demo3/WebPlayer.html
    http://www.stobierski.pl/unity/RSP_demo4/WebPlayer.html
    http://www.stobierski.pl/unity/RSP_demo5/WebPlayer.html

    Mac users - as GLSL shaders used are rather complex so it might take a while to compile them - especially in demo1 - plenty of shaders on scene. Unwarmed shaders "hiccups" may occur (should gone after every object has been rendered by camera).

    Also I had to disable antialias postFX everywhere because it seems that this is what crashes some machines (and most probably has nothing to do with my shaders).

    Pre-release discussion here:
    http://forum.unity3d.com/threads/152531-New-relief-mapping-techniques-%28fast%29/page2

    Main features:
    - Procedural shaders
    - Distance map shaders
    - Extrude map shaders with real 3d volume
    - Steep Parallax Occlusion shaders with real silhouettes
    - Volume shader to mimic hi-poly geometries using lo-poly meshes
    - Rich features like self-shadowing, any lightmap handling and more
    - Adjustable to use features needed only
    - Requires GPU with SM3.0. Does not require Unity PRO (only example scenes use post FXes).

    Version 1.0c update available -> openGL hotfixes + POMVolume blend file with info how to setup it in Blender
    Version 1.0d update available -> openGL hotfixes for RTP bonus POM shader
    Version 1.0e update - DX11 compatibility solved (works even faster than in d3d9 mode)
     
    Last edited: Feb 23, 2013
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Very nice, impressed with the quality too especially with AA.
     
  3. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    These are super good... nothing better than seeing relief mapping in a game...
     
  4. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    very impressive!!!they work with mobile platform?support reflection or transparent property?
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You're probably too demanding when we concern mobile platforms, honestly I couldn't and didn't checked it. If only mobile GPU handles SM3.0 with conditional branching and is reasonably fast they could work. Procedural and distance map (refer to doc which are they) shaders are best candidates for mobile GLES target. They don't need heavy GPU load in terms of texture fetching but uses a bit of math instead.

    Reflection/transparent. At this moment I haven't prepared such shaders but my techniques themselves don't constraint such application. If we've got parallax texture offset calculated with right normal in tangent space I see no problem in making such shader versions, too. They could also handle self-shadowing even with transparency as shadows are calculated inside shader fragment program per object, not globally.

    Tom
     
    Last edited: Dec 6, 2012
  6. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    thanks,once again very impressive shaders!!
     
  7. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Send you a PM (not directly related to this) , so free bump to let you know in case you have PM notifications disabled.
     
  8. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Version 1.0c update available -> openGL hotfixes + POMVolume (king kong face) blend file with info about how to setup it in Blender
     
  9. Samsson

    Samsson

    Joined:
    Oct 12, 2010
    Posts:
    165
    Niice but a few questions :

    1. What about perfomance in a complete scene ?
    2. Does it works with beast ?
    3. Doest it works with Props ?
     
  10. Samsson

    Samsson

    Joined:
    Oct 12, 2010
    Posts:
    165
    OK, I read your documentation so It works both with beast and lights props.

    What about performance with a full AAA scene ?
     
  11. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You'll just have to judge shaders performance by watching framerate of demos in fullscreen mode on cheaper hardware. The problem is that webplayer doesn't always show the real FPS, but constrained by some kind of v-blank sync issues. That's why I ask to test it on cheaper hardware, check GPU benchmark for them and make approximate performance for better GPU. I found it works fine. For example I test it on my hardware, then compare my GPU scoring with another GPU (on benchmarking websites) and FPS ratio fits quite well in most cases.

    Full AAA scene means AAA hardware needed I guess ? Well, for AAA hardware RSP shaders behave very fast. They're fragment shader dependent, so the performance is associated to number of pixels shaded only (polycount doesn't apply).

    Anyway - on my mid-range hardware (nVidia GT240) rendering full screen all covered by material using the most expensive shader @1280x1024 takes c.a. 5-6ms with all features included (self-shadowing) what gives about 200fps. Everything depends on settings. Shaders are fully adjustable. You don't have to take all or nothing but tailor shaders features and quality against performance that would satisfy you.

    I'm talking about most expensive POM shader (steep parallax with self shadow and correct silhouettes). Using specialized shaders like procedural or distance map shaders (quite enough for surfaces like pavements or brickwalls) will give you 2-3 times better performance. Most of my specialised shaders can take the fullscreen job with all bells and whistles below 3ms. SpaceStation scene in fullscreen w/o Unity shadows (they're another story about performance and any shader even simple diffuse won't make them working faster) runs at about 300-400fps on my hardware.

    Also - remember to render the most expensive shaders last (setting their RenderQueue in shader code tag to higher value) this way every expensive POM surface that is occluded by another geometry rendered before will cost nothing (only object geometry will be considered for calculations by vertex shading unit).

    It's kind of myth that POM shading must be of extraordinary performance cost. In fact - it was for GPUs like nVidia 6000 series, but nowadays when you think about reaching AAA visual level you should definitely think about using POM shading as it's alternative for DX11 tessellation (but works on wide range of platforms like dx9 PC and Macs). You can always add fallback subshader that would realise simple PM (parallax mapping) or bumped specular for low GPUs and switch it by using shader LOD level.

    ATB, Tom
     
    Last edited: Dec 11, 2012
  12. Samsson

    Samsson

    Joined:
    Oct 12, 2010
    Posts:
    165
    Thalks for all your answers !

    Can you screen, or explain what kind of maps we need ? For exemple, if i want to use substances, must i create another texture for exemple a kind of heightmap (i think to specials heightmap made with a base one and normal map) ?
     
  13. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Due to much better performance shaders that use heightmaps use it alone (Alpha8), not combined with normalmaps. Substances can output diffuse with specular (in alpha), normal and heightmap. In examples I've just saved substance outputs as textures. However it would be cool idea to integrate substances with my SteepParallax shader. Will look into it for next update if it's feasible.
     
    Last edited: Dec 12, 2012
  14. Samsson

    Samsson

    Joined:
    Oct 12, 2010
    Posts:
    165
    So at maximum your shaders use 3 textures ?
    1 : Diffuse, 2 : Normal Map, 3 : Classical Heighmap
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Considering Steep Parallax and Extrude Shaders - yes (specular can be mixed with diffuase on alpha channel - it's set in shaders define and is adjustable, we can also derive specularity from overall diffuse brightness - a few examples use it).

    Procedural relief shaders - only diffuse/spec (color).

    Distance map shaders (like bricks, space station) - diffuse, normal (optional), distance map (made by my tool included), displace map (optional - its' kind of normal map that will modify a bit tangent space so that reliefed edges are not so sharp, synthetic).
     
  16. Samsson

    Samsson

    Joined:
    Oct 12, 2010
    Posts:
    165
    Just to know, how/where did you learned to code shader ?
     
  17. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Examining surface shaders docs and Cg web resources and other web resources related to shaders (as I'm educated computer engineer general programming issues are just common tasks for me).
     
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    What might be important for users that indent to buy it in near future - Christmass sale is coming ! (waiting for Unity AssetStore staff moderation). 40% off :) I hope it will encourage many potential users which then could put kind of feedback - testimony (positive I hope) here.
     
    Last edited: Dec 14, 2012
  19. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    For anybody that could miss it - Christmas sale just started.

    Don't know which criteria is used by Unity AssetStore staff to mark product as "hot deal" in AssetStore. I see many featured products with its %50, but is it for choosen one ?
     
    Last edited: Dec 18, 2012
  20. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    Just bought the package, but there are things I have to ask. The height map textures in the pack are quite different from what I have. How could I achieve such height maps? Mine do nothing. (Generated in CrazyBump) Also, when using objects that have more complicated geometry (such as interior building), when I put a silhouette shader, it starts stretching the texture when moving the camera. Also, if I put the Steep Parallax shader, the object starts clipping and at some points you could see through the model.

    Is there any documentation to the pack? I can't seem to find any...
     
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi Luka, documentation is there - main package folder (ReliefPack) - as pdf file. It's available also here in the first post of the thread. I always put there important info. It's good to take a tour across the doc before you buy it. It would clarify things. That's why I put it here so that users need not to buy anything blindly (with hope that things will "just work" no matter the model and settings).

    1. Mysterious heightmaps you're talking about are probably distance maps generated by attached tool (refer to doc).
    2. POM shader with real silhouette - you have to bake curvature and uv scale info into model (package has such tool).
    3. clipping - you probably refer to uv border clip. Disable uv bordering or keep your uv coords inside 0..1 range or adjust uv clipping bounds in shader params. This way or another - refer to doc :)

    ATB, Tom
     
  22. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Thank you ! I tought myself about how to use MIPs right way on heightmaps already, but w/o any conclusions yet. This article clarify some calculation properties. After taking a quick look I'll definitely look at this closer later on.

    P.S. ahh, these clever guys from Poland :)
     
  24. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Hi Tomaszek,

    I have just purchaser your Relief Shader Pack.

    I am especially interested in the Steep Parallax shaders. These shaders do not seem to work properly in Unity 4.0 though (not in DX11 mode) though. Some weird artifacts appear with the mesh getting partially transparent.I guess that this is due to the same compilation problems you managed to fix in the Relief Terrain shaders.

    Could please double check this and send me revised version of those shaders?

    Thanks a lot.
     
  25. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Yes, possibly I could look into that, but working the same time on RTP and RSP makes me dizzy (so many shaders to cover). In RTP I rearranged all the code to be more stableon both DX11 and OpenGL (apparently thare are coding features that are logical and quite correct, but for some reasons microcompilers doesn't like them). I'll try to compile RSP shaders under DX11 and look if particular shaders can be corrected quickly - preferrably send me separate shader you've got problems with, so I can narrow my debugging work.
     
  26. jorg1234

    jorg1234

    Joined:
    Jul 12, 2012
    Posts:
    5
    Hi! really wonderful, wonderful stuff! Will there be a steep parallax silluette cutout (extrude) shader in the future?
     
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It's already there or I misunderstand the question...
     
  28. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    I don't really understand it either.
     
  29. jorg1234

    jorg1234

    Joined:
    Jul 12, 2012
    Posts:
    5
    Well, a shader that behaves like the Steep Parallax (silhouettes), but also has the possibility to cut out like the extrude shader does ^^
     
  30. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You'd like to cut holes inside surfaces, is it you're thinking of ? It could be realised various ways. We might define mask texture or we could simply assume that parts of surface placed below some threshold (black means "floor") have to be cut. It's quite simple. You might place a line of code after raytracing for texture offset (but before shadows tracing section) like this:

    clip(rayPos.z-threshold); // threshold 0..1

    so that every pixel that has been resolved for rayPos.z position below threshold level will be cut.

    let's say like this:

    clip(rayPos.z-0.5);

    this way every pixel in height map that is below 0.5 (rgb 128 - grey) will be cut.

    ATB, Tom
     
  31. jorg1234

    jorg1234

    Joined:
    Jul 12, 2012
    Posts:
    5
    Ah! Thanks a lot! You're pro ;)
     
  32. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    New release awaiting for AssetStore approvemet. All shaders should work fine for DX11 (even faster than DX9).
     
    Last edited: Feb 23, 2013
  33. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    RSP 1.0e on AssetStore. For those who had problems with DX11 - it's update for you.
     
  34. Hotsun

    Hotsun

    Joined:
    Aug 11, 2010
    Posts:
    122
    Hi,
    Right now I am about to buy this package and the one for terrain,but first I have a question,I know some of relief algorithms doesn't work with anisotropic-filtering so I want to know if your shaders are working fine with it?
    I played the demos but non of them had anisotropic on at all and working with anisotropic is really important for me.

    Thanks is advance.
     
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Demos show what RTP/RSP are capable of.

    In case of RSP I intend to improve filtering (MIP level selecting) in a few weeks.
    In case of RTP I believe filtering works OK, the only problem could be caused by built in Intel HD series (HD 3000/4000) where MIP selection might give a bit oversharpened results. Filtering strength (more sharp / blur) can be adjusted by one of RTP script parameters, too.

    Could you give me an example of rendered surface where filtering doesn't satisfy you (screenshot of my demos) ?

    Tom
     
  36. Hotsun

    Hotsun

    Joined:
    Aug 11, 2010
    Posts:
    122
    Sure :
    $RSP_No_anisotropic.jpg
    If you can't see the image use this link : http://s2.picofile.com/file/7727430321/RSP_No_anisotropic.jpg

    Here you can see in a short distance the texture is fading to a flat color which is not so good.
    I don't know if you disabled anisotropic from the settings or it's about the shader.
    If it's not about the shader please just send a screenshot same as mine with anisotropic forced on.

    Thanks for your fast support.
     
  37. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It's supposed to behave like this, but I could think a little more on the issue to sharpen more the mid/far distance relief. It might be in reflected in next update, but this moment I can't promise anything.

    BTW - you could replace my shader with bumped specular and check if it would filter the texture better. Maybe I'm wrong, but it would look pretty similar I guess (this moment we can't do much about it).

    ATB, Tom
     
  38. Keithleclezio

    Keithleclezio

    Joined:
    Feb 26, 2013
    Posts:
    1
    Hi Tomasz

    great work on the RSP shaders!

    Any chance you could make a blend 2x version of these shaders that you can control using Vertex colors...it would be awesome to blend some ground tiles into grass or other surface types... i would definatly buy them :)

    it would be great to see UV to WSM blend, UV to UV blend WSM to WSM blend
     
    Last edited: Apr 25, 2013
  39. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I'll try to take a look and make some update in a few weeks. Thanks for suggesting features you'd like to see here.
     
  40. kinl

    kinl

    Joined:
    Jun 1, 2008
    Posts:
    355
    Hi Tomaszek

    I've just purchased these awesome shaders and all work great apart from when I use it with Pro Builder.

    After a bit of testing I've found that the relief shader only repeats twice within the UV coords so since Pro Builder edits the UV coords and not the material tiling then the shader stops repeating and renders invisible.

    Heres an image that hopefully better explains my problem.

    $reliefshadersissue.jpg

    Is this a limitation of the shader?

    Thanks

    Kinl
     
    Last edited: May 8, 2013
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi Kinl,

    This is not limitation, but feature of shader :). It can cut material at UV borders (which are adjustable in material properties, it can be also disabled in shader code by commenting one define - refer to comments in shader). I assume ProBuilder maps UV beyond 0..1 range so the material becomes invisible. Try to put larger uv border cut values in material properties, or disable this feature in shader code.

    ATB, Tom

    P.S. Thank you for buying my work. Any honest (esp. kind :) ) review in AssetStore is mostly welcomed, as RSP lacks of reviews at all.
     
    Last edited: May 10, 2013
  42. Ghoetam

    Ghoetam

    Joined:
    May 10, 2013
    Posts:
    6
    About the "Volume shader to mimic hi-poly geometries using lo-poly meshes", is it possible to use this shader for meshes created in Unity with the mesh class and Texture2D for the texture or do you need to use software like Blender?
     
  43. kinl

    kinl

    Joined:
    Jun 1, 2008
    Posts:
    355
    Ah thanks Tom.

    I guess I hadn't figured out all the features yet.

    If I was to throw in a very high number in the border cut values to disable the feature would that have any negative impact on performance?

    kinl
     
  44. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    No.
     
  45. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    The method you're obtaining low poly model with right UV from hi-poly model is up to you. Blender is only one of option I've used as proof of concept (to check if my idea works and how performant it is - the more "tight" - refer to pdf docs - low poly mesh is, the faster shader behaves). You can implement functionality of hi-poly model decimation via script. In fact this would be the best and I thought about it - as we'd have hi-poly model, we could bring resultant lo-poly model by one click in Unity, but I've never had time to work on this more (sorry - RSP isn't selling that good to justify working on this - sorry :( ). In a few weeks I've got plan to update a bit this package, but at this stage can't promise anything, "mimic" auto setup functionality isn't on my roadmap in the near future.

    ATB, Tom
     
  46. wdcstudios

    wdcstudios

    Joined:
    Apr 18, 2011
    Posts:
    11
    Hi Tomaszek, are these written as surface shaders? I would like to buy the package and maybe add your relief features to some pre existing shaders.
     
  47. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Yes, surface ones. Sure, go ahead as far as you don't use it any competetive solution (i.e. another shaders for sale).

    ATB, Tom
     
  48. bluemoon

    bluemoon

    Joined:
    Dec 14, 2012
    Posts:
    85
    I was wondering if these shaders work on skeletal animated mesh?
     
  49. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Why not, as far as you'll provide shader with proper uv / tangents (refer to docs to read about tangent space streching issue, too). However you won't get silhouettes there (as mesh curvature is varying over time).

    Tom
     
  50. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    I've been messing with these shaders for a few hours now, using various textures I have from many sources. It's not been easy getting acceptable results with all of them, but I've found the simple 1D procedural shaders are excellent for even brick walls :)

    I think I need more of a tutorial on producing those source images for extrude maps. My results so far, after simply drawing some black lines roughly across the edges of a wall, have not been that great. I got something approximately like the brick wall example, but had to tweak a slider to get the seam to actually be somewhat straight, and it still wasn't quite there. If I get a better description of the requirements I might be able to produce something in an image editing program.

    Any pointers are appreciated :)