Search Unity

  1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    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:
    16
    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:
    773
    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:
    16
    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:
    773
    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:
    773
    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.