Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

► Dynamic Radial Masks ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, Mar 6, 2020.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456


    This is support forum for Dynamic Radial Masks, shader extension for Unity for creating spherical projection masks inside shader.






    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: May 8, 2020
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Reserved.
     
    Last edited: Mar 6, 2020
  3. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,004
    Holy smokes...... I want this!!!
     
  4. Gordian

    Gordian

    Joined:
    Apr 1, 2015
    Posts:
    1
    Jaw, dropped. Wow.
     
  5. freshmeat911

    freshmeat911

    Joined:
    Nov 3, 2016
    Posts:
    78
    Very nice, good job (on my list now ;) )
     
  6. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,457
    Very interesting, very exciting. Does this work with Meadow Environment? Your demo scene kind of looks like it. Not sure how one would process the leaves, but instead of white having black - like coal - and burning down a forest might be an idea if doable :)
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Dynamic Radial Masks can be integrated into any shader, for Meadow Environment I just added simple lerp inside shader for blending Basemap color into White. Same as leaves shaders.
    As for fog and snow particles, Dynamic Radial Masks is used for transparency control in their shaders.



    Amazing Assets - YouTube Facebook Twitter
     
    Rowlan likes this.
  8. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,004
    What about using this with Advanced Dissolve to make villages disappear.
     
    Arkhivrag likes this.
  9. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,004
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Just a reminder that 1 free vouchers is still available:

    ASV-VLF3-YQJR-FKLP-9EGD-796H (redeemed)
    ASV-U74H-NLC7-3WXQ-VRNC-LA7K (redeemed)
    ASV-EYU4-XLAL-AQVA-3NAX-937M (redeemed)

    Note: One numeric symbol (not alphabet) is changed in each voucher.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Mar 10, 2020
    Virtuadreamer likes this.
  11. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,004
    ASV-VLF3-YQJR-FKLP-9EGD-796H not working
     
  12. johaswe

    johaswe

    Joined:
    Sep 13, 2018
    Posts:
    26
    True - i did try that voucher aswell before and now.. still no working voucher sorry..
     
  13. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,004
    I tried all of the combos for that as well lol.
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Directly using ASV-VLF3-YQJR-FKLP-9EGD-796H code had no effect. One numeric number in each voucher was changed and you had to find correct one. For example it may be:
    ASV-VLF3-YQJR-FKLP-1EGD-796H or
    ASV-VLF3-YQJR-FKLP-5EGD-796H or
    ASV-VLF3-YQJR-FKLP-9EGD-791H or
    ASV-VLF3-YQJR-FKLP-9EGD-096H and so on.

    For now all 3 vouchers have been redeemed. Hope they will be used in amazing projects.



    Amazing Assets - YouTube Facebook Twitter
     
    Virtuadreamer likes this.
  15. rrahim

    rrahim

    Joined:
    Nov 30, 2015
    Posts:
    189
    This looks great, and the the idea of more like these sounds very promising.
    Would you be considering releasing them as a bundle / single asset?
    Or you intend to release them only as single assets?
     
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Will be released several single assets.
    And one bundle with all Dynamic Shader Extensions.



    Amazing Assets - YouTube Facebook Twitter
     
    rrahim likes this.
  17. rrahim

    rrahim

    Joined:
    Nov 30, 2015
    Posts:
    189
    Awesome, I'm looking forward to that bundle. I'm always impressed with your work so I'm sure I'll use everything you add to that bundle.

    Also, I'm hoping to purchase this asset soon to be used with splines on a line renderer. I'm still unsure about how to set this up. Is there any demo in the asset which may help?
     
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Check help file in the very first comment.



    Amazing Assets - YouTube Facebook Twitter
     
    rrahim likes this.
  19. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Hello! Just wanted to say I purchased this and I'll most likely be back here with loads of questions.
    Anyway, amazing stuff.
     
  20. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    @Arkhivrag
    Hoping you can help me out! I've followed the tuturial and fine.
    So I have my own water shader (Unity 2019.3, HDRP, Unity Shader Graph), I have your package.
    I would like to simply have your liquid effect like in the the demo scene (tested the scenes in a different project) added to my existing shader, how do I proceed?
     
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    There are several features inside Liquid shader example you have to pay attention to. It is hand written shader and from artistic point of view it has no limitations, and Shader Graphs have many limitations (+ bugs).
    Not everything that can be done inside hand written shaders is possible using Graph tools.

    But 2 main things you would be interested are 1) vertex displace and 2) normal transformation used in Liquid shader.

    1) Vertex displace you can do exactly the same way as you do with textures, but in this case just use DRM node's output value:
    upload_2020-3-19_21-31-26.png

    2) As for Normal transformation it may be difficult to do exactly the same math inside Graph, but you can try using Normal From Height node and use mask value from the same DRM node for it.
    upload_2020-3-19_21-51-46.png

    DRM.gif

    Note, liquid example shader also uses tessellation and it is not available in Shader Graph. If you need high detail vertex displace you have to use mesh with high vertex density (high poly mesh).



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Apr 8, 2020
    Rowlan and Penhoat like this.
  22. MrIconic

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    214
    That video is impressive.
     
  23. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Lars-Steenhoff likes this.
  24. davitsedrakian

    davitsedrakian

    Joined:
    Jun 23, 2018
    Posts:
    23
    Heya! Is this working on iOS and Mac os, and also is performant for mobile devices?
     
  25. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Dynamic Radial Masks works on all devices.
    As for performance - asset creates various shape and style masks, with user controllable options. And instruction count varies from 6 - 20 for different masks.
    DRM is calculated inside loop, and size of this loop is also user controllable. For example in Liquid example scene is used mask with 128 elements.
    Performance directly depends on this loop size. If on PC loop size of several hundred elements may not be problem, on mobile it really will be a problem. So it is up to the user how heavy or light final effect will be.



    Amazing Assets - YouTube Facebook Twitter
     
  26. novikooff

    novikooff

    Joined:
    Sep 24, 2018
    Posts:
    1
    Hello! Cool asset!
    Everything works, but I have a question:
    Can I use the coordinates of an animated object instead of the DRMOnMouseRaycast script, while preserving the animated parameters for liquid simulation (as if the mouse button was always pressed)?
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Sure.
    DRMOnMouseRaycast just generates DRMAnimatableObject on successful mouse click (raycast) and adds it the DRMAnimatableObjectsPool.

    You can generate DRMAnimatableObject from any event you like. Set its properties the way you like and do not forget to add it DRMAnimatableObjectsPool.



    Amazing Assets - YouTube Facebook Twitter
     
  28. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    60
    Hi, I just found this and I have some questions.

    I want to create a fake (no tessellation) hole/carved effect for bullet and ray impacts. Is something like this included in the examples or easy to make through Amplify?

    How much control is there in choosing what will receive the effect? Can I filter by layer or even by tags?

    Can you use other shapes than circles/spheres?

    What conditions must a mesh meet to work with this?

    Is it possible to use a lot of these effects in a scene? I want to be able to "draw" a carved line effect through a mesh and have it stay there permanently.

    Can I use this through Playmaker?
     
    Last edited: May 8, 2020
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Hole/Bullet effect demonstrated in the video is pure Alpha Cutout shader effect.

    Each hole position is calculated using simple Raycast method. Their position and radius data is collected in simple array and sent to the shader, that has DRM module inside expecting this data.

    Based on provided data DRM module calculates mask directly inside shader and it can be used in creating any desired effects. In this case creating Holes.

    DRM module has several parameters that are user controllable. One of this parameter is mask shape and DRM can create several variations of them but all are redial shape (that why it is called Dynamic Radial Masks).
    upload_2020-5-8_23-48-54.png

    Another parameter is mask count. This depends on target device. DRM module inside shader receives data in array format. How much elements your target GPU can send to the shader, same amount mask objects will be generated by DRM module. In the Liquid example scene there are used 128 elements.

    Inside shader you can mix various DRM modules and use their generated masks the way you want.

    As for Playmaker. DRM module is a shader "parameter" (not the script or some kind of plugin or tool). And this parameter is updated from script using Unity API Material.SetVectorArray. Package includes example scripts for collecting various data in array formats and sending them to the shader, but for that purpose you can use any tool or plugin, or write your custom script. Or use Playmaker.

    In the very first post of this thread is available DRM ReadMe file. Check it.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: May 8, 2020
  30. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    60
    So, that would be yes for most of those questions? :D I'm not that experienced to get all that, I just ask what's possible and learn as I go along.

    So if I got it right, to apply this effect, I need to add some code to the shader the object is using? I'm using 3rd party shaders like Toony Colors Pro and Amplify Shaders. I assume that it will work with those?
     
  31. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    467
    Is this HDRP compatible?
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    DRM supports Amplify Shader Editor using one node integration. As for custom shaders, basic shader programming is required to add DRM there. All steps are described in the documentation.

    All rendering pipelines are supported.



    Amazing Assets - YouTube Facebook Twitter
     
  33. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    85
    does this work with VR? if it does, does it work with Single Pass Instanced and/or Single Pass?
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    This asset is shader extension (not regular drag-and-drop shader) that you manually integrate into your shader.
    So VR compatibility depends on your target shader.



    Amazing Assets - YouTube Facebook Twitter
     
    peeka likes this.
  35. bunnybreaker

    bunnybreaker

    Joined:
    Dec 10, 2013
    Posts:
    5
    I'm really interested in this asset, but have some questions about performance.

    I've read the documentation, and it's great you talk about the instruction cost of certain operations. How do these costs factor in when using multiple objects and materials? Forgive my naive understanding, but does it mean that the mask data can be shared at no extra cost? For example, have a set of 8 masks that are used by multiple materials, how does that scale? Does batching or GPU instancing have any effect?

    Thanks for any light shed on these questions.
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    If you have two meshes with the same material that are batched - mask is calculated only once.
    If you have two meshes with different materials (not batched) - mask is calculated for each material separately.



    Amazing Assets - YouTube Facebook Twitter
     
  37. Game_DevKH

    Game_DevKH

    Joined:
    Jun 11, 2017
    Posts:
    22
    Arkhivrag, can I make rain effect like whether they are game objects, terrain, or player will get wet when it's rain while using any sky system like Enviro for example? Can I also make a character wet when walking into the water?
     
  38. Game_DevKH

    Game_DevKH

    Joined:
    Jun 11, 2017
    Posts:
    22
  39. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    For such rain effect better use particle system.



    Amazing Assets - YouTube Facebook Twitter
     
  40. macube

    macube

    Joined:
    Jul 16, 2017
    Posts:
    11
    Hey,
    thank you for the asset, but can you update the example files to URP ? (All what i see is purple)
     
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Yes, it is planned in near future.

    As written in ReadMe file for example scenes: Dynamic Radial Masks is compatible with all Unity render pipelines, but example scenes are built using default (standard) render pipeline as it is the most stable and bug free.

    You can check example scenes even in project using URP or HDRP, just disable (temporarily) SRP from Projects Graphics settings.
    upload_2020-7-17_13-29-5.png




    Amazing Assets - YouTube Facebook Twitter
     
  42. macube

    macube

    Joined:
    Jul 16, 2017
    Posts:
    11
    Okay thank you :)
     
  43. lumeneo

    lumeneo

    Joined:
    Mar 3, 2014
    Posts:
    53
    Please help me convert the shader you use for the Example_11_Script_Liquid to URP!
     
    Last edited: Jul 31, 2020
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    I have replied to the same question here #21. It will help you to reconstruct liquid example shader in URP.




    Amazing Assets - YouTube Facebook Twitter
     
  45. shahanbutt0

    shahanbutt0

    Joined:
    Apr 30, 2018
    Posts:
    3
    Is the grass effect in the sample scene of this package?
    this one to be exact :
     
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    It is DirectX 11 Grass Shader by Stix Games.
    In the demonstration video Dynamic Radial Masks is used to scale grass height value.



    Amazing Assets - YouTube Facebook Twitter
     
  47. venusboysatish

    venusboysatish

    Joined:
    Jul 10, 2012
    Posts:
    26
    Hi, i bough this effect 4 days ago. and it works great!

    However i am trying to tweak it to fit to my requirement and need a bit of help.
    For the Torus, instead of a solid band, i want it to be a segmented band - like this


    https://imgur.com/a/gSaLsUH


    I am no expert in shader programming, but I tried to modify the shader function to this, but it wasn't working. Can you take a look and see why that wasn't working?


    inline float ShaderExtensions_DynamicRadialMasks_Torus_Advanced(float3 vertexWorldPosition, float noise, float3 maskPosition, float radius, float intensity, float noiseStrength, float edgeSize, float smooth)
    {
    //segment length is 0.5; modified portion
    float segAngleInRadian = 0.5 / radius;
    float relAngle = atan2((maskposition.z - vertexWorldPosition.z), (maskposition.x - vertexWorldPosition.x));
    int closestInt = round(relAngle/segAngleInRadian) % 2;

    //Distance
    float d = distance(maskPosition, vertexWorldPosition);

    //Noise
    edgeSize += noise * noiseStrength;


    float2 r = max(float2(0, 0), float2(radius - d, d - radius) + edgeSize) / edgeSize;

    float shape = saturate(r.x * r.y);

    //Smooth
    shape = pow(shape, smooth + 0.01); //BUG: does not work if do not add 0.01. Hmmmm

    //Fade
    shape *= intensity * closestInt;

    return shape;

    }
     
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,456
    Code (CSharp):
    1. float segAngleInRadian = 0.1;
    2. float relAngle = atan2((maskPosition.z - vertexWorldPosition.z), (maskPosition.x - vertexWorldPosition.x));
    3. int closestInt = round(relAngle/segAngleInRadian) % 2 * sign(relAngle);
    dots.gif



    Amazing Assets - YouTube Facebook Twitter
     
  49. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    104
    Created using dynamic radial masks. I am using it in a custom render pass in hdrp. This means the effect can be applied to anything in the scene even if the scenes shaders dont include the mask check. In this case, none of the shaders in the scene have the dynamic mask check, they are default hdrp lit materials. The only shader that uses the dynamic radial mask check is the image effect. I would imagine this would be a huge performance increase. Instead of sampling from many different shaders across the screen, its only sampling through 1 shader.



    A bit more info about my process here (posted in the comments):
    https://www.reddit.com/r/Unity3D/comments/iqcq5b/infestation_full_screen_image_effect_created_with/
     
    Last edited: Sep 11, 2020
    Arkhivrag likes this.
  50. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    104
    I have been playing around with Massive clouds atmos (https://assetstore.unity.com/packag...massive-clouds-atmos-volumetric-skybox-173160) and thought it might be cool to see if I could use drm with it.

    Its not very performant, mostly because the raymarching that massive clouds does and I implemented it somewhat naively. Im guessing it would be more performant if I can sphere check the ray and change the ray start/end to the intersections of the DRM sphere mask. Not very familiar with raymarching, but I think the loss in performance is from checking DRM every step, even outside the sphere. Im going to try to implement that ray/sphere check to see if performance increases. Im not very confident I will complete this mostly because Im not sure how I would handle multiple overlapping spheres with a ray while also making it work with massive clouds, but its kind of cool that this is possible.
     
    Last edited: Sep 15, 2020
unityunity