Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta 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. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

NumberFlow, visual editor for procedural textures

Discussion in 'Assets and Asset Store' started by Jasper-Flick, Nov 21, 2013.

  1. Pointcloud

    Pointcloud

    Joined:
    Nov 24, 2014
    Posts:
    30
    That worked! Thanks for the update, the fps on the hololens is very high too. I ran the gallery example scene without a problem. Quick question, is there a way to extrude the vertices of an object, such as a plane, based on the luminosity values of the noise? Something similar to the extrusion effects from this plugin (https://www.assetstore.unity3d.com/en/?gclid=CPvpive1jcQCFQEIwwodCVIAvg#!/content/3957)? Thanks again, its really exciting to get some holographic noise!
     
  2. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    808
    The included Noise Example and Terrain scenes use noise to adjust the vertices of a plane. These scenes adjust the mesh vertices and normals on the CPU. More advanced would be to do it on the GPU, via tessellation.
     
  3. Pointcloud

    Pointcloud

    Joined:
    Nov 24, 2014
    Posts:
    30
    Ok great! Thanks again for all of your help! One more quick question... what would be the best way to animate the frequency, octaves, lacunarity, persistence, and zOffset over Time.deltaTime? I'm playing around with the NoiseExample.cs script to see if I can get something like this to happen... I can get Noise to animate in the NumberFlow Diagram Manager, is there also a way to do a zOffset with the noise generated in the NumberFlow Diagram Manager? Thanks!
     
    Last edited: May 19, 2017
  4. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    808
    The manager doesn't support animation. In general, continuously generating textures is expensive. The most simple way to animate the texture of a material would be like this:

    Code (CSharp):
    1. using UnityEngine;
    2. using CatlikeCoding.NumberFlow;
    3.  
    4. public class AnimationExample : MonoBehaviour {
    5.  
    6.     public Material material;
    7.  
    8.     public Diagram diagram;
    9.  
    10.     public int width, height;
    11.  
    12.     Value timeValue;
    13.  
    14.     Color[] buffer;
    15.     Texture2D texture;
    16.  
    17.     void Awake () {
    18.         timeValue = diagram.GetInputValue("Time");
    19.         buffer = new Color[width * height];
    20.         texture = new Texture2D(width, height);
    21.         material.mainTexture = texture;
    22.     }
    23.  
    24.     void Update () {
    25.         timeValue.Float = Time.time;
    26.         diagram.Fill(buffer, width, height);
    27.         texture.SetPixels(buffer);
    28.         texture.Apply();
    29.     }
    30. }
    That component fills the texture every update, which is only really feasible with small textures. An improvement would be to update at a lower frequency. Or spread the filling over multiple frames, trying to make sure your app maintains a minimum frame rate.

    In case of a short animation loop, it's best to generate all frames at once at startup and cycle through the textures.
     
  5. Gavriel

    Gavriel

    Joined:
    Apr 3, 2013
    Posts:
    8
    Your asset looks very interesting. Do you have an example on how to manipulate nodes at runtime? I'm looking forward to using multiple random static textures in my game. The textures are going to morph over time so adding or removing nodes at runtime would be interesting.
     
  6. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    808
    The diagrams cannot be edited at run time. Instead, you use input nodes to configure them. You can design diagrams with configuration options, which allows you to produce different results. The simplest example is adding an offset to sample a slice of 3D noise. Diagrams can also be chained, by using texture inputs. You do have to program such a pipeline yourself though.
     
  7. Diego_Graphics

    Diego_Graphics

    Joined:
    Nov 3, 2014
    Posts:
    33
    Hello dear forum,
    is there a possibility to make a GetFloat(x,y) or even GetFloat(x,y,z) on a diagram? just like with Mathf.PerlinNoise() .

    how would I do that?
    I have a:
    Code (CSharp):
    1. public CatlikeCoding.NumberFlow.Diagram Diag;
    but I don't quite understand how I can retrieve single floats (or ints) on certain coordinates.
    I hope there is a (simple) way, so I can integrate it into my current project, but it looks very promising. :)
     
  8. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    808
    There is no direct API for that, instead there are the various Diagram.Fill methods, which work with Color arrays. If you want per-pixel control they you could grab an output node directly and manipulate the diagram to set the coordinates correctly, but it's not designed for that.