Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

Terrain Mesh Blending

Discussion in 'Assets and Asset Store' started by IllusionLoop, Nov 27, 2015.

  1. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    [Removed] Terrain Mesh Blending
    Edit: removed from store. Original post below:

    This tool allows you to blend objects with terrains, without having to paint the terrain texture onto them.
    It supports the built in terrain shaders: standard, legacy diffuse, legacy specular.
    With the included source code and manual, you can modify many shaders to blend with terrains.

    WebDemo: www.illusionloop.com/main/webdemos/tblend/demoterrblend.html
    Asset Store: http://u3d.as/gRF
    Documentation: www.illusionloop.com/docs/terrainmeshblending.html

    screenshot 1.png screenshot 7.png
     
    Last edited: May 7, 2020
    DevMember likes this.
  2. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    403
    Please explain how this works. I couldn't find any explanation in store page.

    Does it require to add a custom shader to objects that will blend?

    Does it work with shader model 2?

    Draw calls? Will objects get batched(with dynamic batching) if this is applied?

    Do you recommend it for mobile devices? In example, for lumia 520?

    Thanks.
     
  3. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hi,
    This tool creates a heightmap of the terrain and uses it in custom shaders to blend objects with a terrain texture defined in its material.
    The included shaders/materials work with the built in terrain shaders.
    The blending effect is achieved with an extra pass, that you can add to many other shaders.

    Static batching should work, i don't know, how unity handles dynamic batching. Why do you need moving + terrain blending objects?
    I created a scene with 34 static concrete pipes using the bumped diffuse blending shader. They use 21 batches and 17 with the regular bumped diffuse shader.

    I set the target to shader model 3, but the bumped diffuse shader should work with shader model 2, if you change it in the shader. I will do this in an update.

    I wasn't able to test it with mobile devices yet, but it should work. However, unitys terrain is quite performance heavy and they do not recommend it for mobile use. The Lumia 520 should be able to render terrains, but it will take up a lot of performance depending on how many textures you are using.
    You can also only create the blending effect with a terrain and replace it with a mesh. The blending will still be there after disabling the terrain.
    I'm currently working on a mobile terrain system, also with object blending.

    I hope this helps
    - Lucas
     
  4. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    691
    Hi,
    Your tool looks great, and hard to find on the store, not a lot of "blenderToll", do you think of a possible compatibility since U4?
    lol...
    I'm using 4.3.4 and would need such a tool if it's no performance killing
    Thanks
     
  5. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    hi, i think thats possible. I'll submit a version, but it might take a while.
     
  6. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    691
    hi, Thx for the reply!

    I have a huge world and i'm thinking of a lot of meshes as mountains (big rocks actually) and if i can blend 100 meshes with a low performance impact,..... i would be much interested....lol

    What do you mean by "a while": few months? a year?....lol
    peace out
     
  7. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    A few weeks, i have to install unity 4, build the scene again and it usually takes about two weeks until the package is online.
     
  8. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    691
    Hi,
    ok, it sounds pretty cool!!!!
    can't swear i'll buy it, but if you do that i'm sure you'll get more sales thanks to the retro compatibility. We are a lot using Unity4 and to my opinion great tools have a huge compatibility radius Like Terrain composer. Believe me i'll be checking your tool man. 7box is a cool price.
    The only option to get a blending tool at this price is ATS shader 10 dollars and RTP shader 35 doll.

    Thanks man
    peace out
     
  9. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    723

    I'm glad you did this,I asked on Facebook,Thanks Laxer! I do own this tool, great tool so far,!
     
    IllusionLoop likes this.
  10. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    723
    it works with mobile just fine.
     
    IllusionLoop likes this.
  11. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Thanks for your feedback Recon03, great to hear that :)
    Also thanks for testing it on mobile
     
  12. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hi, i tried to rebuild this project in Unity 4, but it seems to be impossible. The shader syntax seems to be different in Unity 4 , so none of the blending shaders will compile. I get a ton of errors like "bad characters at line 0" or "syntax error at line 0" because back in U4 shader errors were buggy. Im sorry, but it just won't work in Unity 4 :/
     
  13. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    691
    Hi,

    Too bad! but many thanks for trying! i really appreciate!
    Maybe i should really upgrade to U5...lol
     
  14. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    Any idea if this could be made to work with a custom terrain shader such as Distingo?
     
    Olafson likes this.
  15. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    252
    +1 on making it work with Distingo! Would be a big plus.
     
  16. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    The problem here is, that i'll have to include code from distingo and i'm not allowed to do that. Another problem is, that there are a lot of custom terrain shaders, that change with every update and it takes a lot of time to understand and convert these shaders. So i'm not able to support custom shaders.

    I'm trying to find a global solution, that blends with any terrain shader, but this is also not an easy task.
    I'll post updates here.
     
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    Thanks for the info.
     
  18. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Update: fixed specular blending shader
     
    Last edited: Apr 2, 2016
  19. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    I just managed to render meshes with terrain shaders. This might be a step towards a system, that blends meshes with any shader and terrains with any shader. (Image or it didn't happen):
    prev01.png

    I'm also working on a system, that blends object with a terrain-mesh (like Terrain to Mesh)
     
  20. MinhDao

    MinhDao

    Joined:
    Oct 28, 2013
    Posts:
    155
    Hi Laxer,
    I have one question! Can it blend two mesh object instead of Terrain. I don't want use terrain because of performance on mobile.

    Thank you!
     
  21. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hi MinhDao,
    I'm working on this functionality, but it will only work with objects similar to terrains( like Terrain-To-Mesh generated Objects)
    With the current version, you could also create the blending effect with a terrain and replace that terrain afterwards with an object, that looks like the terrain. The blending effect will still be visible, because it is baked.
     
    MinhDao likes this.
  22. MinhDao

    MinhDao

    Joined:
    Oct 28, 2013
    Posts:
    155
    Thank you. It work great. Just tested on nexus 4 and it run 60fps
     
  23. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    I bought this recently and it didn't work at all for me. I haven't had a chance to dig deeper or report the issue, but I simply added the asset to my project and opened and ran the demo scene. I didn't see any compile errors or warnings, but there was no blending visible anywhere in the scene. I'm going to need this tool working so I will try again and report more details. Has anyone else not got this to work?
     
    M_R_M likes this.
  24. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hi,
    depending on your lighting settings, you might have to refresh the blending.
    In the demo scene, simply select the terrain and click the update blendmap button of the attached script.

    The script uses different settings for linear/gamma rendering. If you click that button, it changes these settings automatically and the blending should work.
     
    Last edited: Jun 30, 2016
  25. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    Excellent. I will give that a try tonight and let you know how it goes.
     
  26. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    I know it's been a long time, but I finally got back to this and I tried your advice on clicking the update blendmap. I saw that a Blendnormalmap was added after that happened, but I still don't see any blending in the scene. Here is a screenshot.

    upload_2016-10-28_18-56-51.png

    I'm using Unity 5.3.2p6. My rendering is Forward/Linear. And I have lighting as Precomputed GI only.
     
  27. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Hi magique, I just created a new project in Unity 5.4.2p2 (Mac El Capitan), using default Forward/Gamma with default lighting (precomputed GI + baked) and it works OK

    Forward/Gamma



    If I switch to Forward/Linear then the blending doesn't work.

    Forward/Linear

     
  28. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    Did you also click the update blendmap button after switching? I did that, but I wanted to make sure you had as well. If so then it appears this doesn't work with Linear colorspace.
     
  29. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Sorry been a while since I've used this asset as well... after clicking update blendmap it does have some effect but no where near as good as the blending in Forward/Gamma

    Forward/Linear (after update Blend Map)

     
  30. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hi, radimoto and magique,
    If you go to the terrain blending materials, there is a color correction property. In linear rendering mode, you might have to set it to about 189(channels rgb, in gamma mode 128), then blending should work again. I will update the package and add an option to automatically adjust the color correction.
     
  31. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    606
    Any progress on the shader-independent blending?
     
  32. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    y, i was able to embed meshes in terrain, but there is much more to do. currently it is not user friendly at all. I also need some more terrain shaders for testing.
     
    Last edited: Oct 31, 2016
    one_one likes this.
  33. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hi, in case you didn't receive my last post,
    did you already try changing the color correction of the materials? Please read my previous post (#30). This should fix it.

    +edit:
    I will upload a new version in a few days, that will have an option to do this automatically.
     
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    I missed this post so sorry for not responding back sooner. Thanks for the tip. I'll give it a try this weekend and let you know if it fixes the issue for me.
     
  35. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    The latest version is now online!
    Color correction now adjusts automatically to linear / gamma rendering.
     
    antoripa likes this.
  36. l8njacobs

    l8njacobs

    Joined:
    Dec 12, 2016
    Posts:
    5
    Nice.. Will this plugin work to blend meshes with World Composer terrain and Relief Pack?
     
  37. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    This Plugin is meant for use with the built in terrain shaders only. I cannot guarantee it's functionality with other shaders. Other shaders will probably not blend seamlessly. You can minimize the effect by using color correction, but the result will not be perfect.
     
  38. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
  39. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
  40. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    Ah, sorry - it's the asset described here:
     
  41. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    I think it is quite close to the single texture shader variant described in the video, with a few differences:
    The blending works automatically based on the height difference to the terrain. In the video it looks like per vertex blending. This asset blends per pixel and there is no painting option.
    Instead of adding a script to every object, you only have to add a script to the terrain and drop in the materials you want to blend. The blending has to be refreshed, after changing the terrain height or certain rendering settings (just click a button).
    That's all i can tell after watching the video.
     
  42. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    Great, that's really helpful info. Thanks :)
     
    Bapts likes this.
  43. Inigmas-Studios

    Inigmas-Studios

    Joined:
    Nov 2, 2015
    Posts:
    94
    I saw in a reply from the publisher (Laxer) on the asset store that this doesn't work on the newest version of Unity (beta included I'd assume as well). Has that been fixed yet?

    My team and I are using the beta version of Unity because of Unity Collab Beta, hoping that this wonderful plugin gets updated so we can use it in our project.

    Cheers,
    Graham Smith, Studio Director of Inigmas Studios
     
  44. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hi,
    technically it works with the newest versions. However, if you open the demo scene, the terrain is shiny and reflective. This is caused by changes to the terrain engine and can easily be resolved by setting the 'alpha source' of the terrain texture to 'none' (texture import settings).
    There will be a new version soon, which will have some new features and will be easier to use. I will adjust the price though.
    Kind regards,
    Lucas
     
    Inigmas-Studios likes this.
  45. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    702
    Hi there I noticed this plugin too, I never use Unity built in terrain, I always import my terrain as a normal model or use planes to shape my levels. Does this plugin work on normal models or does it only work on built-in Unity terrain?
     
  46. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,368
    @Laxer

    I was wondering this too. My terrains are almost all model-based.
     
    Last edited: Mar 10, 2017
  47. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Hello,
    unfortunately it is not possible to blend regular objects, because it is very difficult to get the correct texture location + normals etc.
    For correct blending you need a terrain or at least a terrain-based object and a deactivated terrain.
     
  48. IllusionLoop

    IllusionLoop

    Joined:
    Apr 11, 2015
    Posts:
    51
    Version 1.4.0 is now available!
    It now automatically adjusts texture position, size, metallic, smoothness, normals etc.
    There is also a completely reworked online-manual.
     
    DevMember likes this.
  49. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,942
    I tried this again on Wii U this morning and it worked perfectly and seemed to give decent performance. I might use this in my project.
     
  50. Gray_Master

    Gray_Master

    Joined:
    Jun 20, 2010
    Posts:
    152
unityunity