Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[DEPRECATED] Terrain Pressure Paint - Paint terrain with your pressure sensitive stylus inside Unity

Discussion in 'Assets and Asset Store' started by steego, Feb 26, 2015.

  1. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Terrain Pressure Paint is an editor extension that allows painting on terrain with a pressure sensitive input device, like a Wacom tablet and pen.

    It allows you to use pressure control for:
    • Raise/Lower - Brush Size and Opacity
    • Paint Height - Brush Size and Opacity
    • Smooth Height - Brush Size and Opacity
    • Paint Texture - Brush Size, Opacity and Target Strength
    • Paint Details - Brush Size, Opacity and Target Strength
    • Place Trees - Brush Size and Tree Density
    You can easily select which variables to control with pen pressure, and adjust minimum and maximum values.

    Get it on the asset store now: http://u3d.as/bK7
     
  2. burtonposey

    burtonposey

    Joined:
    Sep 8, 2009
    Posts:
    59
    Just got this tonight. Really digging it so far. Takes a few minutes to get used to, but it doesn't step on the toes of the existing terrain tools and complements them. Great job!
     
    steego likes this.
  3. CplMulder

    CplMulder

    Joined:
    May 12, 2014
    Posts:
    50
    Will this work with the pressure sensitive pen on the Surface Pro 4 ?
     
  4. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    I'm afraid I don't have a Surface Pro to test with, but I believe it should work as long as you have installed the optional wintab drivers for it, as the plugin uses the wintab interface.

    If you want to test it out, and it turns out it doesn't work, just send me a PM with the order number and I will arrange for a refund.
     
  5. jm999

    jm999

    Joined:
    Feb 10, 2014
    Posts:
    5
    Hi, the README link on the asset store page seems to be broken. Does this plugin work on OSX?

    Also, it looks like source is included, do you think this could be adapted to work at runtime?
     
  6. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Yeah sorry about that, I hope to have it back up in a few days.

    Yes it works on OSX.

    It probably could, but only on Windows. The reason is that on OSX it gets the pressure from the Unity editor, while on Windows it uses the WinTab interface.

    EDIT: It's possible to do the same at runtime on OSX of course, through a native plugin. If this is something you need, I have some sources with a small test case for it that you can have a look at. It's really rudimentary though, so no warranties.
     
    Last edited: Mar 31, 2016
  7. jm999

    jm999

    Joined:
    Feb 10, 2014
    Posts:
    5
    Thanks for the info! I just bought your plugin and it works great on OSX. Painting terrain with pressure feels great.

    It looks like Event.current.pressure works in OnGUI at runtime too, as long at the EventType is MouseDrag.

    Do you know if Wacom tilt values are available too?
     
  8. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Thanks for the purchase! Tilt values are not available in Unity, you'd definitely need a native plugin for that.
     
  9. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    Can you do an update for the latest unity version? thanks
     
  10. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    I'm working on an update for 5.6, I'll have it available shortly.
     
  11. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    Great thanks for the heads up!
     
  12. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    The update for Unity 5.6 is now live on the asset store.

    It also includes a new feature to control height of placed trees with pen pressure.
     
    Lars-Steenhoff likes this.
  13. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    50
    Hi, I got some issues.

    1. Pressure slider doesn't work, even with tablet off.
    2. Toggle "Size" doesn't save its value.
    3. Sliders Opacity & Target Strength in terrain settings falls to zero every time I select texture to paint, so no painting in result.

    What can I do, help please?
     
  14. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Hi, can you tell me which OS, Unity version and tablet you are using?
     
  15. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    50
    I have Windows 8.1, Unity 5.6.3.p2 and tablet Genius EasyPen i405X
     
  16. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    Can't get this to work at all :( When I open the window it either hard freezes Unity or crashes it.

    Windows 7 Enterprise SP 1
    Unity 2017.2
    Wacom Intuos 5 Touch (though there are a few different versions of Wacoms here I could possibly test with if needed)

    Any thoughts?
     
  17. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    Some debugging it looks like it has to do with the closing of the context in OnEnable. If I comment that out it doesn't hang.
    EDIT: Actually any call to CloseContext causes the hang, whether it is in OnEnable or OnDisable or OnDestroy, any of those calls to CloseContext causes the editor to hang. Same if it gets called as part of the assembly reload process.

    Appears to be hanging waiting on a response from WinTab. If I unplug the tablet it will error our/timeout an unfreeze.
     
    Last edited: Dec 15, 2017
  18. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    Further debugging leads me to the Application.Exit() call in MessageEvents.Close()

    If I comment that out everything works fine within normal use, opening/closing the window, painting, etc. However Unity will lock up when A) Exiting, or B) Reloading assemblies
     
  19. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Do you have the latest drivers for the tablet installed?

    It sounds like it doesn't fire any events through the WinTAB interface that this plugin uses, which most likely means that the tablet is not supported I'm afraid, and I don't have a Genius tablet to test with myself.

    Try updating your drivers, or see if you can find something like the "optional WinTAB drivers" that exists for the Surface Pro, mentioned earlier in this thread.

    If you can't get it working with your tablet, feel free to request a refund and I'll be happy to accommodate.

    This is because there are no pressure events received, and the pressure is set to zero by default. I'll release an update to fix this, but it won't help your situation as no pressure events are registered using your tablet.
     
  20. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Would you be happening to use the new .NET 4.6 runtime in your project? If so, do you see the same issue when using 3.5?
     
  21. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    We would be yes, and I think we have to but I will try to test it out with 3.5 on Monday and see if that changes anything.
     
  22. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    50
    I don't want to refund, I want to paint terrain with pressure pen :) My tablet works well with pressure in GIMP or Krita, but I'll try to update drivers anyway.
     
  23. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    I recommend to change the tablet for a wacom, that will fix your issue.
     
  24. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    50
    After reinstalling drivers, my tablet paints a terrain like an ordinary mouse - with size, target strength and opacity. But pressure is out only.
     
  25. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    I'm fairly certain this is the issue. For now what you can do is delete the following files:
    • Assets/Plugins/FreakshowStudio/TerrainPressurePaint/Editor/Plugins/System.Drawing.dll
    • Assets/Plugins/FreakshowStudio/TerrainPressurePaint/Editor/Plugins/System.Windows.Forms.dll
    Then put the attached mcs.rsp file from this post in your Assets/ folder.

    The reason for this is that the included files are compiled for .NET 2.0 and won't work with 4.6, you would need the same files for 4.6 to work.

    Using the rsp file instead, you should get the correct assemblies for the runtime version you are using, but note that this will not work for .NET 2.0 subset, as that profile doesn't include the necessary assemblies.

    You could also copy over the .dll files for 4.6 from Editor/Data/MonoBleedingEdge/lib/mono/4.5 to replace the included ones.

    I'll try to fix this in an update as well, but I have to ponder the best way to do it. mcs.rsp is a file potentially used by the whole project, so I'm not sure it makes sense to include it with the asset, and it also affects player build.
     

    Attached Files:

    • mcs.zip
      File size:
      193 bytes
      Views:
      28
  26. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Yes this is consistent with no pressure events being received, I'm afraid your tablet is not supported then.
     
  27. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    Ah yes that makes sense. I got so tied up in the specifics that I didn't stop to consider that.

    Given that they are just system DLLs, shouldn't I be able to just replace them with standard versions from 4.6? Never ran into .RSP files so I admit to not knowing what that is, but I'll do some research.
     
  28. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Yes you could just replace them with the ones included with Unity, they should be in the folder Editor/Data/MonoBleedingEdge/lib/mono/4.5

    mcs.rsp is a response file for the compiler (mcs). It's basically just extra command line parameters for the compiler. The one I posted includes the flags -r:System.Drawing and -r:System.Windows.Forms which tells the compiler to reference these when building.

    Using response files is the recommended approach going forward, as it will handle both (and possible future) runtimes. It is a bit inflexible though, as you can only have one per project as far as I can tell.
     
  29. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    50
    How it can be? My tablet draws with pressure in any other software.
     
  30. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    So deleting the included DLLs and adding the .rsp file doesn't seem to fix it. No errors in Unity (which implies it is loading the assemblies), but the same behaviour of completely freezing the editor when trying to open the window.

    I then tried copying over the DLLs specifically from both MonoBleedingEdge 4.5 and 4.6-api and in both cases for some reason Unity just gives an error saying it couldn't load them.
     
  31. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    After refactoring our code to work in the older Mono 2.0 environment I see the proper behaviour. Not sure why I can't get it working in 4.6 though :(
     
  32. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    The other software probably relies on system messages to get at the pressure, while this plugin just uses the WinTAB interface. Most, but not all, tablets will be WinTAB compatible.

    Have you tried using the plugin in an empty project?
     
  33. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    After adding the RSP file, could you try to make sure the code is re-compiled? Just add a new blank line in TerrainPressurePaint.cs or something?

    I'd also advice that you try in an empty project first, just to be absolutely sure there isn't anything else in your project interfering with it.

    With the RSP file it works fine for me here on 4.6.

    You can also just keep the offending lines commented out, you'll be leaking processes every time you close the Terrain Pressure Paint window, but they should be closed when you exit Unity.
     
  34. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    50
    Yep, with the same result.
     
  35. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Ok, then I'm sorry but I don't have access to a Genius tablet to test for myself, so I can only assume that it is not compatible.
     
  36. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    357
    I've still been unable to get this working with 4.6

    I started a blank empty project in Unity 2017.3f3 today, then imported the mcs.rsp file. I then imported TerrainPressurePaint (and unchecked the two DLLs so they did not import).

    Then into Window->Terrain Pressure Paint and it immediately freezes the editor.

    The project was completely blank except for that.
     
  37. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    323
    Does this only work with the native Unity terrain tools or is this also compatible with other brush-based terrain editing tools available in the Asset Store such as Terrain Former and/or Terra Brush?
     
  38. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    It only works with the native Unity terrain tools I'm afraid.
     
  39. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    323
    Ok, thanks for the reply!
     
  40. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    50
    Now I got a Wacom tablet and a Linne crater becomes real ) terrain paint pressure Linne.JPG
     
    Lars-Steenhoff and steego like this.
  41. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    I had some trouble to get it to work in the latest unity 2018.3b on the mac, the wacom did not have pressure. can anyone test if it works for you?
     
  42. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    I'm sorry to say that this asset has now been deprecated. The changes to the terrain system in 2018.3, coupled with the update of .NET, makes the update to big to justify for the low number of sales I'm having.

    I've submitted an update making the asset free, for anyone who wants to use it with an older version of Unity, but it will not receive any further updates. You can still edit your terrains in an older version and then bring them into the new version if you don't mind the extra steps.

    If you have purchased the asset recently and feel let down that it's now free, please feel free to request a refund.

    Sorry about that @Lars-Steenhoff and everybody else.
     
  43. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    Can you, if you know, tell me what steps I need to do to make it run on the Mac? in 2018.3 , because I thought that pressure was supported native on Mac without the need for dll's
     
  44. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Yes the pressure should be supported, I'm not sure if Unity has changed anything in that regard though. Do you get anything in the blue sensitivity bar in the plugin? If that one registers the pressure then it is detected as it should.

    If you get pressure info, it's only a matter of feeding this to Unity. What the plugin does is change some values in the terrain inspector, and some in the terrainData struct if I remember correctly. You would have to change this to match the new terrain inspector, you can find the fields you need to change either by looking at the sources, if 2018.3 is available yet and they have the source for the terrain inspector there, or as I did by decompiling the UnityEditor assembly.
     
  45. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    Sorry I was mistaken, in 2018.3 on my Mac it all works just fine. I can paint with pressure on the new terrain!
     
  46. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    Please keep the tool for sale and don't deprecate it for Mac users at least
     
  47. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    Oh okay, that's good then. It'll still be available, only with a notice that it's not maintained and with a price of zero.
     
    Lars-Steenhoff likes this.
  48. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    Thanks, just I would change the wording Depricated to something like No longer maintained , normally on the asset store Depricated means it no longer available.
     
  49. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,699
    Can I ask one thing even now that you don't have time to support it....
    Please have look at the latest unity alpha, do you know how I can fix this error?

    https://unity3d.com/beta/2019.1

    NullReferenceException: Object reference not set to an instance of an object
    FreakLibEditor.TerrainPressurePaint.TerrainPressurePaint.OnSceneGUI (UnityEditor.SceneView sv) (at Assets/Plugins/FreakshowStudio/TerrainPressurePaint/Editor/TerrainPressurePaint.cs:393)
    UnityEditor.SceneView.CallOnSceneGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2917)
    UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2160)
    UnityEditor.SceneView.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2021)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:365)
    UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:359)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:333)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:351)
    UnityEditor.DockArea.OldOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:310)
    UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:249)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  50. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    857
    I don't have time to look at it now, but what line of code is

    Assets/Plugins/FreakshowStudio/TerrainPressurePaint/Editor/TerrainPressurePaint.cs:393 ?