Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Turbulence Library - Massive collection of complex and fast noise on the GPU

Discussion in 'Made With Unity' started by jesta, Jul 14, 2012.

  1. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Hi everyone,

    I spent the last months working on an advanced coherent noise generator that is completely shader based. The shaders are texture-less and are VERY fast, using a 32 bit hashing function on the GPU. My work is almost done (just need to add more documention) and I plan to release it to the Asset Store over the weekend. Unlike CPU based libraries like libnoise, everything in the Turbulence Library can be altered in real time.

    Three types of shaders are available : simple fragment programs, surface shaders and surface displacement shaders. You can create anything from procedural terrains, textures, special effects, clouds, etc.

    Noise types : Voronoi (F1, F2, F2-F1, etc), Perlin, billowed and ridged noise and their Simplex versions. Most of the noise algorithms come from this GREAT blog: http://briansharpe.wordpress.com/. Here are some examples :



    The real appeal of this package are the more advanced noise shaders. Those are based on the derivatives of Perlin, Simplex and Hermite algorithms. (See: http://www.decarpentier.nl/scape-procedural-extensions). These functions produce very realistic and interesting results :



    A web demo featuring all the 3D noise shaders implemented is available here : http://dl.dropbox.com/u/9289442/WebPlayer/WebPlayer.html.

    It requires a shader model 3.0 card. This has NOT been tested on a Mac yet, so Mac users are welcome to give me any feedback. Try using the "Anim Speed" parameter for cool effects!

    Is there any interest for a package like this?

    EDIT : Not working on Mac right now. I'm translating all my shaders to pure GLSL and the webplayer will be updated soon.

    EDIT 2 : Web player updated! New features : Color and texture blending, GLSL support (need feedback from Mac users).

    EDIT 3 : Everything works on Mac now! Coming soon to the Asset Store.

    Here are some textures created in seconds using the new features :



    EDIT 4 : Turbulence Library is out on the Asset Store! Grab it here http://u3d.as/content/badland-interactive/turbulence-library/3aK.

    EDIT 5 : New noise types : Stars, Polka Square and a complete Worley/Voronoi generator (see page 3) adding more than SIXTY types of noise!

    EDIT 6 : Turbulence Library 1.1 released!

    Hope to hear your comments!
     
    Last edited: Jun 28, 2013
    Farelle likes this.
  2. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I am intersted since I always wanted fast noise generation.

    I wonder if you could do fft calculations to be used in an ocean shader/systen.
     
  3. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Demo not working on my Mac (3.06 Hz Codre Duo), just giving untextured planes.
     
  4. ludiares

    ludiares

    Joined:
    Jul 14, 2011
    Posts:
    242
    Except cellular noise, value noise, Hermite badlands, Hermite billowed, HermitelQ, Hermite ridged, Hermite standard, Hermite swiss, Perlin badlands, Perlin billowed, PerlinlQ, Perlin ridged, Perlin standard, Perlin swiss, Simplex Badlands, Simplex billowed, SimplexlQ, Simplex ridged, Simplex standard and Simplex swiss, the rest are working, but i suppose I'm missing the best ones
     
  5. online|offworld

    online|offworld

    Joined:
    Nov 17, 2009
    Posts:
    85
    Yep, I'll put my hand up for that...
     
  6. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Good idea, I will see what I can do.

    Alright, I'll have no no choice but to write a pure GLSL version of all shaders. I will update the demo soon.

    Hmm, that's strange. Are you running the demo on a Mac? Does your card support shader model 3.0? More information on your system would be very helpful.
     
  7. ludiares

    ludiares

    Joined:
    Jul 14, 2011
    Posts:
    242
    I'm running on an iMac with 3.06GHz. I'm not sure if it supports shader model 3.0, i'll have to check
     
  8. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Thanks, I forced Unity to OpenGL and got the same results, so I'll write a GLSL version of every shader. I'll let you know when the webplayer will be updated.
     
  9. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    Great stuff. I'll be keeping my eye out for this. Some examples of incorporating multiple colours and diffuse texture blending would be welcome. Being able to use the animated noise and add/multiply/subtract from a texture will open up possible applications for us.
     
  10. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    My main focus right now are the noise shaders, but adding color and texture blending will be in the first release. However, my next project consists of a complete procedural terrain generation based on Turbulence Library that will feature many operators (add, substract, multiply, etc). You'll still be able to render the shader to a Texture2D with this library though.
     
  11. brn

    brn

    Joined:
    Feb 8, 2011
    Posts:
    320
    Count me in for this package. Nice!
     
  12. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Thanks!

    Quick update :
    The GLSL conversion is nearly done and works well on Macs. Also, I have included color and texture blending as Games Foundry suggested. You'll be able to play with the new options in the updated webplayer soon!
     
  13. Threeli

    Threeli

    Joined:
    Jul 9, 2012
    Posts:
    15
    This has potential - I'll certainly keep my eyes on this.
     
  14. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    I can confirm FFT calculations on the GPU will be in the first update of Turbulence Library, which will take no longer than 1-2 weeks after initial release. My main goal right now is to release the library as soon as possible so developers can give me feedback.

    The first release of the Library will offer the possibility to render the noise to standard Texture2D. The ability to add/multiply/substract will be added in the first or second update.

    The terrain generator, complete with dynamic LOD, tri-planar texturing and procedural height fields is a project on its own.

    Thanks for the replies!
     
  15. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    jesta, will there be a limit on how many gpu cycles the shaders can eat? Because right now the demo is overheating my ati 5870.
     
  16. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    There's no limit right now, but I find it strange that your graphics card is overheating. When testing on my old Nvidia 9600m, the application slows down but the card is never overheating. I could find a way to limit the gpu cycles though.
     
  17. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Well the card's temparature rises more compared to 3d gaming. I believe that there should be a gpu cycles limiter so the shader does not eat so much power from the rest of the graphics work.
     
  18. dakka

    dakka

    Joined:
    Jun 25, 2010
    Posts:
    113
    I really like the possibilities, it seems very fast.

    Would I be able to add a custom texture to the 3D Surface for RGB and keep the noise texture as Alpha and then use the Alpha for transpareny ?
     
  19. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Alright, I'll see what I can do.

    Absolutely. Every shader has a "Use Alpha" parameter that computes the height in the alpha channel while leaving RGB components for up to 2 possible blended textures. Transparency is not handled at the moment but I could include an example that demonstrates how to do it before becoming a full feature in a future update.
     
  20. dakka

    dakka

    Joined:
    Jun 25, 2010
    Posts:
    113
    Okay. I'm playing with the webplayer and thinking distant gas clouds and nebulas.
     
  21. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Any chance while translating to glsl you could see if you could get this working of sm2.0 too? I'm definitely up for something that lets me generate static textures for IOS.

    Thanks
    Mike
    @runonthespot
     
  22. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    I think GLSL shaders in Unity only support sm 2.0, but I can't be sure. If so, my GLSL shaders are already compatible with sm 2.0 hardware :). The web player will be updated tonight with GLSL support for Mac users, so if you can test it on a sm 2.0 graphics card, I'd be very curious to know if everything works. If not, I'll find a way to test it myself.
     
  23. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    The web player has been updated with GLSL support and color + texture blending. However, some testers reported that the GLSL version does not work on Mac... which is very strange. If you have a Mac please report any problems!

    http://dl.dropbox.com/u/9289442/WebPlayer/WebPlayer.html

    Here are some textures created in seconds using the new features :

     
    Last edited: Jul 19, 2012
  24. bigSky

    bigSky

    Joined:
    Jan 31, 2011
    Posts:
    114
    Not working on a mac, other than the cubist noise, polka dot, sparse convolution and value types. The images look wonderful, but on a mac, there is no dual texturing showing.
     
  25. brn

    brn

    Joined:
    Feb 8, 2011
    Posts:
    320
    This is going to be perfect for Unity 4 and DX11. wonderful work!
     
  26. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Are you sure the "Low Color" fields are not set to 0? The texture's diffuse color is multiplied with the color field. Thanks for the comment!

    Thanks a lot! I just bought a macbook pro to finally iron out the nasty bugs on the Mac version. I'll keep you guys updated!
     
    Last edited: Jul 20, 2012
  27. Morc

    Morc

    Joined:
    Jul 21, 2009
    Posts:
    31
    Hey jesta

    Looks great man! Pretty sure I will buy.
    Keep going.

    Cheers
     
  28. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Amazing. The whole time fiddling with it, I was thinking...terrain editor. Think of the possibilities.
     
  29. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Thanks guys! The project will naturally evolve in a full terrain editor eventually. The main purpose of the library is to provide a large collection of materials for texture/terrain generation. By the way, I'll be releasing the library on the asset store this week :).
     
  30. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    It's kinda working for me, only a few of the noise types seem to work. But really impressive. (mac 10.7.4) geforce 330m
     
  31. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Ya I'm currently updating each noise to work on Mac. Should all work tonight if everything goes as expected. I'll keep you guys updated.

    Edit 1 : OK, I'm having some trouble with Swiss and Badlands types. You can play with the rest though (only with Hermite interpolation mode).
     
    Last edited: Jul 23, 2012
  32. dakka

    dakka

    Joined:
    Jun 25, 2010
    Posts:
    113
    Nice work, just looked at the new webplayer. I like the texturing options.

    Count me in for one.

    Would it be possible to show the base wireframe of the displaced surfaced ?
     
  33. robin_notts

    robin_notts

    Joined:
    Apr 7, 2010
    Posts:
    86
    Looks great. The first half of the examples work great, but the last half don't work at all (black flat plane). On Mac OSX 10.7.4. Graphics card AMD Radeon HD 6750M 1024 MB.

    [edit: actually some of the first half don't work either]
     
    Last edited: Jul 23, 2012
  34. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    The wireframe will look like a plane because vertex shader does not update the mesh vertices. The 3D surface in my demo is generated with a script similar to this one http://unifycommunity.com/wiki/index.php?title=CreatePlane.

    The library comes with a script that can "capture" the material's height field as a Texture2D. From there, you can read pixels as height data and update any mesh used as a surface for the material.
     
  35. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    This is a known issue on Mac. I'm working on the problematic noise types right now and I'll update the web player when everything works (which should be very soon).

    UPDATE : Everything should be working on Mac! I'll be submitting the library to the asset store soon and I'll let you know when it will be available.
     
    Last edited: Jul 23, 2012
  36. dakka

    dakka

    Joined:
    Jun 25, 2010
    Posts:
    113
    Okay, got it wasn't thinking it was vertex shaded.
     
  37. Frednaar

    Frednaar

    Joined:
    Apr 18, 2010
    Posts:
    153
    Very nice,
    I was thinking about noise generated far view forests and could get a good result even on the webplayer itself!

    I hope it will not be that expensive...
     
  38. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Here are some new screens with a 3D surface :

     
  39. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    One of the things I have needed most for terrain editing is the ability to paint features onto another terrain. Like mountain peaks for example.
    In my mind, the ideal workflow would be:
    Using a tool like yours to generate very nice terrain with some features (like mountain peaks). That result is displayed in one window.
    In the other window, I have my main terrain I am working with.
    Moving between them, I select areas of the mountain peak(s) in the tool window, and these are blended into my main terrain at a location I specify.
    In a nutshell, I can pick a location in my main terrain, and using the mouse, I can blend a generated mountain peak, valley, or some other feature INTO my destination terrain.
    Hope that makes sense...and maybe it is something that could be useful eh?
     
  40. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Eventually, the tool will evolve into a full node-based terrain editor with different operators and erosion functions. I could add height field brushes eventually, but I'm not sure if that's exactly what you meant. Very interesting idea though!
     
  41. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    What I mean is...often, I want to just add a peak somewhere, or a valley. Many tools allow you to create an entire terrain from a particular noise style or function.

    But let's say I have two terrains. One is made up of nice, billowing hills.
    The other is a mountain peak terrain (ridged). I want to take one of the peaks from the ridged terrain, and put it somewhere in the billowing hills terrain. And I want to "blend" the edges it in, without having to spend hours touching up the edges.

    So basically...the workflow I imagine would be:
    1. Go to billowing hills terrain.
    2. Select circular area (the destination) where the peak will go. The edges are soft (alpha dictates blend amount I guess).
    3. I go to the peak terrain, and select the peak I want...again, a circular area. Or, I just use my brush, moving the mouse over the peak and watch it be blended into the target area on my billowing terrain.

    So far...I haven't seen anything like this. Sounds almost like something I would have to do with photoshop.
     
  42. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Well, the height field brush feature would allow you to do that. You could "paint" any type of noise on the terrain, so if you have a billowed terrain, you could select the "ridged" brush and paint any area of the terrain. Obviously none of that is implemented yet, but it's all in my roadmap.
     
  43. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Gotta say...what you have already is VERY nice. I was playing with the webplayer, and really enjoying it.
     
  44. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Hey everyone, I just finished my very basic website where I'll post updates and information about my Unity extensions. Be sure to check out the "Products" page for more information about the library.

    http://badlandinteractive.com/
     
  45. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
  46. aigam

    aigam

    Joined:
    Dec 31, 2005
    Posts:
    170
    Looks fantastic!
    It works on IOS?
     
  47. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    I do not have an IOS device, but the GLSL shaders should work on this platform. I'm planning to buy an iPhone soon to test the compatibility, but in the meantime I can't guarantee anything. Of course, making the library compatible is far from impossible. If it doesn't work already, it is probably caused by vertex program precision, which defaults to "high".

    If anyone who bought the library can test it on IOS devices, I'd be very grateful!
     
  48. aigam

    aigam

    Joined:
    Dec 31, 2005
    Posts:
    170
    Me too! It will be of great help
     
  49. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Currently it does not work on iOS [bug report sent, he's working on a fix]
     
  50. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363
    These looks realy usefull. I hope unity team will also add more noise options into Unity 4.