Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TOZ Noise

Discussion in 'Assets and Asset Store' started by aubergine, Dec 11, 2012.

  1. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    This package is an enhanced Noise Library adapted for Unity Game Engine.

    Used for generating heightmaps for Unity Terrain, TOZ Planet Renderer and mesh objects. Also used for generating Procedural Textures and BumpMaps and lightmaps. This package also can generate 3d volume textures and save NoiseMaps.

    TOZ Planet Renderer includes a slightly modified version for free and as a support tool to generate some useful assets.

    Buy From:
    ASSETSTORE

    * This asset has now a commercial licence, if you got it for free previously, do not worry as you can still use the old version for free with your own personal productions, however if you sell it as a part of another tool or package, new terms and licence apply.
     
    Last edited: Apr 27, 2020
  2. rosevelt

    rosevelt

    Joined:
    Oct 23, 2012
    Posts:
    47
    Can it animate in real time curved line noises like electricity and chemical blends.
    Can you make a demo of such.
    If so I will probably buy it.
    As of now I'm not sure what it can do other than generate textures.

    Thanks
     
  3. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    You can do anything with it, just needs coding the logic. Noise functions are there which provide 4d,3d,2d,1d noises also projected as plane, cylinder, line and sphere.

    So, you make a mesh of a simple plane object, get suitable 2d or 3d noise value and move the plane vertices with this noise value. Thats it.

    Custom support is always available via mail.
     
    Last edited: Apr 5, 2020
  4. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    244
  5. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    The main difference is i wrote this one from scratch and tried to keep it exactly same as original c++ source.
    Added important tutorial files and 2-3 sample files as well.
    And an editor as well.
     
  6. SimtropBuggi

    SimtropBuggi

    Joined:
    Feb 15, 2013
    Posts:
    98
    What are the capabilities during runtime?

    Say if a player wants to create a terrain, can your library be used to select parameters and have all the same functionality during runtime?
     
  7. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    LibNoise is a noise library, it gives you generic functions to easily create various kind of noise.
    If you can find an optimal way to set terrain vertices at certain heights through these generated noise functions, then the answer is yes.
    But this package doesnt give you the optimal way, it gives you the noise functions alone.
     
  8. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,778
    I can't find this on the asset store but am interested in a supported libnoise with demos, particularly around terrain generation. Can you please message me.

    Cheers,
    Adam.
     
  9. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Aubergine,

    I'd like to start by saying thank-you for this great port! I've been using the port from Pakfront for a while now and recently decided to create an inspector based extension to it for visual generation. I was only about 1/2 way through when I stumbled upon your port and I've consequently dumped my work since yours fits the bill very nicely!
    I really like how you have stayed true to the original.


    Edit: I just realised what was going on. You were creating the object based on an interface, but to get access to methods not available in the interface you have to cast to the correct type. Sorry for asking a silly question, I'll leave the below just in case someone else learns from it too.


    I do have one question about the way you declare and cast your types, and please note I'm only asking because I think there is something i'm missing (or I might learn something here).
    The question is: is the below example a code style of yours or is there a specific reason why you Type a variable as it's the base class Type, and then when creating the new object you create it as the desired Type there.

    For example, in Tutorial5, why do you do this:
    Code (csharp):
    1.  
    2.         IModule terrainType = new Perlin();
    3.         ((Perlin)terrainType).Frequency = 0.5;
    4.         ((Perlin)terrainType).Persistence = 0.25;
    5.         IModule finalTerrain = new Select(flatTerrain, mountainTerrain, terrainType);
    6.         ((Select)finalTerrain).SetBounds(0.0, 1000.0);
    7.         ((Select)finalTerrain).SetEdgeFallOff(0.125);

    instead of this:

    Code (csharp):
    1.  
    2.         Perlin terrainType = new Perlin();
    3.         terrainType.Frequency = 0.5;
    4.         terrainType.Persistence = 0.25;
    5.         Select finalTerrain = new Select(flatTerrain, mountainTerrain, terrainType);
    6.         finalTerrain.SetBounds(0.0, 1000.0);
    7.         finalTerrain.SetEdgeFallOff(0.125);
     
    Last edited: Oct 24, 2013
  10. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    As you found out yourself, IModule is an interface and we cast the object to appropriate type later on because the generator functions and other tools all use the interface. Not necessary, but less code.
     
  11. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi again Aubergine,

    I've had a think about it, and I don't think the casting is necessary. Please correct me if I'm wrong but the second block of code I posted will not throw compile or runtime errors as each time the object is used, it's used via the appropriate casting. For example when the Select (in the second block) needs access to the objects they request the IModule Type, which is valid due to the various modules implementing IModule within their class.

    If we do it via the second method, it nearly 100% matches the original libnoise and has the added bonus of being far easier to read.

    Can you think of any instance in your code that this would fail? I have to admit I haven't looked at any of the GUI code yet.

    El

    Edit: PS. Please don't think i'm attacking your code, I doubt I could replicate what you've done. I'm just keen to discuss it for my own understanding of C# Implements and me wanting to be lazy and not casting all the time :).
     
    Last edited: Oct 25, 2013
  12. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    If you are not going to use NoiseBuilder and/or imagemap builder classes and related functions and tools, then you can use without casting.
    But those classes dont know about individual modules, they only know the interface, thats why you have to cast from it.
     
  13. Chuckalicious

    Chuckalicious

    Joined:
    Jul 28, 2012
    Posts:
    51
    I just noticed; everyone that has posted so far, has had questions, criticisms and ask if they can use this. Not one yet has said 'Great Job' or even a 'Thanks!'. So to you aubergine, Thank You! Well done. The editor was a nice touch. I was trying to add the textures to a sphere (using get pixels) but the seams of the mesh come apart. Do you have any suggestions on what I can do there or perhaps just applying noise to a sphere directly without a texture (although the texture is best). Thank you again so much.
     
  14. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    Thanks :)
    The editor has image builder for spherical distortion. Just render as spherical map and it will correctly map to a sphere.
     
  15. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    One person had :)
     
  16. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,778
    Make that two :)
     
  17. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Is it possible to make noise for water effects? Because this is a pretty cool looking package i could make use of!
     
  18. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    What do you mean by "water effects"? This is libnoise, plus a simple texture editor. The noise values range from -1 to +1 if you use the functions yourself.
    The editor just normalizes the value between 0 and 1 and uses a gradient of your own choice to generate some texture.

    If you mean caustics, yes you can, just use a ridge noise and use a black and white gradient.
     
  19. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @aubergine: yes, i meant caustics and wave maps. Sorry to be confusing. And thank you for your help!

    +1 Download for you!
     
  20. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    Well, im updating my website. If you cant find the download, check back soon again.
     
  21. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @aubergine: no no, i meant that i downloaded your package! anyway, haven't had a chance to actually use it yet, so once i do, i will give you feedback!
     
  22. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Aubergine,

    I have been using your noise library to create terrains based upon Josh Tippetts articles over here: http://www.gamedev.net/blog/33/entry-2249106-more-procedural-voxel-world-generation/
    To do that I needed to add a new gradient and ExtendedTurbulence functionality to the noise library you wrote.

    My post here is for two things:
    1. is it ok to include your noise library in the package releases I do for this terrain generator. If so, did you want to supply a license file to include?
    2. Did you want to include the gradient and extended turbulence in your library (you are most welcome to, they may need a little cleanup to fit nicely in the library).

    My first release was here: http://forum.unity3d.com/threads/18...th-C-and-PolyVox/page11?p=1524454#post1524454 and the package with the scripts can be pulled from there or github: https://bitbucket.org/Ellandar/ellandarsterrainbuilder/overview
     
  23. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    You can do whatever you want with it, except for selling in the assetstore. No licence needed.
    I will update the package with your additions.
     
  24. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Thanks very much Aubergine.

    Ell.
     
  25. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    Well, i was checking your code and the article you posted.
    At the end you are making a voxel painting sort of thing? I think its better to use 3d noise for the area which is being edited and get the noise value from the already provided gradient class. (Not good for runtime but for editor only)
    Just an idea though i have no experience with voxels i dont even know how they work :)
     
  26. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Voxel landscape, correct.

    Using the gradient as provided works well if you want to build a heightmap, ie. at height -1 make it blue like deep ocean and 1 make it snowy for mountain tops, etc. That produces very nice terrains.
    The way i'm doing it will allow for a different implementation, where the noise can dictate other things, like where ores are in the ground, where grass is on the surface etc.

    Not including the two modules in the noise class isn't a problem at all, happy to leave it up to you. Including them might just confuse people as the libnoise sourceforge page has no documentation on either of them.

    Ell
     
  27. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @aubergine: Um, the tutorial scripts are giving me errors? It keeps giving this error:

    "Assets/Aubergine/Noise/TutorialsAndExamples/Tutorial5.cs(16,25): error CS0266: Cannot implicitly convert type `Perlin' to `Aubergine.Noise.IModule'. An explicit conversion exists (are you missing a cast?)"

    I have no idea what could have gone wrong.

    EDIT: It is now occurring with all the scripts! What do i do to fix this?!
     
    Last edited: Feb 19, 2014
  28. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,778
    Hi,

    I have put a lot of work into world generation, and am using your noise package. I have considered releasing my work on the asset store, but was under the impression that because your work was a port of another person's work I couldn't do it. I do my terrain generation in the editor, and would need to distribute your code with mine if I were to sell it. Is this allowed?

    Some images of my WIP's here: http://adamgoodrich007.tumblr.com/

    Cheers,
    Adam.
     

    Attached Files:

    Last edited: Feb 20, 2014
  29. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Adam,

    The terrains you are generating look really good! Great work mate!
    I can't help out with the licensing stuff though, Aubergine is the only one that can answer that. The original noise was released under LGPL which would allow you to do what you are proposing (as long as all the source and the license was supplied too). Aubergine hasn't nominated a license as far as I can see so don't do any releasing without his OK first.

    Once again, awesome terrains, it looks very good. And it runs on iPad as well, good work!

    Ell
     
  30. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    You cant sell it in the Unity AssetStore not because i wouldnt allow it but because Unity wont accept the package while it includes LibNoise.
    Although there is no restriction on LibNoise licence itself for me or for you to sell your packages, AssetStore people dont want to get in trouble.

    EDIT: Thats a pity as i also needed this library for many of my asset packages, but what can you do.
     
  31. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Okay, got the scripts working. turns out i was placing them in the wrong spots!

    Anyway, any sort of documentation on this tool? I'm a little confused, and the buttons don't seem to be doing anything...

    EDIT: Just figured out i have to add modules, *facepalm* thanks! If i come up with some sick patterns, i will post my results!

    EDIT2: I CAN'T SAVE TEXTURES! Every time i go to save, this happens:

    ExecuteMenuItem failed because there isn't such menu as "Aubergine/TextureCreator"

    What have i done wrong?
     
    Last edited: Feb 27, 2014
  32. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    It appears you messed up the folder structure or maybe there is a problem with other assets in your project.
    Forexample if you import the package together with planetary terrain, the modules have same names but his package doesnt have namespaces so functions clash.

    Import the package to a clean new project and work your way there.
     
  33. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Aubergine, it turns out it was saving textures, but it keeps popping up that error. I wonder why. and it isn't the folder structure!

    My folders look like this:

    Editor > Aubergine > TextureCreator.cs

    Plugins > Aubergine > LibNoise


    Anything wrong with this? At least i was able to generate and save the sickest wave-map I have ever seen. If you would like to see it in action, let me know, and i will post screenshot of water
     
  34. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    Your folder structure is correct. Maybe some code was changed by mistake or some part was corrupted. I dont have any errors and neither had anyone else informed me about this.

    The TextureCreator.cs is just a mess anyways, its there as a sample and you can surely add/remove/modify it as you please with new features or do bug fixes.
    I dont have much time to work on it and as mentioned earlier i dont give support for it.
     
  35. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    Aubergine, this is cool stuff. Currently im using another libnoise port and it has bugs and missing features. Going to def switch this your port. Im not at home to check but does the editor have osme kind of code generation or other type of functionality so i can save my setups? Im generating the noise at runtime and i was looking for a good solution to save or at least easily export a noise setup, my artist is not a programmer and i want him to be able to share his noise/gradient values easily if possible. In any case ill be using your library, well i will if your spherical normal map gen actually works :) and i can change the gain. These are missing/broken from my other library.

    thanks
     
  36. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    Well, i never thought of saving data. I will add it if i find some time then.
    The editor needs some tidying up anyways.

    But if you are in a hurry, its easy. There are 4-5 objects to be saved.
    Make a scriptable object for these objects such as the gradient, the modules list and other minor variables and save this scriptableobject as an asset.

    EDIT: the main library and utilities all work as intended, no worries there.
     
  37. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    Awesome, ill look into it. I can alway make him write the stuff down and ill write it into a preset we dont need to many presets. Does the library use unity gradients?
     
  38. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    No, it uses its own gradient class which is from -1 to +1. But that shouldnt stop you to use unity gradients, there already is a function burried somewhere in the code that converts -1,+1 to 0-1 range.
     
  39. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @Aubergine: Ok, then. At least it works! and with sick results too.
     
  40. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    How do curves work in the editor? they dont seem to have any options.
     
  41. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    Gradient function to load a unity gradient. dunno if there is a a function to do this already but i went and added it anyhow to RendererImage.
    Code (csharp):
    1.        
    2. public void SetGradient(Gradient gradient) {
    3.    foreach (GradientColorKey key in gradient.colorKeys) {
    4.       this.gradient.AddGradientPoint((key.time * 2) - 1, key.color);
    5.    }
    6. }
    I also added a function to return only the color data of images, i'm running generation in a separate thread and the built in ones fiddle with Texture2D which is forbidden in threads.

    Code (csharp):
    1.         public Color[] GetData() {
    2.             Color[] data = new Color[DestImage.Width * DestImage.Height];
    3.             int id = 0;
    4.             for (int y = 0; y < DestImage.Height; y++) {
    5.                 for (int x = 0; x < DestImage.Width; x++, id++) {
    6.                     data[id] = DestImage.GetValue(x, y);
    7.                 }
    8.             }
    9.             return data;
    10.         }
    Some examples, iv just barely started work on this system so these are pretty simple, but im looking to create spore style over sized planetoids fully procedurally ....and very quickly. This is using the Space Graphics Toolkit displacement planet. Could work with the tessalator too, but i don't need to actually get close to the planets.

    $Capture1.PNG $Capture2.PNG
     
  42. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    What do you mean by curves?

    I like your planets, its simple to create some without the need for other assets. Just render a spherical noise texture and use it as a heightmap for a sphere. You will have to multiply the vertex normal with the noise value and add the sphere vertex position to it and voila.

    Also as you already figured it out yourself, you dont need the editor to generate color values. Just multiply the same noise with a gradient of your choice to color the vertices. You dont even need a texture for such a planet if you wont see it at close distances. As it will have enough vertices to color.
     
  43. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    The curve operation. In the editor when i Select curve it doesnt show a way to add control points. I might be missing it though.

    The SGT is used for its planet shader with atmosphere and other options. I am using libnoise to generate the height, color and specular maps.
     
  44. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    137
    This is incredible! I was just starting to mess around with my own noise functions and was realizing there are a lot of great options, too many in take the time to implement, and then I found this package. So many options in the library, and what a great tool for visualizing what you're messing around with!

    I'm also getting the save texture error: ExecuteMenuItem failed because there is no menu named "Aubergine/TextureCreator," but simply changing the path to "Window/Aubergine/Tools/TextureCreator" fixes the error.

    Really excited to see that the next version allows us to edit individual modules after they've been added to the list. Can't wait! Thanks so much Aubergine.

    Alex
     
  45. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    137
    800 downloads and no donations sucks :(

    In light of this, will you be releasing the new editor, and if so, any idea when? I'm trying to decide between using your library as a starting point for the runtime heightmap/colormap generation I'm trying to build, or buying Terrain Composer. I'm getting close to buying Terrain Composer, but I'd love to see what can be done with the latest version of your tool. If I make the decision to use this library, I'll absolutely donate!

    Thanks for your awesome work,

    Alex
     
    Last edited: May 8, 2014
  46. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    I dont know what terrain composer is.
    The new editor is just like the old one, just cleaned up the code, added a few minor details like editing modules after adding them and easier gradient management. And the missing Curve and Terrace modifiers.
     
  47. magic9cube

    magic9cube

    Joined:
    Jan 30, 2014
    Posts:
    58
    I'm trying to implement seamless/tiling 3d noise in my unity project. From what i can tell this requires 6d noise. Does anyone know of a c# implementation for seamless/tiling 3d(6d) noise? I've implemented seamless 2d noise using 4d noise functions but i really need to push it into 3d.
     
  48. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    If you want 3d noise, you do it with 3d noise not 6d. Seam handling is something else and if you look at the source code you will see how to deal with it.
     
  49. magic9cube

    magic9cube

    Joined:
    Jan 30, 2014
    Posts:
    58
    I'm not sure that could give me what i need. I don't want to mirror the noise.

    This is way over my head but according to JTippetts (Accidental Noise Library) http://www.gamedev.net/topic/594843-perlin-noise/

    Code (CSharp):
    1. for(int x=0; x<mw; ++x)
    2.     {
    3.         for(int y=0; y<mh; ++y)
    4.         {
    5.             double s=(double)x/(double)mw;
    6.             double t=(double)y/(double)mh;
    7.             s=s* ((m_mapx1-m_mapx0)/(m_loopx1-m_loopx0));
    8.                     t=t*((m_mapy1-m_mapy0)/(m_loopy1-m_loopy0));
    9.  
    10.              double dx=m_loopx1-m_loopx0;
    11.                     double dy=m_loopy1-m_loopy0;
    12.              double dz=m_loopz1-m_loopz0;
    13.  
    14.              static double pi2=3.141592*2.0;
    15.                     double nx=m_loopx0+cos(s*pi2) * dx/pi2;
    16.                     double nz=m_loopx0+sin(s*pi2) * dx/pi2;
    17.  
    18.                      double ny=m_loopy0+cos(t*pi2) * dy/pi2;
    19.                      double nw=m_loopy0+sin(t*pi2) * dy/pi2;
    20.  
    21.                     double nu=m_loopz0+cos(m_zdepth*pi2) * dz/pi2;
    22.                      double nv=m_loopz0+sin(m_zdepth*pi2) * dz/pi2;
    23.  
    24.             array2d->set(x,y,m_source->get(nx,ny,nz,nw,nu,nv));
    25.         }
    26.     }
    If i could cheat by using only a 3D function i'd be happy but im not sure its actually possible to do this beyond some basic mirroring.. which is not what i'm after.
     
  50. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,872
    It is basically the same idea, it just blends and offsets 2 different noise (map and loop).

    What is your purpose anyways? How will you use this?