Search Unity

[RELEASED] Ruaumoko: iso-surface, voxel mesh generation and terrain engine

Discussion in 'Assets and Asset Store' started by bens1984, Apr 29, 2013.

  1. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    435
    Hi,

    Am using edit mode to build terrains that are fixed, and that can be tunnelled thru.

    problem for me is i don't know what variables to set or tweak to have at least some decent control over the creation process.

    does anyone have some #'s for the different variables available do there is some or alot of control when creating a terrain. I presume this is possible, but too often my hit and miss attempts cause me to restart from scratch.

    that said, i find this feature in Ruaumoko to be very compelling.

    kinda like a wild horse that does what it wants. :)
     
    Last edited: Sep 25, 2013
  2. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    I'm putting together a tutorial document on how to shape terrains. The variables all have comprehensible impacts and I'm happy to do my best explaining them. I'll have a pdf together first, then make a video at some point.

    @trudeaudm: I'll look into the planet base. It might be something unintuitive with the planet radius, noise, starting position, etc.

    @banksy: I'm scanning over the editor tools to try and make things more obvious...

    @LoganPark: lots of questions... let's see what I can answer now.

    To make a point in the world empty you need to find the blocks of RuaumokoTerrain that are around that point (these are game objects that are children of the main terrain game object). If the blocks already exist (generated in the editor or during run-time) then you can sort through all the children of the main terrain object to find the one that contains the point. Then trigger a "Sculpt" call on that object and it will pass it on to its neighbors (they're all linked through arrays of handles). Raycasts are definitely not a good solution since they only hit surfaces: if you're deep in a hillside they might not find the surface!

    How to test if a point is inside or out: RuaumokoTerrain uses a helper class RuaumokoDensity to generate the terrain. Once things are running you can get a handle to the RuaumokoDensity instance used by the main terrain class and call CalculateDensityForVoxel (you'll need to find the function and change it from Private to Public to call it directly). If the value is >0 you're inside the surface, if it's <0 you're out in the 'air'.

    To scale up the voxels: scale up your game object! (the main/parent game object) The spacing of the mesh verticies is based on the scale of the game object.

    I'm not sure what the blackening is with the sculpt tool (perhaps an ambient occlusion artifact?) I'll see if I can dig it up!

    You can lower the collider updates by setting the rate on each voxel-block game object (VoxelBlock.cs script). I need to add parameters to set the rate globally and also set a lower edit limit that defers collider updates until a certain amount of editing has occurred (there is one hardcoded at the moment but it needs to be adjustable).

    There are comments on the functions in the main scripts but I haven't generated an API yet.

    Finally, in your code I suspect the problem is your definition of SculptParameters. Take that out (and Mode and Shape) and use the SculptParameters that should be globally accessible (they're defined at the top of SculptingTool.cs) in your explode() function.
     
    Last edited: Sep 25, 2013
  3. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    435
    Hi,

    OSX 10.7.4 Unity 3.5.7

    Web player works fine for me, can melt a fixed terrain i created in the editor.

    OSX/mac standalone displays the fixed terrain fine, but melting does not work.

    Any suggestions?

    tx,

    shwa
     
    Last edited: Sep 25, 2013
  4. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    435
    "I'm putting together a tutorial document on how to shape terrains. The variables all have comprehensible impacts and I'm happy to do my best explaining them. I'll have a pdf together first, then make a video at some point."

    Thanks for this, Ben.

    In the meantime, if you have a screenshot of variables you have used, that would be helpful.
    I mainly use Flat mode right now as my attempt with Caves and Rocks ended up with very chaotic results.

    I'm looking for variables to create a slightly dynamic looking terrain. Then, getting a better understanding of the variables, one can start to push the numbers up and down a bit to see the results.

    ** What i found most challenging, was clicking to create a new block, would put that new block/terrain in a very unpredictable location, often far from where i was clicking. This made it very difficult to create a terrain that was seamless. Alot of trial/error and guesswork.

    Knowing when to use Rebuild data, save changes, regenerate all, remove empty blocks and clear voxels would be helpful.

    Scene name change. I backed up scene test 1, which became scene test 2. When i open scene test 2, i can't melt the terrain. I presume this has something to do with the name of the resources folder that was generated.

    I did try to use the Create the World function in the pull down menu. Got an interesting result, but couldn't figure out how to convert it so it's meltable.
    Imo, this Create the World one click function could end up being an important feature, since it's quite fast, and gives one 'big' results.

    thanks,

    - shwa
     
  5. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    Just a quick login to say thank you for the quick, detailed reply that doesn't talk down to us. Have a good one!

    Edit: took Dr. B's suggestion to fix the grenade script and it seems to be working quite fine now. I've updated the code above.

    It becomes evident that for any sandbox or open-world game, we will need to work up some kind of chunk save to file, unload, load, generate new chunk only if not previously saved process. Wandering for a bit in a Ruaumoko landscape then pausing and examining the game world reveals a simulated dataset that grows pretty fast.

    I will think out loud here to myself for a sec then see if I can work up a simple addition to the core Ruaumoko system to manage chunk files. I'll post the script right here if I can get something working. Fortunately, this is a problem previously solved in many, many games.

    EDIT: Below is a simple, unoptimized, unencrypted 3D chunk generator/serializer/filesystem saver/reader/deserializer/loader. The function names are descriptive and I've put some comments throughout. Load it up and you should see pretty quickly how it works. I plan to link this to the Ruaumoko chunk system such that each of these 125 chunks (5x5x5 matrix) each hold a bunch of Ruaumoko chunks, enemies, item drops, and so forth.

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Text;
    4. using System.IO;
    5.  
    6. public class ChunkGenSaveUnloadLoad : MonoBehaviour {
    7.     /* * * * * * * * * * * * * * * * * * * * * /*
    8.      *
    9.      * This script is created and provided in honor of my exceedingly
    10.      * awesome wife!
    11.      *
    12.      * Written 2013 by Logan Park.
    13.      *
    14.      * Script creates a 3D lattice of volume chunks, into which you can
    15.      * child a bunch of enemies, props, item drops, etc.  
    16.      * Maybe even Ruaumoko chunks, too...?  This
    17.      * simple chunk engine will save/load the chunks to/from the
    18.      * file system as a single flat text file per chunk.  The load
    19.      * and unload are based on proximity to the player's avatar.
    20.      *
    21.      * You'll need to serialize child entities like item drops
    22.      * yourself below, in SaveChunkToDisk().  There are more secure
    23.      * and compact ways to do all this, but this is a basic, functional
    24.      * start for parametric entities that serialize easily to text.
    25.      *
    26.     /* * * * * * * * * * * * * * * * * * * * * */
    27.    
    28.     // Edit these inside the script
    29.     private int NumberOfChunksPerAxis = 5;  // 5x5x5 lattice = 125 chunks to scan at a time.
    30.     private float ChunkEdgeLength = 2000.0f;// How big is each chunk, in unities (meters)?  Bigger is better
    31.                                             // because it takes time to scan through the 125 chunks.
    32.                                             // Bigger also means more child objects per chunk to serialize.  Optimize
    33.                                             // for your needs. The 3x3x3 inner lattice is about right for
    34.                                             // interactive simulation space and the outer envelope of chunks beyond
    35.                                             // is probably best just used for scenery and warming up any simulation
    36.                                             // that needs to happen before the player's av can get there.
    37.    
    38.     // Set these in the editor
    39.     public Transform PlayerAvatar;
    40.     public GameObject ChunkPrefab; // Can be just an empty gameobject prefab.
    41.    
    42.     // Player edits this interactively
    43.     public string SaveGameName; // Tie this variable into a savegame or options dialog GUI.TextField.  
    44.                                 // It sets the path name to the chunk files saved to disk.
    45.    
    46.    
    47.     // No need to edit these
    48.     bool readyToEvaluateChunks = true;
    49.     private float MaxPerAxisDistance;
    50.     string ChunkFileName;
    51.     string ChunkFilePath;
    52.     string ChunkFileData;
    53.  
    54.     void Start () {
    55.        
    56.         // Make sure basic savegame directory is present
    57.         if(!Directory.Exists(Application.dataPath + "/../Saved Games")) {
    58.             Directory.CreateDirectory(Application.dataPath + "/../Saved Games");
    59.         }
    60.         if(!Directory.Exists(Application.dataPath + "/../Saved Games")) { // Doublecheck
    61.             Debug.Log("Chunk Manager: ERROR: unable to create savegame directory, this is a showstopper.");
    62.         }
    63.  
    64.         MaxPerAxisDistance = Mathf.Round(NumberOfChunksPerAxis / 2.0f);
    65.         int LatticeHalfAxisSize = (int)(Mathf.Round((float)NumberOfChunksPerAxis / 2.0f));
    66.  
    67.         // Generate the lattice
    68.         for(int i = -1 * LatticeHalfAxisSize * (int)ChunkEdgeLength; i <= 1 * LatticeHalfAxisSize * (int)ChunkEdgeLength; i += (int)ChunkEdgeLength) {
    69.             for(int j= -1 * LatticeHalfAxisSize * (int)ChunkEdgeLength; j <= 1 * LatticeHalfAxisSize * (int)ChunkEdgeLength; j += (int)ChunkEdgeLength) {
    70.                 for(int k = -1 * LatticeHalfAxisSize * (int)ChunkEdgeLength; k <= 1 * LatticeHalfAxisSize * (int)ChunkEdgeLength; k += (int)ChunkEdgeLength) {
    71.                    
    72.                     GameObject ProceduralChunk;
    73.                    
    74.                     ChunkFileName = "Chunk_" + i.ToString("f0") + "_" + j.ToString("f0") + "_" + k.ToString("f0") + ".txt";
    75.                     ChunkFilePath = Application.dataPath + "/../Saved Games/" + SaveGameName + "/" + ChunkFileName;
    76.                    
    77.                     ProceduralChunk = Instantiate(ChunkPrefab,transform.position,Quaternion.identity) as GameObject;
    78.                    
    79.                     // Parenting the chunk to a container makes iterating through the chunks a breeze in EvaluateNearbyChunks()
    80.                     ProceduralChunk.transform.parent = gameObject.transform;
    81.                     ProceduralChunk.transform.position = new Vector3(i,j,k);
    82.                     ProceduralChunk.transform.rotation = Quaternion.identity;
    83.                     ProceduralChunk.transform.localScale = new Vector3(0.9f * ChunkEdgeLength, 0.9f * ChunkEdgeLength, 0.9f * ChunkEdgeLength); // Make borders more visible by adding a small gap
    84.                    
    85.                     if(!File.Exists(ChunkFilePath)) {
    86.                         // Then this is probably the first time we've initialized the game with this savegame name! Yay!
    87.                     } else {
    88.                         ChunkFileData = File.ReadAllText(ChunkFilePath);
    89.                         if(ChunkFileData == "foo") {
    90.                             ProceduralChunk.renderer.material.color = new Color(Mathf.Abs (ProceduralChunk.transform.position.x / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.y / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.z / 255.0f), 0.1f);
    91.                         } else {
    92.                             ProceduralChunk.renderer.material.color = new Color(Mathf.Abs (ProceduralChunk.transform.position.x / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.y / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.z / 255.0f), 1.0f);
    93.                         }
    94.                     }
    95.                 }
    96.             }
    97.         }
    98.     }
    99.    
    100.     void Update () {
    101.         if(readyToEvaluateChunks) {
    102.             StartCoroutine(EvaluatingNearbyChunks());
    103.         }
    104.     }
    105.  
    106.     IEnumerator EvaluatingNearbyChunks () {
    107.         //Debug.Log ("Beginning next scan of chunks near the player");
    108.         readyToEvaluateChunks = false;
    109.  
    110.         // Iterate through rows
    111.         foreach (Transform chunk in transform) {
    112.  
    113.             chunk.position = new Vector3(Mathf.Round(chunk.position.x),Mathf.Round(chunk.position.y),Mathf.Round(chunk.position.z));
    114.            
    115.             // Directions expressed here are in world axes, not local to the player's orientation.
    116.             if(chunk.position.x < PlayerAvatar.position.x - (MaxPerAxisDistance * ChunkEdgeLength) - (ChunkEdgeLength * 0.5f)) { // then chunk is too leftward
    117.                 Vector3 NewChunkPosition = chunk.position + new Vector3((float)NumberOfChunksPerAxis * ChunkEdgeLength, 0.0f, 0.0f);//
    118.                 SwapOldChunkForNewChunk(NewChunkPosition, chunk.gameObject);
    119.             } else if(chunk.position.x > PlayerAvatar.position.x + (MaxPerAxisDistance * ChunkEdgeLength) + (ChunkEdgeLength * 0.5f)) { // then chunk is too rightward
    120.                 Vector3 NewChunkPosition = chunk.position - new Vector3((float)NumberOfChunksPerAxis * ChunkEdgeLength, 0.0f, 0.0f);
    121.                 SwapOldChunkForNewChunk(NewChunkPosition, chunk.gameObject);
    122.             }
    123.  
    124.             if(chunk.position.y < PlayerAvatar.position.y - (MaxPerAxisDistance * ChunkEdgeLength) - (ChunkEdgeLength * 0.5f)) { // then chunk is too far below
    125.                 Vector3 NewChunkPosition = chunk.position + new Vector3(0.0f, (float)NumberOfChunksPerAxis * ChunkEdgeLength, 0.0f);//
    126.                 SwapOldChunkForNewChunk(NewChunkPosition, chunk.gameObject);
    127.             } else if(chunk.position.y > PlayerAvatar.position.y + (MaxPerAxisDistance * ChunkEdgeLength) + (ChunkEdgeLength * 0.5f)) { // then chunk is too far above
    128.                 Vector3 NewChunkPosition = chunk.position - new Vector3(0.0f, (float)NumberOfChunksPerAxis * ChunkEdgeLength, 0.0f);
    129.                 SwapOldChunkForNewChunk(NewChunkPosition, chunk.gameObject);
    130.             }
    131.  
    132.             if(chunk.position.z < PlayerAvatar.position.z - (MaxPerAxisDistance * ChunkEdgeLength) - (ChunkEdgeLength * 0.5f)) { // then chunk is too far behind
    133.                 Vector3 NewChunkPosition = chunk.position + new Vector3(0.0f, 0.0f, (float)NumberOfChunksPerAxis * ChunkEdgeLength);//
    134.                 SwapOldChunkForNewChunk(NewChunkPosition, chunk.gameObject);
    135.             } else if(chunk.position.z > PlayerAvatar.position.z + (MaxPerAxisDistance * ChunkEdgeLength) + (ChunkEdgeLength * 0.5f)) { // then chunk is too far ahead
    136.                 Vector3 NewChunkPosition = chunk.position - new Vector3(0.0f, 0.0f, (float)NumberOfChunksPerAxis * ChunkEdgeLength);
    137.                 SwapOldChunkForNewChunk(NewChunkPosition, chunk.gameObject);
    138.             }
    139.             yield return true; // Still running
    140.         }
    141.         readyToEvaluateChunks = true; // Done running
    142.     } // End EvaluateNearbyChunks
    143.  
    144.     void OnGUI () {
    145.         GUI.Label(new Rect(10,10,200,20), "Savegame Name: ");
    146.         SaveGameName = GUI.TextField(new Rect(210,10,200,20), SaveGameName, 127);
    147.         GUI.Label(new Rect(10,30,200,20), PlayerAvatar.transform.position.ToString ("f3"));
    148.         GUI.Label(new Rect(10,50,200,20), readyToEvaluateChunks.ToString ());
    149.    
    150.         GUI.Label(new Rect(10,70,200,20), MaxPerAxisDistance.ToString ("f3"));
    151.         GUI.Label(new Rect(10,90,200,20), ChunkEdgeLength.ToString ("f3"));
    152.     }
    153.  
    154.     private void SwapOldChunkForNewChunk(Vector3 NewChunkPos, GameObject OldChunk) {
    155.         SaveChunkToDisk(OldChunk.gameObject);
    156.         DeleteChunk(OldChunk.gameObject);
    157.         PlaceNewChunk(NewChunkPos);
    158.     }
    159.    
    160.    
    161.     private void SaveChunkToDisk(GameObject ChunkToSave) {
    162.        
    163.         ChunkFileName = "Chunk_" + ChunkToSave.transform.position.x.ToString("f0") + "_" + ChunkToSave.transform.position.y.ToString("f0") + "_" + ChunkToSave.transform.position.z.ToString("f0") + ".txt";
    164.         ChunkFilePath = Application.dataPath + "/../Saved Games/" + SaveGameName + "/" + ChunkFileName;
    165.         ChunkFileData = "foo"; // This is what you modify to save anything interesting about the chunk.
    166.  
    167.         if(!Directory.Exists(Application.dataPath + "/../Saved Games")) {
    168.             Directory.CreateDirectory(Application.dataPath + "/../Saved Games");
    169.         }
    170.  
    171.         if(!Directory.Exists(Application.dataPath + "/../Saved Games/" + SaveGameName)) {
    172.             Directory.CreateDirectory(Application.dataPath + "/../Saved Games/" + SaveGameName);
    173.         }
    174.  
    175.         if(!File.Exists(ChunkFilePath)) {
    176.             Debug.Log ("Writing chunk data to filesystem");
    177.             File.WriteAllText(ChunkFilePath, ChunkFileData);
    178.         }
    179.     }
    180.  
    181.     private void DeleteChunk(GameObject ChunkToDelete) {
    182.         // Automatically deletes child objects, too.
    183.         // If you're using pooled objects like monsters or explosion fragments,
    184.         // you need to unparent them from the chunk, otherwise you'll lose them
    185.         // and lost the whole efficiency advantage of pooling.
    186.         Destroy(ChunkToDelete);
    187.     }
    188.  
    189.     private void PlaceNewChunk(Vector3 NewPosition) {
    190.         ChunkFileName = "Chunk_" + NewPosition.x.ToString("f0") + "_" + NewPosition.y.ToString("f0") + "_" + NewPosition.z.ToString("f0") + ".txt";
    191.         ChunkFilePath = Application.dataPath + "/../Saved Games/" + SaveGameName + "/" + ChunkFileName;
    192.  
    193.         if(!File.Exists(ChunkFilePath)) { // Generate a procedural chunk
    194.             GameObject ProceduralChunk = Instantiate(ChunkPrefab,transform.position,Quaternion.identity) as GameObject;
    195.  
    196.             // Parenting the chunk to a container makes iterating through the chunks a breeze in EvaluateNearbyChunks(), below.
    197.             ProceduralChunk.transform.parent = gameObject.transform;
    198.             ProceduralChunk.transform.position = NewPosition;
    199.             ProceduralChunk.transform.rotation = Quaternion.identity;
    200.  
    201.             // Tart up the chunks with some attributes to serialize into save files later
    202.             Color ChunkColor = new Color(Mathf.Abs (ProceduralChunk.transform.position.x / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.y / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.z / 255.0f), 1.0f);
    203.             ProceduralChunk.renderer.material.color = ChunkColor;
    204.             ProceduralChunk.transform.localScale = new Vector3(0.9f * ChunkEdgeLength, 0.9f * ChunkEdgeLength, 0.9f * ChunkEdgeLength); // Make borders more visible by adding a small gap
    205.         } else {
    206.             Debug.Log ("Reading chunk data from filesystem");
    207.             ChunkFileData = File.ReadAllText(ChunkFilePath);
    208.             GameObject ProceduralChunk = Instantiate(ChunkPrefab,transform.position,Quaternion.identity) as GameObject;
    209.  
    210.             // Parenting the chunk to a container makes iterating through the chunks a breeze in EvaluateNearbyChunks(), below.
    211.             ProceduralChunk.transform.parent = gameObject.transform;
    212.             ProceduralChunk.transform.position = NewPosition;
    213.             ProceduralChunk.transform.rotation = Quaternion.identity;
    214.             ProceduralChunk.transform.localScale = new Vector3(0.9f * ChunkEdgeLength, 0.9f * ChunkEdgeLength, 0.9f * ChunkEdgeLength); // Make borders more visible by adding a small gap
    215.            
    216.             if(ChunkFileData == "foo") { // Process filesystem's chunk savedata into the freshly instantiated chunk's attribute(s)
    217.                 ProceduralChunk.renderer.material.color = new Color(Mathf.Abs (ProceduralChunk.transform.position.x / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.y / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.z / 255.0f), 0.1f);
    218.             } else {
    219.                 ProceduralChunk.renderer.material.color = new Color(Mathf.Abs (ProceduralChunk.transform.position.x / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.y / 255.0f), Mathf.Abs (ProceduralChunk.transform.position.z / 255.0f), 1.0f);
    220.             }
    221.         }
    222.     }
    223. }
    224.  
     
    Last edited: Oct 22, 2013
  6. Mike Jasinski

    Mike Jasinski

    Joined:
    Sep 30, 2013
    Posts:
    1
    I can't open it, either it gives me an error or there appear strange characters.
    Can anyone help me?
     
  7. zephren

    zephren

    Joined:
    Dec 7, 2012
    Posts:
    25
    Hello,
    I am following this tutorial you posted on youtube: http://www.youtube.com/watch?v=QkkOkgSYph4 and I literally get nothing on the scene. In the inspector I am getting some coordinate data but there is not terrain on the scene. I am using the latest update from the asset store and Unity 4.2.of4.

    I would really love more Youtube videos of you just doing stuff. to help me. I really don't want to use your demos but a how to from scratch. especially in creating a large terrain.

    thanks
     
  8. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    @Mike: try this copy: https://dl.dropboxusercontent.com/u/26291791/Marching Cubes Doc.pdf
    It's the same as in the package but maybe a separate download will be readable.

    @zephren: I will certainly be making more videos, as time allows. Did you try putting your game object with the ruaumoko terrain at 0,0,0? Also, spin the scene view around (and zoom in-out) to make sure you're looking down at the terrain (looking up from underneath will be invisible). Try changing the Random Seed value too, a different number might show up quicker. Be sure to hit "clear voxels" when you make parameter changes.
     
  9. zephren

    zephren

    Joined:
    Dec 7, 2012
    Posts:
    25
    Still no luck, I have an error that is probably what is effecting my terrain from being created, I have taken a snapshot:
    $Clipboard Image.jpg

    it basically says the following:
    UnityException: Tag: Sculptable is not defined!
    RuaumokoTerrain.GenerateNewCellEditor (Int32 x, Int32 y, Int32 z) (at Assets/Dr B Games/Ruaumoko/RuaumokoTerrain.cs:446)
    RuaumokoTerrain.GenerateNewCells (Int32 count, Vector3 nearThis) (at Assets/Dr B Games/Ruaumoko/RuaumokoTerrain.cs:431)
    RuaumokoEditor.Add () (at Assets/Dr B Games/Ruaumoko/Editor/RuaumokoEditor.cs:364)
    RuaumokoEditor.OnSceneGUI () (at Assets/Dr B Games/Ruaumoko/Editor/RuaumokoEditor.cs:135)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.SceneView.CallOnSceneGUI () (at C:/BuildAgent/work/cac08d8a5e25d4cb/Editor/Mono/SceneView/SceneView.cs:1392)
    UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/BuildAgent/work/cac08d8a5e25d4cb/Editor/Mono/SceneView/SceneView.cs:872)
    UnityEditor.SceneView.OnGUI () (at C:/BuildAgent/work/cac08d8a5e25d4cb/Editor/Mono/SceneView/SceneView.cs:761)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222
     
  10. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    This question has already been answered on this thread here. Kind regards.
     
  11. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    Bens1984: A few quick documentation questions-- for RuaumokoTerrain.cs, the cellSize variable is expressed in units of unities (meters), right? Also, cellSize and (simplex)noiseSize come factory-preset at power-of-two values. Is that important for functionality or performance, or are arbitrary integer values OK?
    Thanks!
     
  12. zephren

    zephren

    Joined:
    Dec 7, 2012
    Posts:
    25

    @LoganPark, brilliant, but I already saw that and did that and still get nothing. also, I want to do HIS video tutorial and get HIS results without a work- around. Kind Regards.

    I want to create my Ruaumoko terrain according to the tutorial as I like what I see from the videos. I think just doing a screen video time lapse video would do wonders even if you do not yet have your pdf's ready. to see the results. and expand from there, so I need to insure I have the same asset base or set up that he has to get the desired results.

    his video shows several simple steps.
    1. create empty gameobject
    2. rename to RTerrain
    3. set up Material
    4. create directional light.
    5. check perlin noise.
    6. change warp strength to "0"
    7. select scene anywhere and "viola"

    SO, my question is why do I not get that?


    also, each time I do something, I appear to get less results the first time I did his video, I got ONE chunk with textures and nothing more, now no matter what I do, I am getting NO chunks and no thin box denoting where chunks should be as some have reported. I get in my "Terrain" drop down one chunk coordinate.
     
  13. Ragamuffin

    Ragamuffin

    Joined:
    Oct 3, 2013
    Posts:
    4
    LoganPark, did you manage to have any luck with scaling your terrain to the resolution you're looking for? I actually want to reduce the scale to 1,1,1 and I'm having the problem where the individual cells seem to be using the same spacing as when the terrain was at 2,2,2 which then causes big rifts between them. There's a big vacant border around each patch of terrain when the terrain is scale is brought down.

    Is anyone else using height maps? I have noticed when a pre-generate the terrain before playing the game, I just get flat planes, as if it's not using the heightmap to pre-generate the terrain.
     
  14. Ragamuffin

    Ragamuffin

    Joined:
    Oct 3, 2013
    Posts:
    4
    Also, if I try to just hack in a change to fix the positioning of these patches of terrain it'll cause my computer to choke so that's not likely the answer:

    private IEnumerator GenerateNewCell(int x, int y, int z) {
    GameObject child = (GameObject)GameObject.CreatePrimitive(PrimitiveType.Plane);
    child.name = new Vector3(x,y,z).ToString();
    child.transform.parent = transform; // attach this new child to us.
    ** child.transform.localPosition = (new Vector3(x,y,z) * cellSize -- here --> / # <----- ); // put it in the correct position. //Matrix4x4.Scale(transform.localScale) *
    child.transform.localScale = Vector3.one; // if we're scaled somehow then the attachment will cause the child's scale to = 1/our scale. Reset it here.
    child.GetComponent<MeshFilter>().sharedMesh.Clear();
    child.tag = "Sculptable"; // must be set or the sculpt tool won't interact with it!
    child.layer = 8; // also for sculpt tool to work.
     
  15. Ragamuffin

    Ragamuffin

    Joined:
    Oct 3, 2013
    Posts:
    4
    One last reply, and I'll promise to stop pestering.

    I've noticed that the world is tiling the heightmap that I'm using. Unlike most, I don't plan on making endless terrain. I want the size of my terrain to be constricted to the area that a single heightmap covers. There *must* be a simple fix for this. However, when I recalled going through this, it seemed like there was a method being called that cycles through the data on the heightmap and continually does so from the beginning again when it runs out of heightmap to use, and I'm not exactly all that familiar with this type of code so I wouldn't even know where to begin getting that method to recognise the end of the height map and just come to a full stop when it has been completed.
     
  16. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    My apologies to you, zephren, I truly did not mean to offend with that post. I hope that the upcoming documentation from Bens1984 helps to resolve the bugs you're experiencing.


    @Ragamuffin:
    Yep, it worked fine when scaling things up by arbitrary orders of magnitude. No seams, at least within the areas I explored. I'm finding that getting the right scale, number of octaves, chunk sizes, warping, and detail level are proving to be a thorny multivariate optimization challenge. :) I should note that I did a clean uninstall/reinstall of the Ruaumoko package when upgrading to the current version. I was having all kinds of problems until that point.
     
  17. Scooterman

    Scooterman

    Joined:
    Oct 1, 2013
    Posts:
    11
    Hello bens,

    I have a few questions before trying your engine, as I was unsuccessful with a previous purchase (of another one):

    - I'm able to generate terrains programatically? I'm going to use the lib on a multiplayer game so I need to update the terrain on a per interval basis.
    - How fast is the engine to do so?
    - I'm able to create squared structures, like planks?
    - I'm able to mainain in memory only the current viewed terrain? Or the terrain has to be pre-generated from beginning?
    - And the catchy one: I'm able to use the terrain in a X/Y axis? Or, can I have huge heights? I'm willing to use it for a 2D platform game.


    Cheers,
     
  18. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Hi there,
    I have a question:
    -How can I create a MC mesh (a sculpt-able one) from a 3d array of Bytes or short ints (density from 0 to 255)? (e.g. M*N*O)

    Thanks in advance
     
    Last edited: Oct 17, 2013
  19. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    Right, so Ruaumoko is tremendously fun to work with. Have been having a blast these weeks. I hope other folks are too.

    Question for Ruaumoko support: I just picked up a multithreading package from the asset store. If it's possible, I'd like to push Ruaumoko chunk generation/monitoring/updating/saving into parallel threads. Perhaps one thread per chunk, seems like an easy way to go to start with. That way Unity can offload some heavy lifting onto any available processor cores. Is there any part of Ruaumoko's core functionality that wouldn't be thread-safe? I recall the hiccup in updating a chunk with the sculpting tool to be based on updating the mesh collider by unloading, updating, and reloading the main thread. Would that be a thread-safe thing?

    Obviously, the only way to know is to try, but if you have any pointers, I'll gladly accept them as I go.
     
    Last edited: Oct 22, 2013
  20. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    sorry for the delay in response to the thread. I've been swamped, but am finding some time to move this asset ahead again! Please send me a pm if you have a key question I can help with!

    @LoganPark: I'm not aware that Unity can handle multiple cores (it couldn't a couple months ago). Multi-threading yes, but it doesn't give any performance gain on one CPU, and lots of semaphores could introduce inefficiencies on a single core. I'd be happy to check it out again–I'm waiting for the day when they introduce multi-core support into Unity!

    The powers of 2 for noise are purely arbitrary–the results are varied and somewhat Earth-like.

    @zephren: did you get things working?

    @Curious: look at the ice demo (where the world is made up of a handful of sculptable blocks). Dig into the script that generates those blocks and you should be able to find the place where you can stick in your own data (or a function to get your 3D data in).
     
  21. Puertorro

    Puertorro

    Joined:
    Oct 22, 2013
    Posts:
    3
    I was wondering if this asset allows the players to be able to terraform as well. I want to use it to make a sandbox MMO and the players must be able to dig, mine, cut trees, etc...

    I need to know if this is the right asset for me.
     
  22. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    What do you mean by "multi core support"? There's no need to support anything there. The os schedules the threads accross cores/procs/ht/ whatever hardware you have available. Since unity exposes threads of course you can use up all cores by spliting the works on multiple threads
     
  23. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    ronan - The Unity engine API doesn't support multiple threads or parallel (true multi-CPU/core) code. However it's possible to run regular old code in other threads to push back to the main thread, which can call all the Unity Engine functionality (this seems to be what Loom is doing–also in this post). As you say, there is talk that multiple threads will be shared across multiple CPUs in Unity (the magic of .NET?), but I'm not sure if this is true or how it happens. I'd be glad to know more (I wrote a multi-threaded version of Marching Cubes but it didn't gain any performance and only caused many management issues. If things have changed I'll happily bring it back!)

    This post sums up what I understand to be the current condition of Unity re: multi-CPU.
     
  24. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722

    You're mixing 2 things. The unity api doesn't support multithreading (it's not thread safe) this has nothing to do with cores. If you want to call a unity provided function, you need to do it from unity's thread.

    However miltithreading works just fine and OF COURSE uses all your ressources as possible (that's the OS's job)

    If your multithreaded code is as slow as the single threaded one it comes from issues innyour code, multithreading isn't a trivial subject and you need to learn to do it properly (if you're locking ressources all the time then it cannot be faster as each thread will wait on the other one, it will even likely be slower, this has nothing to do with unity)

    If you have slow multithreaded code, post it here i'll be happy to help a bit
     
  25. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    310
    I'm still here... stuck in hospital after a skydiving accident. No wifi out
    here.( Western Australia) I still thinking heaps about my voxel based oculus Rift game. Can't wait to crack into it again.
     
  26. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    In your Liquid Demo how did you achieve that? Can you elaborate?
     
  27. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    SO this is the only thing I have ever been able to get to create..?

    $Terrain.png
     
  28. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    Release 1.02 Incoming!

    Be sure to update if you're using the editor functionality, it's made some significant progress. I've implemented a "paint" cursor in build mode that shows where the surface is under your mouse, even if the scene is empty (no more hunting for the voxel blocks or making lots of empty ones first). There are also many little tweaks behind the scenes that should speed things up.

    @VicTo: that's a crazy image! The liquid demo was done using a meta-ball simulation (search around, you can find details on the algorithms), but it's rough and highly CPU intensive.

    ok, multi-threading will have to come back on-line. Previously I was handing the blob of Marching Cubes off to a second thread but if threads will share the CPUs then parallelizing the march will be where the win occurs.
     
  29. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    727
    Hi there , like your system. one question any idea when you will have maybe grass and tress ability to generate on terrain, also any why to do diferent Bioms? I send you a PM about some opportunities we have. Let me know if you received it.

    Thanks
     
  30. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    57
    I'm looking for example of dual marching cubes algorithm implementation. Does your system use ordinary dual contouring? It creates many redundant triangles.
     
    Last edited: Nov 1, 2013
  31. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    310
    updated to latest version 1.02 still not able to see the terrain in edit mode ??
    I can now see a transparent green block in the editing window that follow my cursor.
    I can change the size of the block "ADD" i.e.. click several times see the "Ruaomoko Terrain" node update adding several children with coordinates as names.
    I can also hit "Clear Voxels" the list is removed. BUT I can't see any voxel terrain in my viewport. (only when I hit play do I see the terrain )

    When I hit play I can walk across a voxel terrain but it's blocky... ( not as smooth as my old terrain.. I had before updating to editor mode.)

    back in Edit .. " Paint Mode " I can see a small sphere that follows my cursor.. but I still can't see any voxels :(
    p.s - I am running Unity 4 Pro 4.2.2

    [EDIT] OK I can see something.... a mesh !!! OMG !! I can see it ..... a very small mesh.. its transparent. but I only see a mesh when I click on the child terrain node in the Hierarchy list ( under "Ruomoko Terrain" ) hhmm.. I changed the size from 32 to 128 .. now its bigger... but still can't edit it.. because I must click Ruaomoko Terrain (in the Hierarchy window) then the terrain mesh is no longer visible.
    Note: I tried adding a second terrain node. this new node is not visible as there is no mesh data assigned under its Mesh Collider. I notice that when I ADD terrain mesh in the scene only occasionally does an actual node contain mesh data... so for example if I have a terrain list of 10 terrain nodes objects in the Hierarchy... only 4 of them might contain mesh data. All the others are empty. Why is this ??

    so it seems my problem is in the generation of data mesh. it seems sporadic in its creation. If I click the I'm not sure how I was able to visualise the generated mesh data in one of my earlier child terrain objects.

    hhhmmm ??
     
    Last edited: Nov 5, 2013
  32. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    First, I want to point everyone to a tutorial document I'm drafting on how all the parameters of Ruaumoko work and how to get control of them:

    Ruaumoko Tutorial

    Please let me know what else you would like to see in this tutorial, or another one.

    @Banksy: I'm not sure what all the problems you are having are, and I'm sorry to hear they are cropping up! I created a new project, imported the asset package, and I can create a pink mesh right away (green block cursor shows up and the "texture not found" pink on the meshes). Did you find the menu items that create the Ruaumoko Terrain game object automagically for you?

    Are you getting any warnings in the Console window? If the scene isn't saved it will complain–save the scene then hit the "Apply Parameters" button on the terrain component. Making a video with voice over is on my list, and when that's done it might uncover something.
     
  33. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    310
    Ok after following along with the Tutorial.

    Here's what I'm now getting:

    I add green blocks to the scene, I get:
    1.) no warnings in the console window.
    2.) I see no terrain being generated no wireframe cubes being created in the scene view. BUT ...

    3.) If I click on RTerrain (in the Hierachy) then click its Layer "Default" choose " Yes change Layer children" I now see the voxel terrain if I'm lucky one or two other blocks containing voxel terrain.

    4.) Now I can edit the terrain in the Editor window :) its slow updates slowly but I can sculpt the terrain...

    5.) when I hit play I can see my results .. but the terrain is blocky, not as smooth as the default terrain... hhhmm ?

    additional notes: when I click to create blocks in the scene view... the generated terrain only fills a very small portion of the block.. 5% max. so any other adjacent blocks leave huge gaps between voxel terrain.

    I'm now adjusting octaves, warp etc.. I find creating blocks is very sporadic.. sometimes they will establish. other times not.... So I simply hit REMOVE EMPTY BLOCKS then start clicking with the Green block brush again. then hit default layer, accept "YES Change Children.". then I see extra blocks... I then delete any empty blocks repeat the process till I end up with a suitable terrain.
     
    Last edited: Nov 6, 2013
  34. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    Hm, banksy, that sounds very strange. The layer issue is weird–like your scene view in the editor is hiding some layers?

    The blocky-ness of the terrain can be controlled by the "smoothness" slider in the inspector pane (you have to hit the "reload" button to see the changes). But it should be fully smooth by default, so this is also strange.

    If you could PM me some screen shots I might have a better idea why things are working in such a wonky fashion for you!
     
  35. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    I've been looking into your offering and have a few questions:
    • can i use 3rd party shaders such as marmosets toolbag for texture splatting or others?
    • LOD? can I tessellate or do I need to?
    • using the webdemo of building a planet that you provided, I tried a planet of 512.. it ultimately crashed the player as well as taking forever to build. So the only way to scale is part of the generation?
    • vegetation? trees?
    • surface water?
    • performance? is it cpu bound only or are some things offloaded to the gpu other than textures?
    • dx11 compatible?

    I'm looking into your product for a space simulation and have never used a voxel engine before. I understand the concepts etc, however it's the implementation that I'm unsure about, as well as performance.

    After reading this thread, I'm a bit reluctant about laying out 75$ on a product that i'm unsure will fit my needs, is there a trial that I can look at and test? granted, 75$ isn't a *huge* deal, but I've had other experiences where a product did 99% of what I wanted, but didn't do the 1% I needed, thus making it not only a waste of money, but more importantly, of time..

    your product will solve a bunch of things on my want list such as, the detail level, space-to-planet transitions, the procedural generation etc, but I plan to have many, MANY planets including moons etc etc
     
  36. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    310
    I finally worked out why my terrain blocks were not showing as I clicked in the scene... Layers was set to default only. I changed it to Everything.
    Now I can place blocks down as I drag around in the viewport.

    note: For some reason I'm seeing two terrains when I hit play. One beneath the other but there's only one node in the Hierachy I can only see one in the scene view... When I hit play drop down onto the terrain then try to create a hole, it does not dig... but if I walk to the edge of the terrain I can see another terrain approx. 2m below so I drop down onto it this lower terrain reacts to digging and filling.
     
  37. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    any thoughts on my questions bens1984?
     
  38. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    435
    Is it possible to add data/sculpt?
    If not, can it be a future feature?

    (It's doable in Voxeland. It adds a compelling aspect.)
     
  39. Hynopsis

    Hynopsis

    Joined:
    Oct 25, 2012
    Posts:
    54
    I am using the dc version but the last responce was months ago...anyhow there are a couple of methods that are called and i cant find the class they belong to or where they are being called at. Both methods CalcCubeCases and CalcVertIds. I have seached all the scripts and cannot find them anywhere any ideas?
     
  40. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    @Marionette:
    • you can use 3rd party texturing. The terrain is constructed as many small-ish meshes (each is typically 8x8x8 world units), and ensuring splats bridging the seams I could see being an issue.
    • The big delay in responding to you has been development of the LOD system. It will automatically generate user-specifiable levels of detail and swap them, including saving and unloading from memory.
    • The planet web demo shows the impracticality of bulk generating large objects (512x512x512 is a lot of data for the webplayer). I'm hoping the LOD system will allow planets to be populated more dynamically.
    • vegetation trees: have to be placed manually at the moment.
    • surface water: nothing special is included
    • performance: the demos are all on the main thread, so it is CPU bound (GPU is only doing texturing/lighting/etc.) The next release will be using other threads and have greatly increased frame rates
    • dx11: hasn't been tested, it's not expressly taking advantage of dx11 features.

    @shwa: do you mean like when you right-click in the demos? That "builds" rather than digging. If this isn't what you mean then can you explain "add data" further?

    @Hynopsis: the functions you're looking for are in MarchingCubes.cs (DualContour subclasses it). You should have that file (or it would be throwing crazy errors). Let me know if you can't track it down.


    Current developments in LOD, paging, and threading are looking great! I'm hoping to drop a teaser demo and get it released soon.
     
  41. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    435
    bens1984 :
    @shwa: do you mean like when you right-click in the demos? That "builds" rather than digging. If this isn't what you mean then can you explain "add data" further?

    ---
    Tx for the right click tip to build. On macs, right click brings up the full screen option, and not the build function.
    Once i go into full screen, then right click for build works. looks pretty good.
    "add data" just meant build.

    I think unity has a need for sculpting tools within unity.
    either for developers in authoring, or to offer to players during run time.

    While Ruaumoko and others offer this, to some extent,
    i'm looking for a robust and flexible solution for various sculpting purposes.
    For myself, and also to offer to players in runtime.

    Creating/sculpting is fun and empowering.
     
    Last edited: Nov 20, 2013
  42. Zynx87

    Zynx87

    Joined:
    Oct 31, 2013
    Posts:
    9
    I'm attempting to create 2 new sculpting tools. One that places a sculptable cube, and one that deforms terrain
    much like the currently sculpting tool, however the deformation is limited to within a single cube (as in,
    they must click again within a new highlighted voxel to start shaving/building up terrain on that voxel).

    I'm brand new at this, so I'm going to lay out my understanding of the system and how I'm going to try to go
    about this, which is likely going to be incorrect or there may be a better way to do it, so any advice
    is appreciated.

    As I understand it, the generation of terrain goes:
    densitymap -> cells -> GameObject child -> VoxelBlock -> March(), which ends with assigning triangles and meshing

    I'm wondering if the float densitymap can be interpreted as 0 = all air, 0-1 some air/some solid, 1 = all within
    mesh

    I'm assuming one vector unit is the same as one coordinate unit in Unity.
    Each densitymap point is a vector, according to GenerateDensity method within RuaumokoDensity.
    Each cell is also a vector, and cellsize = 8. If a cell is also a single VoxelBlock, then
    a VoxelBlock is 8x8x8 coordinate units, or 8 points within a densitymap. While density map is 64
    (according to RuaumokoDensity), does that mean one chunk, or one densitymap, is 8 voxels/cells total
    (as in a chunk of cubes 2x2x2)?

    1)To start I'm going to try to make VoxelBlock/Cell visible by highlighting the edges of the targeted voxel.
    I'm guessing to raycast up to a certian distance until a VoxelBlock with float densitymap !=0 is found, then get
    the edges of that voxelblock and highlight them.

    2)Make a CubePlacementTool, which places a cube that is sculptable. I'm guessing raycast up until a certain
    distance, until it meets a voxelblock, then I've have to grab the cell/
    voxelblock's densitymap, and turn all the values for that block to 1. I'm not sure if the methods exist to get
    a voxelblock's densitymap, so I'll probably have to make those, set the values, then maybe GenerateNewCell (x,y,z).

    Alternatively, I wonder if it might be possible to do some kind of instant sculpt on the voxel block that fills it.
    To be honest, the terrain deformation math is very difficult for me to grasp.

    3) This leads up into a TerrainDeformationTool, which deforms according to the current math, but is
    limited to one VoxelBlock (does not effect neighbors). I'm a bit lost here... IEnumerator Sculpt passes to
    neighbors, maybe if I just remove that.

    I'll begin work on this tomorrow night.
     
  43. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    by way of apologizing for not replying to the last two posts more quickly I'm attaching a screen shot of what I'm working on now... dynamic grass, automated LOD meshes, and threading (performance is looking great on multi-core machines). I'll have a demo up shortly, and will answer the posts!

    $Screen Shot 2013-11-20 at 11.12.36 PM.jpg
     
  44. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    Oh SWEET MERCY release this before Thanksgiving break so we can break^H^H^H^H^H I mean play with multithreading. <3
     
  45. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Thanks for the great features up coming ;)

    Have you looked into HistroPyramids and OpenCL yet? OpenCL would make much sense because Marching Cubes is naturally compatible with parallel processing, and the use of of GPU instead of the CPU for that matter, what do you think?
     
  46. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    Vrs. 1.03 is Live on the Store!

    This includes threading throughout the terrain generation system, giving greatly improved performance on multi-core machines. At the moment the Marching Cubes itself is still single-threaded (but off the main thread).

    I've been getting inquires about procedural trees/grass/etc. so this version has a "beta" grass engine. Please let me know how it works for you! At the moment it only plants billboards on the ground, but extending it to detail meshes is in the pipeline.

    Please backup your projects before upgrading to this version! I fixed an error in the block-size/gutter calculation (i.e. how many extra voxels it uses to generate each chunk in the world) which leads to more optimal performance, but may produce gaps in old code. If you are using your own scripts and see problems try increasing or decreasing your block size by 1. (Ex: a block of 8x8x8 needs to actually be 9x9x9 for Marching Cubes to run.)

    @Zynx87- how did you get on? Your reasoning sounds good. If you don't need the blocks to be able to join together then you can look at the Ice Sculpting demo (scene #2, iirc). That scene is made up of discrete blocks that don't share sculpting actions. You could allow the user to spawn one of these blocks where ever they like and deform it at will. If you want them to be able to be contiguous then the RuaumokoTerrain modifications is the direction you want to go, but deny the "SendMessage("DoSculpt"...)" stuff that each block forwards to its neighbors. You might get seams, so some math may be needed to ensure things stay stitched together.
     
  47. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    I'm getting a "Assets/Plugins/Plugins/MarchingCubes.cs(326,38): error CS0117: `Loom' does not contain a definition for `RunAsync'" error after importing the 1.03 Ruaumoko package... Recommendations? Otherwise pretty excited... Ruaumoko accounts for about 65% of the time per frame on my project, so multithreading is going to rock.

    EDIT1: looks like you need to move the loom.cs from the Ruaumoko plugins folder to Standard Assets/Scripts or similar for precompiling. Or something like that. Hope this helps the next person.

    EDIT2: Here's how I got Ruaumoko 1.03 up and running from a modified existing installation of 1.02:
    * Backed up all my modified C# scripts from Ruaumoko 1.02
    * Deleted Ruaumoko folder/assets from project hierarchy (I tend to move a few things around as I work from their source folders)
    * (Optional) Bought and imported LOOM framework, currently on sale, from the asset store for detailed examples of how to work with multithreading
    * Imported Ruaumoko 1.03, hooked everything back together with the updated scripts.

    EDIT3: Haha! I'm seeing 4x the old frame rate (now ~80 fps) and the auto-LOD system is great. Seeing some seams at the LOD boundary, but I'm sure that's fixable without too much heavy lifting. Ruaumoko is such a steal at $75. Have a great Thanksgiving, Dr. B.
     
    Last edited: Nov 27, 2013
  48. bens1984

    bens1984

    Joined:
    Jan 18, 2013
    Posts:
    84
    $@ Sorry about the Loom error. Glad you found the solution, LoganPark. I keep it in Ruaumoko/Core/Plugins which should have it loading first–but where ever works.

    Yes, the LOD meshes don't try to cover the seams yet. I'm working on solutions next–the best seems to be to show both meshes at the transition area and modify the shader to cross fade between the two. But we'll see what pans out! Thanks for the support, L.P.!
     
  49. Zynx87

    Zynx87

    Joined:
    Oct 31, 2013
    Posts:
    9
    Very good, I've had actual progress which is a huge achievement for me, you are right about removing the neighbor business from VoxelBlock. I was trying to figure out how to grab what would essentially be "this.Voxelblock", but neighbors[14] seems to work.
    I then went into SimpleSculptTool, stopped the Raycast when it moved to a different collider by resetting input. This keeps the deformation within the cell, and they have to click again to continue deformation.

    As for highlighting the targeted cell, I'm thinking changing the shader through a raycast might be the easiest. I'll just have to learn how to write a custom shader that highlights the edges of the cells. The default Toon/Lighted Outline is close as it highlights mesh edges, but it doesn't consider the edges of the cell as a mesh edge since neighbors connect.

    The seams will be troublesome. Ideally, the mesh edge of that neighbor cell should never lose the mesh edge of the cell being deformed. Considering the neighbor cell mesh edge is always in the same location during a deformation (since I am not affecting neighbors), maybe there is a way to tell the cell that the mesh must always end at the location - it is effectively anchored there. I'll probably tackle this tomorrow night.

    CubePlacement is something I haven't given enough thought yet, although I had considered the IceSculpting's DynamicSculpting but I want it to be contiguous with the rest of the terrain. Maybe if I can tackle the terrain deformation issue, it will solve this problem as well. Something like an instant sculpt filling the entire voxel cell.


    Thoroughly impressed with the asset Dr. B, it is greatly valuable to me from what I have learned from it, and for what I have planned (although to be fair its the only one I've ever tried!).
     
  50. LoganPark

    LoganPark

    Joined:
    Aug 30, 2013
    Posts:
    22
    I am full of turkey, cranberries, and Ruaumoko ideas.