Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[Released] 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:
    827
    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:
    827
    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:
    827
    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:
    827
    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,550
    Can you do an update for the latest unity version? thanks
     
  10. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    827
    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,550
    Great thanks for the heads up!
     
  12. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    827
    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:
    48
    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:
    827
    Hi, can you tell me which OS, Unity version and tablet you are using?
     
  15. akareactor

    akareactor

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

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    333
    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:
    333
    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:
    333
    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:
    827
    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:
    827
    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:
    333
    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:
    48
    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,550
    I recommend to change the tablet for a wacom, that will fix your issue.
     
  24. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    48
    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:
    827
    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:
      12
  26. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    827
    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:
    333
    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:
    827
    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:
    48
    How it can be? My tablet draws with pressure in any other software.
     
  30. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    333
    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:
    333
    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:
    827
    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:
    827
    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:
    48
    Yep, with the same result.
     
  35. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    827
    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:
    333
    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:
    26
    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:
    827
    It only works with the native Unity terrain tools I'm afraid.
     
  39. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    26
    Ok, thanks for the reply!