Search Unity

[Released] Deformable Surface

Discussion in 'Assets and Asset Store' started by V0odo0, Nov 20, 2016.

  1. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328

    Requirements: DX11 & Shader Model 5.0 support


    This asset allows you to create and manage the system with realtime volumetric surface deformation. You might already noticed similar feature in some AAA titles. Such feature will definitely make your game more dynamic and realistic looking. To achieve the best performance it uses true power of compute shaders along with DX11 hardware tessellation.
    • Edit surface with brush or import heightmap. Just like Unity built-in Terrain
    • Well-configurable. Mesh size, map resolution, blend height, deformation smoothing, speed, layer mask and tesselation settings
    • Well-optimized. Let GPU deal with it!
    • Deformation state save / load and physics implementation
    • PBR shaders



    > v2.0
    New:
    * Access to save/load the state of deformation
    * New additional shader: Standard Cutout
    * Quad patch tesselation
    * Heightmap import
    * New parameters: Normal Intensity, Max Height
    * Custom shaders are now allowed
    * All texture maps combined into one ARGB32 format
    * Linear color space support
    * Unity 2018.3 support
    * Overall performance improvement

    Fixes:
    * Incorrect base mesh normals
    * Deformation smoothing is not affected at top height
    * Odd deformation and smoothing at top-right edges of base map
    * Performance issue in painting mode
    * Surface double-rendering issue caused by depth camera
    * Various minor fixes

    > v1.1.2
    * Fixed bug where the whole surface has been deformed at scene start
    * Fixed issue with incorrect lights in Unity 2017.2 and above

    > v1.1.1
    * Fixed issue with SetTexture failed and normal map generation for newly created surface

    > v1.1
    * Metallic Smoothness texture slot was removed. Alpha value of Albedo texture map is now used as a source for smoothness
    * Inverted version of depth camera shader for Unity 5.5 was removed. Shader directive is now handle this
    * Added maps quality setting which allows to save some VRAM almost without quality loss
    * Editor side compute shader logic moved to separate .compute file
     
    Last edited: Dec 21, 2018
    Alverik, LudiKha, DevMember and 3 others like this.
  2. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    I am currently using RTP terrain shaders, does your shader integrate well into other shader packages? Or does your shader have functionality comparable to RTP?
     
  3. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi. My shader has no compatibility with other assets. Deformable surface is a separate object with its own mesh and collider, but you can cover your terrain with this surface in one click. It is not a perfect solution, but manipulating with texture tiling and position will make it look like the surface is a part of the terrain.

    Currently I can't tell if I can implement all RTP visual features in this asset. RTP is a great asset and it has much more advanced terrain shader than Unity bult-in terrain has.
     
    yc960 likes this.
  4. doug-in-a-box

    doug-in-a-box

    Joined:
    May 20, 2015
    Posts:
    7
    hey, absolutely amazing asset and I was wondering if you were going to make your "surface physics Sphere" script work directly with the unity wheel collider? because at the moment I'm finding it impossible to make them work together.
    thanks for all your work to make this asset.
     
  5. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi, thanks!

    SurfacePhysics scene is just a showcase of how to get offset value at given point. Then you can use this value however you want. It is clamped between 0 and 1.

    I don't know how exactly wheel collider and other things is configured in your project. You could limit the angular velocity, damping ratio, maximum velocity of the whole object etc. There is no unique approach, so this thing is up to you.
     
  6. doug-in-a-box

    doug-in-a-box

    Joined:
    May 20, 2015
    Posts:
    7
    ok thanks anyway though
     
  7. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    529
    thanks for your works, it's kind of part i was needing for my project.
    but i need it to be tilelable and if it works nice in terms of memory, it's not good due to the normal map

    Screenshot at 2016-12-23 14 17 28.png
    and when i hit play the mesh is deformed along the surface normal to a 45° angle certainly:
    Screenshot at 2016-12-23 14 18 32.png

    is it possible to check about it ?

    also another thing is about the material, wich is wimple but maybe to much simple, and would be nice to being able to mix our own shaders to get better results, don't know if you can do it
    Screenshot at 2016-12-23 14 56 51.png
    thanks
     
    Last edited: Dec 23, 2016
  8. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi.

    I don't recommend to use the surface as a tile part. Currently there is no way to make it seamless cause distanced tesselation method will render it incorrectly.

    Those deformations at top-right corners comes from compute shader. It is reading all neighbour pixels so it goes out of bounds by one pixel of the heightmap in that place. I've noticed this before release but leave it as is due to optimization reason.

    What about material is that there is no way to write a simple surface shader for it. Applying tesselation in surface shader will not allow to use custom in-out structs. For sure that's kind of dumb limitation. So in order to change the shader by your needs you should learn how vert-frag shader works. It's may be painful but not impossible :)

    Anyway, currently I'm working on v1.1 and will see what I can do with all of this.
     
  9. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    v1.1 is here!
    * Metallic Smoothness texture slot was removed. Alpha value of Albedo texture map is now used as a source for smoothness
    * Inverted version of depth camera shader for Unity 5.5 was removed. Shader directive is now handle this
    * Added maps quality setting which allows to save some VRAM almost without quality loss
    * Editor side compute shader logic moved to separate .compute file
     
  10. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi V0odo0!!

    I am interested in your asset but I have some doubts about whether I will get the results I want.
    Could you pass a trial version of your asset to test it thoroughly before buying?

    regards
     
  11. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi. Unfortunately there is no light or trial version. But you could ask me what you are interested regarding to this asset.
     
  12. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi
    Ohh! what a pity!

    Well my doubts, as I said, are related to what level of visual detail will come to show on the scene, if the material that uses your shader I put textures 2k, 1k, etc. Both in the near and in the distance.

    Also performance theme ...

    Other doubts are how I can shape the mesh that uses its shader, so that it will fit well to the irregularities of my terrain. For example, I am creating an island and I especially want to be active for the theme of treading on beach sand and other sites.

    Another problem I have read above is that it does not support RTP and I work with RTP. For me it is absolutely essential to be able to use your asset and RTP together. Which leads me to have to experiment and test with your asset to see if that is possible for me. That's why I asked for a trial version.

    I would also like to try more things to see if your asset meets my expectations.

    Is there really no possibility of testing your asset before you buy? I would be very grateful since I am very interested in your asset, but I do not want to spend the money so that later it does not meet my expectations

    regards
     
  13. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    As I wrote above, deformable surface is a separated object with it's own mesh and material. So it does not matter if you using RTP or Unity built-in terrain. Terrain alignment is just a small feature that copies terrain heightmap data and pastes it to the surface. The shader itself working in conjuction with compute shader and not suitable for terrain.

    Note that there is no texture paint feature cause masking will cost much more memory then. You only able to change the geometry and choose only two types of textures with normal maps. One for the bottom part and upper for other. For example, the snow texture and the dirt under the snow texture.

    Look at the 2nd video on Asset Store page. It has a demonstration of terrain alignment feature.
     
  14. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    ok. I see it. Thank
     
  15. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Another question...

    I want it for a very large island, but only for the whole sandy beach area. In the video you told me, I see that it adapts well to the terrain vertically (Y axis) ... But what happens when you have to adapt the mesh to the turns (left / right) that has a coastline ?

    I suppose you will have to create many "deformable surfaces" with your asset and place them properly ... But then what performance would you have with many meshes of your asset in the terrain?


    Greetings.
     
  16. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    375
    Is there a physics implementation on this yet?
     
  17. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    I´ve been trying your asset but every time that a deformable surface is added to the scene I get this error message:

    UnityException: SetTexture failed
    DeformableSurface.InitBlurWeights () (at Assets/DeformableSurface/Scripts/DeformableSurface.cs:153)
    DeformableSurface.Init () (at Assets/DeformableSurface/Scripts/DeformableSurface.cs:116)
    DeformableSurface.Awake () (at Assets/DeformableSurface/Scripts/DeformableSurface.cs:99)

    Is it working with Unity 5.4.2 or 5.5.1?

    Cheers (and good job, it seems to be really useful!)
     
  18. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    I found a workaround. I need to change (using the Editor debug mode) the scriptable object "New Deformable Surface" value for the SurfaceKernels from SurfaceKernelsEditor to SurfaceKernels.

    It´s working, but it´s annoying to change everyone manuallly.
     
    V0odo0 likes this.
  19. SeaScout

    SeaScout

    Joined:
    Mar 23, 2016
    Posts:
    6
    Hi there, I bought your deformable surface asset from the Unity asset store and am having some issues getting it to work. I am not able to get newly created deformable surface to deform.

    In Unity 5.5.0f windows 10, if I create a deformable surface and press play I get this error:

    UnityException: SetTexture failed
    UnityEngine.ComputeShader.SetTexture (Int32 kernelIndex, System.String name, UnityEngine.Texture texture) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/ComputeShaderBindings.gen.cs:74)
    DeformableSurface.InitBlurWeights () (at Assets/DeformableSurface/Scripts/DeformableSurface.cs:153)
    DeformableSurface.Init () (at Assets/DeformableSurface/Scripts/DeformableSurface.cs:116)
    DeformableSurface.Awake () (at Assets/DeformableSurface/Scripts/DeformableSurface.cs:99)

    No game objects will deform the newly created surface. The demo scenes work as expected. Game objects I create will deform the demo scene surfaces as expected, it is just newly created surfaces that do not work.
     
  20. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    Is it possible to add a new feature to the plugin? I´d like to add snow to a mesh. I know that it´s possible to add snow using a heighmap
     
  21. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Guys! There was a problem with SetTexture error and normal map generation for newly created deformable surface. Hotfix will be on Asset Store very soon. Thanks for patience.

    As BonsaTech already said you could fix it by manually assigning SurfaceKernels and Depth Texture shader to Surface Data in inspector Debug mode.



    I suppose you interested in custom shader for your objects? If that, you could find some nice snow shaders on Asset Store.
     
  22. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    I´d like to add a deformable snow mesh to my driving scene, but only to the road, not to the terrain. This is the main reason.
     
  23. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Currently Deformable Surface shader is not suitable for this purpose. But yes, it is possible to implement such deformation feature to custom meshes with technique I've used in this asset. Will see what I can do with this.
     
  24. CyberFoxGameStudioBahamas

    CyberFoxGameStudioBahamas

    Joined:
    Mar 3, 2017
    Posts:
    5
    i bought and added your asset to my scene but when i build a universal windows build it disappears on pc and xbox one. any idea
     
  25. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi. Xbox One support is disabled in shader by default. You should remove the xboxone tag from each #pragma exclude_renderers line of code in DeformableSurfaceStandard shader.

    Be sure that your target platforms supports DirectX 11.
     
  26. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    We need RTP support... The depth then also should based on what texture the vehicle is. WoT has a kind of your variant. But partially placing meshes for deformation on a nearly flat terrain, which then should look like the mixed RTP texture needs too much effort.
     
    ftejada likes this.
  27. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Hi, I am interested in this asset! Can I ask, can you save the deformations to disk to load at later stage again? I think it might be called serialisation perhaps? Thanks.
     
  28. cdiaz

    cdiaz

    Joined:
    Aug 1, 2012
    Posts:
    6
    Hi! I have been messing around with the plugin for a few days, and I need two features that should be easy to achieve through your plugin.

    First, I want to be able to "throw" soil/snow just as you are able to do with the editor script and a brush. I am finding it hard to separate that functionality and leave it as a public method in the Deformable Surface script that can be called from other parts of the code RT.

    Also, I need to "smooth" the borders after "digging", since they end up too sharp. I have an smoothing algorithm on my own that works wonders, but Im not familiar with shaders programming to bring it there.

    Thank you
     
  29. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Just wondering, if you look at this video of a game I'm making
    at around the 2 minute timepoint, is this what you mean, you want to achieve something like that?
     
  30. cdiaz

    cdiaz

    Joined:
    Aug 1, 2012
    Posts:
    6
    Well, more or less, I do need to digg but that could be easily achievable using the tools already provided bu Deformable Surface. Im way more interested in "throwing" soil and crumbling borders.
     
  31. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    I'm sure sure what you mean when throwing something that probably means you have to instantiate some prefab you made... e.g. particle system that renders meshes, that I how I did mine :) hope that helps you.
     
  32. cdiaz

    cdiaz

    Joined:
    Aug 1, 2012
    Posts:
    6
    Not at all, tbh. I need to deform the mesh the way its done in the editor mode of Deformable Surface.
     
  33. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    It is not about serialization In this case. Deformation data comes from heightmap which is just one channel texture stored as asset in your project. This texture reads by DeformRt render texture at start in DeformableSurface component. In short, you could save this render texture as an image and load it back trough Graphics.Blit when it's needed at runtime.
     
  34. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Cool, thanks!
     
  35. Coltenney

    Coltenney

    Joined:
    Mar 10, 2015
    Posts:
    25
    Hi, I am wondering if this would play nicely with a voxel based terrain like Voxeland? I am concerned that because the voxel mesh can change during runtime that this might cause incompatibilities.
     
  36. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    I'm afraid it will not fit in the voxel like dynamic world. Base heightmap of the surface cannot be changed during runtime. Only deformable part.
     
  37. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hey, since unity 5.6 tessellation seams to work also on mac with metal support - do you have an idea if you stuff is also working there?
     
  38. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi. Yeah, since 5.6 compute shaders become supported on metal. It's about time to add Mac support but can't tell when it happens.
     
    Der_Kevin likes this.
  39. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
  40. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    I´m adding more screenshots to explain the issue:

    5.4
    54.jpg

    5.6
    56.jpg
     
  41. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi. I've just also tried to upgrade my project from 5.4 to 5.6.2 and got the same results as yours. Looks like some changes between 5.6 and 5.6.2 is the cause. I'll figure it out soon. Thanks.
     
  42. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    It seems to be related to the render texture types when you copy from one to another, but not sure how to fix that.
     
  43. virendravishth

    virendravishth

    Joined:
    Sep 12, 2016
    Posts:
    7
    Hi,
    It is nice plugin. I want to ask a question. Is it possible to use your plugin to simulate a kind of fine drilling operation on a material for example drilling out a smooth hole on a small metal/wooden piece. Can we use our own material/color etc. Please clarify as we are interested your plugin if it can do above...

    Thanks...
     
  44. nikita12

    nikita12

    Joined:
    Jul 26, 2017
    Posts:
    1
    Please, help! I bought an asset and my brush draws a strip on the whole area! What should I do?
     

    Attached Files:

  45. burtles

    burtles

    Joined:
    Dec 23, 2016
    Posts:
    7
    Also, lighting is broken with the new update. If you make a new project, add a deformable mesh, then add a point light and move the point light close to the surface of the deformable mesh you will see that it "cuts off" part of the light for some reason.



    Another thing. You said in a post above that it was possible to save the render texture to disk. I bought this asset assuming I could, but at this point I've concluded it's not possible. Getpixel does not work on the RFloat texture format, so there is no way to extract the floats from the depth texture. There is also no way in unity to save a float texture, or convert it to a saveable format. If there is actually a way I'd love to know how.
     
  46. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    v1.1.2 is now available on Asset Store!

    * Fixed bug where the whole surface has been deformed at scene start
    * Fixed issue with incorrect lights in Unity 2017.2 and above
     
  47. satolas

    satolas

    Joined:
    Feb 13, 2017
    Posts:
    21
  48. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Hi. Yes, it is possible. Take a look at SurfacePhysicsSphere script in Example folder.
     
  49. satolas

    satolas

    Joined:
    Feb 13, 2017
    Posts:
    21
    Hi VOodoO,
    I looked at the exemple.
    The problem is that the ball is going slower but the ball position is not affected by the surface.
    In other words if ballA goes on the trail made by ballB the ballA will not be affected by it in the position, just the speed.

    I think could be nice to find a trick to make the heightmap also affect the position of the object.
    And maybe it takes less memory than reshaping the mesh in real time (tesselation).
    If you have an idea to achieve that "interraction" let me know :)

    By the way I like the trick you made to make the ball move slower when there is more material into the surface. (SurfacePhysicsSphere.cs)

    Best Regards.
     
  50. TareqProjects

    TareqProjects

    Joined:
    Jun 27, 2016
    Posts:
    55
    Hello V0odo0,

    Hope you can clarify a few things;

    1. When the mesh is deformed, does it also deform the physics? If I were to dig a hole in the terrain/mesh, would an object be able to fall into it? (noticed the car going along the terrain)
    2. Is the deformation a set amount or is it additive? Can I repeated deform a single spot for however long I want?
    3. Would it be possible to raise the terrain?
    4. How big of an area could I have before I see any noticable performance hit?

    edit
    One last thing, can i make it so that only certain gameobjects can deform the terrain?

    thanks