Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

► Advanced Dissolve ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, Feb 13, 2018.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Dissolve amount is just a regular slider parameter inside material. You can modify it for any number of materials.



    Amazing Assets - YouTube Facebook Twitter
     
  2. DreamWayAssets

    DreamWayAssets

    Joined:
    Aug 8, 2020
    Posts:
    1
    I'd like to test the preview version of HDRP version, how can I get it?
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Send me asset purchase invoice using support e-mail (support@amazingassets.world)



    Amazing Assets - YouTube Facebook Twitter
     
  4. FireEmberStudio

    FireEmberStudio

    Joined:
    Feb 10, 2020
    Posts:
    2
    Hi!, sorry for bothering but I couldn't find how to implement this feature. constructing and deconstructing an already made model. It's simple but I can't find how to change the property of the material and how to configure direction like in the video. Or with the ball just dissapearing upload_2021-1-21_19-10-29.png
    upload_2021-1-21_18-52-10.png
    upload_2021-1-21_19-10-29.png
     

    Attached Files:

    Last edited: Jan 21, 2021
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Use dynamic plane mask.



    Amazing Assets - YouTube Facebook Twitter
     
  6. FireEmberStudio

    FireEmberStudio

    Joined:
    Feb 10, 2020
    Posts:
    2
    Thank you for your quick response! your asset it's great. Do I have to enable some keys to just dissolve the sphere? I'm trying to change the property "DissolveRange" but it doesn't seem to work
     
  7. Cris_2013

    Cris_2013

    Joined:
    Nov 25, 2017
    Posts:
    39
    Hi, I am using the URP Unlit shader in one of the materials, where I have a diffuse white texture and I would like to control the color from C#, how can I achieve that?
    Many thanks
     
  8. mchung123

    mchung123

    Joined:
    Jul 4, 2017
    Posts:
    38
    Hey does this work with materials with non-standard shaders? I am using a custom shader with that material, and I am having trouble setting this up to dissolve
     
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Check ReadMe file inside Doc folder, it will help to create basic dissolve shader and guide you through all shader settings.


    You can change material color using Unity Material.SetColor method, property name is
    _DissolveEdgeColor


    Check ReadMe file inside Doc folder, it will help to create basic dissolve shader and guide you through all shader settings.



    Amazing Assets - YouTube Facebook Twitter
     
  10. mchung123

    mchung123

    Joined:
    Jul 4, 2017
    Posts:
    38
    I did, my object already has materials, and its using another shader not the URP lit shader. This doesn't seem like it works with other shaders. I am using a toon shader and it doesn't seem to work with that. What am I looking for exactly in the docs, I got the basics working on objects that don't use my shader.
     
  11. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    You want to use this Advanced Dissolve shader together with other shader? You can't do it.



    Amazing Assets - YouTube Facebook Twitter
     
  12. mchung123

    mchung123

    Joined:
    Jul 4, 2017
    Posts:
    38
    Thats what I figured, I guess what I will do, is transfer all my materials over to that shader perform the animation then transfer them back
     
  13. adamwilliamwork

    adamwilliamwork

    Joined:
    May 18, 2019
    Posts:
    1
    I'm using XYZ Axis Mask (Z, inverted) dissolve. I use an animation to adjust the offset value and make an object dissolve at a specific moment.

    In scene view, I have the offset values set to a number whereby the object has not dissolved at all. However, when I push play, the object is partially dissolved during all animations which contain no offset property values.

    How do I keep the offset values at the scene view value during playmode, when no animation is adjusting them?
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Check scripts used in the scene, seems someone affect shader settings.



    Amazing Assets - YouTube Facebook Twitter
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
  16. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    83
    Hi, I was using this asset in my project and i was previously able to set the emission color via script and it worked fine. However now I have upgraded the project to use Unity 2020.2.2, setting the emission color via script doesn't seem to work any more. The color changes in the inspector but it doesn't change visually in the scene view. I have also noticed that setting it in the inspector also doesn't work. Has the ability to do this been removed?

    In addition to this the ambient occlusion is not working either, when previously it was.

    thanks
     
    Last edited: Feb 3, 2021
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    If you are adjusting color using previous scripts, it does not work. Update 2021.1 is completely new asset and it is not compatible with previous versions.
    All shaders properties (including color and emission) of course can be modified from script, but using new API.
    I'd suggest to go through Manual file (Documentation folder) explaining all new features and how they work. The last chapter Runtime API (page 31) even contains examples exactly for color and emission modifications.


    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Feb 3, 2021
  18. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    83
    Hi, thanks for the reply. I forgot to mention that I am using the URP package. I tried to look for the manual file you referred to, but I could not find it in either of the 3 packages. However there is a folder named 'Doc' that contains a file called 'ReadMe.pdf', but it only has 19 pages and no chapter called 'Runtime API'.

    For the ambient occlusion I was referring to the use of an ambient occlusion map and not post processing.

    thanks
     
  19. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Update to the latest version.
    Remove asset from the project, clear Asset Store cache folder and re-download package.



    Amazing Assets - YouTube Facebook Twitter
     
  20. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    83
    Hi, following your instructions solved my problems. The ambient occlusion map is now working and I am able to change the emission at runtime.

    thanks
     
  21. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Prebuy question: how is the disolve controlled? by slider input? Can i do script input or Unity Event input?

    I am looking for a "cleaning/rinse" effect, cleaning dirt of something, so i was thinking adding the target object with a copy of itself (scaled +0.1) with a dirty material, then slowly disolve the "outer" object, until completely disolved.
     
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Dissolve amount is a slider parameter inside material editor. It can be controlled from custom script using unity Material.SetFloat method or with included API.



    Amazing Assets - YouTube Facebook Twitter
     
    Vaupell likes this.
  23. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302

    Perfect, you just sold yourself another copy.. <3
     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Asset description on the store contains link to the documentation. Check it before purchase.



    Amazing Assets - YouTube Facebook Twitter
     
  25. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    Does this work with moving and rotating objects? ( so if I have an aeroplane flying along with its nose cone dissolved)
     
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Like Adams in this video? Yes.
    upload_2021-2-26_15-46-30.png



    Amazing Assets - YouTube Facebook Twitter
     
  27. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    The guy on the left? Yes if he is able to move around and rotate! Just looked at the video and it seems he is just walking into a disolve. I want the disolve to move with him.

    So actually - no!
     
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    In the video it does not rotate, just moves forward. If it rotates 180° back side of its body becomes dissolved.



    Amazing Assets - YouTube Facebook Twitter
     
  29. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    What I need is the disolve to move with the object. What if I want the the back of the guys head missing all the time? As he moves around, the dissolve must move with him. when I have a plane flying with a missing nose cone it must move and rotate with the aeroplane.
     
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Yes, dissolve 'plane' can move with object.



    Amazing Assets - YouTube Facebook Twitter
     
  31. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    So to be clear, if I have a mesh and move AND ROTATE it, the dissolve will move and rotate as well? (I am asking this as all the examples you show are fixed objects, not moving objects).
     
    Last edited: Feb 26, 2021
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    It is very easy.
    1) Enable Geometric Cutout with Plane type inside shader.
    2) For updating Plane cutout you have to use Controller Script, yes? So, just drag & drop that plane object from controller script into your mesh hierarchy. As it is just a common transform object, it will follow your character as any other objects will do.
    3) Inside controller script make sure Plane # variable has assigned your 'character following plane' object.



    Amazing Assets - YouTube Facebook Twitter
     
  33. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    I have purchased and at the moment I am very impressed. On integrating with my project through, I have found that when I add a geometric controller to a prefab, it is placed outside the prefab hierarchy. As I want the controller to move with the prefab could you let me know how I can do this?
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Controller is just a scrip, that sends cutout object data to the materials. This script can be added manually to a mesh, or it can be assigned to an independent object.
    As I understand you need not controller script, but cutout object to follow our mesh, yes? Script will read that cutout object data (position, normal direction, etc) and update materials. You can make cutout object part of your object hierarchy and it will follow it.
    If both controller script and cutout object are part of one hierarchy, it should not be a problem to set them up and make part of the prefab.
    If script and cutout object are separated, you have to write simple script that will assign cutout object (from character hierarchy) to the controller script when you need it.
    Something like this:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. using AmazingAssets.AdvancedDissolve;
    6.  
    7. public class NewBehaviourScript : MonoBehaviour
    8. {
    9.     public AdvancedDissolveGeometricCutoutController controller;
    10.     public Transform cutoutObject_1;
    11.     public Transform cutoutObject_2;
    12.  
    13.     void Start()
    14.     {
    15.         //Using "cutoutObject_1" in the GeometricCutoutController as the first (ID: One) object to read data from
    16.         controller.SetTargetStartPointTransform(AdvancedDissolveKeywords.CutoutGeometricCount.One, cutoutObject_1);
    17.  
    18.  
    19.         //If both script and materials are set up to use 2 cutout objects.
    20.         //Using "cutoutObject_2" in the GeometricCutoutController as the second (ID: Two) object to read data from.  
    21.         controller.SetTargetStartPointTransform(AdvancedDissolveKeywords.CutoutGeometricCount.Two, cutoutObject_2);
    22.     }
    23. }

    Note, Controller scripts displayed inside material editor are not part of a shader or material. It is just an editor helper to visualize if any controller scripts in the scene are affecting material.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Mar 1, 2021
  35. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    Thank you. I have now got the prefab linked up. However instancing or use of the prefab doesn't work. A new prefab always references the original controller. I guess I will try assigning like your example above.

    EDIT: So I think when using (instantiating) prefabs, it must be necessary to create material instances. In which case I need to assign the controller to the shader in script. I can't see how to do that though...
     
    Last edited: Mar 1, 2021
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    You can already have controller script in the scene, with required setup.
    When you instantiate object just assign cutout object (from your hierarchy) to the controller script and add mesh dissolve material(s) into the same controller script materials array.
    In this way controller script will read cutout object data and send them into the materials.

    Concept of using controller script + cutout object, is that material editor can not display all properties requiring for geometric cutouts.
    Script is used to read data from cutout objects (position, scale, rotation, normal direction, etc) and send that data to the materials.
    This is standard and common Unity solution for updating materials using script. You can even write your own scripts and update materials in your desired format.
    Some of Unity API methods for updating materials from script: Material.SetFloat, Material.SetColor, Material.SetVector. You can find complete list in Material class.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Mar 1, 2021
  37. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    I understand all that. Its not about assigning the target to the controller. The problem is assigning the controller to the material.

    Here is a prefab with a cutout:
    upload_2021-3-2_8-10-45.png

    When I drag a new prefab into the scene, the material sees two controllers:
    upload_2021-3-2_8-11-20.png

    I can create a material instance. But I can see no way of assigning the correct controller to the material.
     

    Attached Files:

  38. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    So here I have created a material instance and manually assigned the correct controller. Just need a way to do it in script!
    upload_2021-3-2_8-25-25.png
     
  39. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    You do not (and can not) assign script to the material.
    As I wrote above, controller script is not part of a material or shader. Material editor just helps you by displaying which controller affects current material.

    You need one controller script in the scene for specific geometric cutout. All you have to do is add required materials into Materials array of a script.

    Using multiple controller scripts is necessary only when you have materials with different geometric cutouts. For example one group of materials are using Sphere cutout, second group Plane and so on.

    If you have multiple similar controller scripts updating same materials, this may create unpredictable affect, as all of them will try to update materials simultaneously, and you do not need it. Material editor detects such situations and displays warning message to help you.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Mar 2, 2021
  40. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    184
    OK, I understand. Is there any reason the controller has a maximum of 4 slots?
     
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Shaders support only 4 geometric cutout objects.



    Amazing Assets - YouTube Facebook Twitter
     
  42. igoraleftinovich

    igoraleftinovich

    Joined:
    Feb 11, 2017
    Posts:
    17
    Hi! Is it possible to use custom mesh as a mask?
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Custom shape can not be used as it is almost not possible to describe them inside shader mathematically.



    Amazing Assets - YouTube Facebook Twitter
     
  44. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    I'm getting a number of errors while using the asset with HDRP in Unity 2020.3.1f1 (Latest LTS).
    Code (CSharp):
    1. Shader error in 'Amazing Assets/Advanced Dissolve/Shader Graph/Metallic (Cutout)': undeclared identifier 'IsGammaSpace' at line 4832 (on d3d11)
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Just tested with HDRP 10.4.0 and at my side here are no errors.

    Try regenerating that shader:
    1) Select source ShaderGraph file and then inside Inspector window click on Copy Shader button:
    upload_2021-3-27_0-11-0.png

    2) Now select Metallic (Cutout) shader (not ShaderGraph file) and from context menu choose Amazing Assets -> Advanced Dissolve -> Generate Shader option:
    upload_2021-3-27_0-19-51.png

    3) This will regenerate Metallic (Cutout) shader using currently used HDRP version.

    This way you can always update any shader included in the HDRP package.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Mar 26, 2021
    cygnusprojects likes this.
  46. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Works like a charm, thanks!
     
  47. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    Hi I'm struggling to import due to keyword limits, this asset is clocking quite high at 46. Will converting them to local keywords likely break the functionality?
     
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Shader keywords are explained in Manual file page 29.
    This is the only difference and limitation related to the Unity 2018.4 version.



    Amazing Assets - YouTube Facebook Twitter
     
  49. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    I am using 2019.4.17f and I am still seeing Max number (256) shader errors when importing. Not sure unity is handling it correctly. Should I not see any errors? Thanks

    Not to worry I managed to squeeze it into the project anyway. :)
     
    Last edited: Apr 23, 2021
  50. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Did you just upgrade project from Unity 2018.4 to 2019.4? If yes, then there may be such errors as shader keywords in that project was used as Global.
    In fresh Unity 2019.4 project there should not be such problem.



    Amazing Assets - YouTube Facebook Twitter