Search Unity

[uTerrains] Ultimate Terrains - Voxel terrain engine

Discussion in 'Assets and Asset Store' started by Amandin-E, Feb 4, 2016.

  1. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    If you want to edit it in Blender at the end, why don’t you just create it from scratch in Blender directly?

    I just wanted to let you all know that the next update may be a bit late (a few weeks more). I have a lot to do and I also have to work on something else temporarily.
    But don’t worry, it will come!
     
  2. joferjoe

    joferjoe

    Joined:
    Feb 2, 2016
    Posts:
    95
    Its really fast to block out a lovely looking terrain with your tool


    but i wanted to try and make some bad north style islands and adding some little cliff details seemed easier to export and make it a model then reimport as just a mesh :D

    I might just be overthinking though o_O
     
  3. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    I really like the design of this! Really cool! Did you make it with custom generators or did you make it manually with operations?

    The thing I don’t like with static meshes as terrain is that you lose the LOD system.
     
  4. joferjoe

    joferjoe

    Joined:
    Feb 2, 2016
    Posts:
    95
    I didn't make it, its a game called bad north, i just wanted try and replicate it :D

    And yeah its not ideal for use in most scenarios

    I just wanted really small no lod islands for this one specific thing i wanted to try though :)

    I wont have a chance to work on it for a couple weeks, but when i do i guess my question is how do i access the mesh filter info?

    Since everything isnt nested transforms anymore im not 100% sure how to access the chunks mesh info o_O
     
    Last edited: Nov 13, 2018
  5. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    I tried the demo and when loading the scene-generating the terrain, it finished blocking my pc (after ten minutes of loading).:mad:
     
  6. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    Are you talking about the downloadable, playable demo available on uterrains.com ?
    What is your hardware configuration and OS?
     
  7. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    Yes.
    I tested on Intel Core i5- 4570, 3.20 Ghz, 4 Gb RAM, Windows 10 Pro 64 bits. I suppose the problem was lack of enough RAM. I have tested other voxel solutions for Unity and they work fine in that machine.
    Not tested in my other PC. I have another one, for gaming, but, sincerely, I expected a better overall performance,( at least loading the scene...).:(.
     
  8. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    That’s weird. The demo should take about 1GB of ram. And your cpu is more than enough. Could you send me the logs please?
     
  9. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    145
    Hi
    I went back to the project using this package.
    I downloaded the latest version (4.1), but during testing I had problems:
    1. Merge operations still work crookedly (but they can be disabled, so this is unpleasant, but not critical)
    2. If I create an operation in a specific place, errors will begin. For example, I ran a little along the X-axis, and got this error (screenshot):
    upload_2018-11-15_13-37-36.png
    In other places on the X-axis, I do not get this error. Only in a specific area and provided that I create an operation at about Z = 0
    Amount LOD: 1
    Cache: 0
    Shadows, colliders: 1
    Chunks: 8 (xz) / 4 (y)
    Unity 2018.2.7
    The problem repeats with any of the operations.
    Code (CSharp):
    1.     public void UpdateForCustom(Vector3 wpos)
    2.     {
    3. //wpos = Player_position+Vector3.up/4
    4.         if (Terrain.OperationsManager.IsReadyToComputeAsync)
    5.         {
    6.             Terrain.OperationsManager
    7.                    .Add(Cylinder.CreateFromUnityWorld(Terrain, false, wpos, wpos+Vector3.up*1.5f, 2, voxelType), false)
    8.                    .PerformAll(true);
    9.         }
    10.         else
    11.         {
    12.             Debug.LogError("NotReady");
    13.         }
    14.     }

    UPD:
    Merge operations: (Spheres and Flatten-Cube)
    upload_2018-11-15_13-42-49.png
    UPD2:

    Player pos: 10.5,0,0
    Player: standard TPC
    Voxel size: 0.5
     
    Last edited: Nov 15, 2018
  10. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    Thanks for this feedback and sorry for the bugs. I will try to reproduce this on my side. Could you give me a world position where the problem systematically happens (your first screenshot)?
     
  11. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    145
    If voxelSize == 1, the error occurs at about 27,0,0
     
  12. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    I cannot reproduce your first bug with your settings.
    I tried at different positions on X axis but I couldn't get any issue. Are there any operations that are loaded on the terrain (coming from StreamingAssets)?
     

    Attached Files:

    • bug.jpg
      bug.jpg
      File size:
      396.6 KB
      Views:
      735
  13. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    145
    Yes, there are several operations, including custom ones (but they are far away)
    I wrote to you in PM
     
  14. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    145
    Looks like we found the reason (p2). The problem was with my custom operation.
     
  15. Carmelblob

    Carmelblob

    Joined:
    May 9, 2017
    Posts:
    5
  16. mrjordan

    mrjordan

    Joined:
    Nov 20, 2013
    Posts:
    3
    Hey Adamandin! I'm looking at buying Ultimate Terrains for a project of mine. How does LoD popin look when the camera is moving at ~300m/s? It's an Ace Combat style flight game, very fast movement at high elevations. I'm severely impressed with your draw distance!
     
  17. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    Looks like your are looking at an old documentation. Have you seen this: https://uterrains.com/doc/#Getting_started ?

    Thanks!
    To be honest, 300m/s is far too fast for the terrain to update, unless you set a very big resolution for voxels but it may look ugly. For a game where very fast movements are important, I do not recommend the use of a voxel terrain.
     
  18. mrjordan

    mrjordan

    Joined:
    Nov 20, 2013
    Posts:
    3
    To clarify, there would be no runtime modification of the terrain, and it would all be generated beforehand. :) I'm interested in voxels to achieve things that aren't possible with a simple heightmap-only terrain.
     
  19. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    214
    Could uterrain be used to model the atmosphere by using voxels that are either not actually drawn or are transparent? Realise this might require work on my part just wondering how much work that might be. Thinking of voxels to hold clouds of different types and wind direction, that sort of thing.
     
  20. Mohamed-Anis

    Mohamed-Anis

    Joined:
    Jun 14, 2013
    Posts:
    94
    @Amandin-E, for the grass/rocks/tree placement, is it possible to have exclusion masks so that certain regions will be masked out from placing them? Vegetation studio has something similar and I found it most useful and am pretty sure it's quite straightforward to implement (compared to pathfinding for e.g.)?
     
  21. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    59
    Hi Amandin-E,
    The asset looks really awesome, will this work with HDRP? Maybe the LayeredLit material?
     
  22. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    I think uTerrains might not be really adapted. Voxels are definitely something you may use for your needs, but not really a voxel TERRAIN. I mean, will you need LOD system for example? Dynamic editing?

    You can already have something similar by creating more VoxelTypes with different settings about trees, grass and details. I could probably achieve something easier to use but at least you can do that.

    Thanks! Well, it entirely depends on the shader. If you already have a triplanar mapping shader that supports vertex control (for texture placement) and is compatible with HDRP then it’s all good.
    I’ll work on shader later so maybe I’ll add this to the package but I can’t promise for now.
     
  23. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Looks great. Im trying to figure out a way to design a map. Iim nearly at that point in my project, just st finishing up some ai. But i want a huge map. Like 100k. I also want biomes. And specific areas. Ive used map magic, and i thought about just pinning a couple specific terrains then procedurally generate the rest. But the biome support is limited. Other option is to just hand craft a crap load of small terrains and use sectr to stream them. I currently dont need the use of voxels. But the map generation and biome feature you have are intrigueing. Any thoughts?
     
  24. Mohamed-Anis

    Mohamed-Anis

    Joined:
    Jun 14, 2013
    Posts:
    94
    @Amandin-E I don't think "Voxel Types" will be able to do masking. It should be possible to specify a polygonal area around a house (for e.g.) that should not have grass or trees or rocks.

    In any case I've not purchased uTerrains so I could be wrong but just a suggestion :). uTerrains looks amazing though!
     
  25. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    I’m not sure you’d be satisfied with uTerrains if you don’t need voxel because you will pay the extra cost of voxels (in terms of performance) without using the benefit. The only benefit is that you could get a huge map quickly, but I can’t tell if this will be enough for you to be happy. Also, what kind of limitations does MapMahic have about biomes (so I can tell if uTerrains has the same limitations or not)?

    Agreed. This would be very useful and this is something I will keep in mind the day I rework vegetation placement (which truly needs some rework).
     
  26. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Running masks, and nodes. With map magic i can set up biomes based on simple.... areas. Hard to explain. But to set up i guess say 4 to 5 different regions, of different sizes and shapes. Ect. Might be possible with map magic, but would be insanely complex.
     
  27. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    59
    Hi Amandin-E, bought the asset, and it is crazy fast. Good job!
    Just a quick question about generating collision mesh.
    Also asked here https://uterrains.com/question/intergration-with-custom-physics-engine/

    We want to integrate uterrain with bullet physics, we want to generate LOD 0 mesh for use as collision mesh.
    And we want to generate at multiple location, use case being a authoritative server with multiple player or a single player game some AI agent far from the player, can you give us some pointer to which class and method to use for manual generation?
     
  28. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    To be 100% honest, I'm not sure you'll be satisfied with uTerrains biome selector as it is quite basic for now (however you can implement your own if you have programming skills). It will be improved in the future but there is a lot to do for this. I prefer to tell you this than having a disappointed customer :)

    Thanks!
    This is not going to be simple, but that might be possible.
    On the server side, where you want to compute the LOD 0 mesh for collision, change the settings of the terrain a bit so that it only generates LOD 0 (set LOD count to 1). Adjust the draw distance for your needs.
    Then, I'd use the OverridePlayerTransform method of UltimateTerrain to be able to generate parts of the terrain where you want.
    If you need some deeper control on what to generate, I'm afraid you will have to create your own Orchestrator that would generate exactly the chunks you want instead of relying on the ChunkTree (that usually do it for you). This is obviously more complicated, but you will have full control of the system.
     
  29. ProtoPoly

    ProtoPoly

    Joined:
    Jan 5, 2014
    Posts:
    34
    It would be nice if we had a similar system for building biomes too.

     
    Amandin-E likes this.
  30. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    You mean to replace the biome selector? This is exactly what I was thinking about, but I will probably make it in a second update.
     
  31. joferjoe

    joferjoe

    Joined:
    Feb 2, 2016
    Posts:
    95
    @Amandin-E hows the pathfinding going? im still super excited for it :D
     
  32. ProtoPoly

    ProtoPoly

    Joined:
    Jan 5, 2014
    Posts:
    34
    Do you have an ETA on this next update?
     
  33. ProtoPoly

    ProtoPoly

    Joined:
    Jan 5, 2014
    Posts:
    34
    yes, I feel the selector is very limited on what we can do creatively. Don't get me wrong, I have been quite happy since I started using 4.1 with the new updates. But a more powerful visual interface with the ability to mathematically define where biomes will load as we as being able to define the rules as a Biome may actually contain multiple biomes layered together.
    If we had the ability to do Additive or Subtractive biomes in a easily understood way and then have the ability to do things like Bezier curves, perlin worms, etc then we could do caves.
     
  34. Mohamed-Anis

    Mohamed-Anis

    Joined:
    Jun 14, 2013
    Posts:
    94
    So far I've seen Vegetation Studio do it kinda well.. Sample videos in case @Amandin-E wants to do something similar :). However it's not mathly defined but rather manually defined:


     
  35. ProtoPoly

    ProtoPoly

    Joined:
    Jan 5, 2014
    Posts:
    34
    Thing is not all people run with surface biomes, a game like mine has biomes underground too and I am waiting for the caves update. Also when a person is doing infinite landscapes, a more procedural approach is preferred
     
    Last edited: Nov 26, 2018
  36. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    Exactly. I have to keep things very « procedural ». The update is coming but as I said before I’m also working on a parallel project so the frequency of updates will be a little bit lowered. I’m afraid I can’t give any accurate ETA. The good news is that the other thing I’m working on will also improve uTerrains (ex: new shaders, maybe some jobs and burst, etc.).
     
    JBR-games and Razmot like this.
  37. Mohamed-Anis

    Mohamed-Anis

    Joined:
    Jun 14, 2013
    Posts:
    94
    @ProtoPoly @Amandin-E you're right. I was a little impressed with the Vegetation Studio solution. Looking forward to the new version.

    @Amandin-E thanks for making this asset!
     
    Amandin-E likes this.
  38. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Where does this asset stand in comparison to VoxelLand? both seem pretty similar..can anyone comment on this maybe someone who has tried both?

    What is being worked on for the future?
     
  39. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    I’ll let others reply about Voxeland comparison but if you want to get a look of what’s coming next you can look at the page 6 of this forum thread :)
     
    P_Jong likes this.
  40. Mohamed-Anis

    Mohamed-Anis

    Joined:
    Jun 14, 2013
    Posts:
    94
    @Amandin-E after evaluating UTerrain vs VoxelLand, went with purchasing uterrain since I think it's more feature rich while being less pretty than VoxelLand. In terms of priority (for me) would like to see pathfinding support first :).
     
  41. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Does uTerrains support CTS shaders as opposed to RTP3? I have CTS, and not RTP3 and they seem to be pretty much doing the same thing.

    Also is it possible to have multiple uTerrain instances on different gameobjects, sort of like having patches of voxel terrain that are limited to a specific area? It would be ideal and provide alot more usages than just the single instance version especially if optimized for it.

    I looked at page 6.. tbh the whole node graph biome gen stuff I honestly don't care for.. I would much rather see better terrain tooling and support for importing from other more fully featured and established tools that can help end users to generate terrain/biomes/textures.. where the voxel framework can import that into sections of the world as voxel data.

    And most importantly actually decent real time world editing terrain tooling, which from what I've seen in all the voxel frameworks it is a sadly lacking area that continues to be ignored in favour well just more homebrew implementations nodegraphs guis while ignoring the actual artistic crafting tools.

    Things like brushes, smooth brushes, erosion brushes, and literately minecraft like worldedit/voxelsniper tools that provide a quick way for working with large amounts of terrain/voxel data and texturing. This to me is far better because even if you eventually waste enough time messing with noise values and plugging in different nodes to achieve something ok for automatic terrain generation. You will still arrive at point where you will want to go in and artistically reshape areas of the terrain.

    I'm already working on worldedit tooling for voxelplay (which doesn't do smooth gen) it's dissapointing to see another framework with the same problems.

    On the docs page "Terrains can be dug or built in real time and with any shape (cube, sphere, etc.)" ....not sure what etc means... does it actually include something that would be a good for building a realistic mountain?

    I read that ai pathing is not in? does that mean the unity pathing doesn't work on terrain? I have A*star pathing but would be interested in knowing what third party assets are supported, and any other stuff for future direction? Jobs/ECS? LWRP/HDRP? For now it really does seem like a toss up between this and Voxeland and the later developer seems preoccupied with other assets ie nodes and Mapmagic which I just don't care for.
     
  42. nrodemund

    nrodemund

    Joined:
    Sep 15, 2018
    Posts:
    16
    Quick and dirty: Just duplicate all your voxel-types with same texture without trees/grass/foliage. Then create a operation for the desired region that just changes the type from grassland-with-trees to grassland-without-trees. I used this before changing to a custom system.
     
  43. joferjoe

    joferjoe

    Joined:
    Feb 2, 2016
    Posts:
    95
    @Mohamed-Anis the pathfinding is gona be lit, im so excited :D
     
  44. Mohamed-Anis

    Mohamed-Anis

    Joined:
    Jun 14, 2013
    Posts:
    94
    I too have CTS (your comments reminded me to leave a review for that asset.. which I just did :)) I don't think uTerrain supports CTS yet (pls see a reply by this author on uTerrain asset left 2 months ago by someone else). I did not buy this asset with the illusion that it will look as pretty as Voxeland.

    The rest of your comments I agree on tooling. Biome while important, I'm not at a position to say what's a good solution for this (will prolly vote for copying VoxelFarm if they have such things).

    Based off my experience with navigation/ai pathfinding, Unity (or any other navmesh based solution for that matter) will generally not work well with dynamic terrain (basically you'll need to tag"walkability" for the region that changes). In the case of voxels, it typically tends to be highly dynamic (assuming you can dig and undig stuff all over the game world). Working with the voxel representation directly means the navigation stuff does not need to spend time/memory updating its internal data structures when voxels change. Now if your environment is generally static I'm pretty sure uTerrain can be used (@Amandin-E could provide more insights here.. I'm just talking based on what I've seen so far of navigation AI).
     
  45. ViralityEverden

    ViralityEverden

    Joined:
    Jan 23, 2018
    Posts:
    1
    Hey there,
    is there any way to handle material blending easily ?
    I though having "duplicate vertices" set to false would do the job, and it does for one material, but as soon as I add a second material the second material isn't blending with the first one. By default I want all my materials and textures to blend together
     
  46. Inicus-Qvist

    Inicus-Qvist

    Joined:
    Mar 12, 2015
    Posts:
    12
    Was anyone able to get the low poly look to work? I see a lot of talk of shaders, but the other direction to approach this is from the mesh creation. "Low poly" terrain isn't actually dependent on fewer polygons, but on having hard edges instead of soft edges on the mesh, and that is something that can be part of the mesh itself. I was able to create a low poly look for the Cubiquity voxel plugin for Unity by editing the MeshConverter.cs:
    Low-Poly_Voxel0.png

    I was considering getting uTerrains but I'm not sure if I would be able to do something similar without access to the source code. Could the developer weigh in on this? Would it be possible to create the angular "low poly" look in uTerrains from the mesh side instead of shader side?

    If you want to know how I did this for Cubiquity, see the attached code (Would something like this be possible with uTerrains?):
    Code (CSharp):
    1. bool smoothEdges = false;
    2.                 if(smoothEdges || onlyPositions)
    3.                 {
    4.                     // Cubiquity uses 16-bit index arrays to save space, and it appears Unity does the same (at least, there is
    5.                     // a limit of 65535 vertices per mesh). However, the Mesh.triangles property is of the signed 32-bit int[]
    6.                     // type rather than the unsigned 16-bit ushort[] type. Perhaps this is so they can switch to 32-bit index
    7.                     // buffers in the future? At any rate, it means we have to perform a conversion.
    8.                     int[] indicesAsInt = new int[noOfIndices];
    9.                     for (int ct = 0; ct < noOfIndices; ct++)
    10.                     {
    11.                         indicesAsInt[ct] = indices[ct];
    12.                     }
    13.  
    14.                     // Clear any previous mesh data.
    15.                     mesh.Clear(true);
    16.  
    17.                     // Create the arrays which we'll copy the data to.
    18.                     Vector3[] positions = new Vector3[noOfVertices];
    19.                     Vector3[] normals = new Vector3[noOfVertices];
    20.                     Color32[] colors32 = new Color32[noOfVertices];
    21.                     Vector2[] uv = new Vector2[noOfVertices];
    22.                     Vector2[] uv2 = new Vector2[noOfVertices];
    23.  
    24.                     // Copy the vertex positions from Cubiquity into the Unity mesh.
    25.                     for (int ct = 0; ct < noOfVertices; ct++)
    26.                     {
    27.                         // Get and decode the position
    28.                         positions[ct].Set(vertices[ct].x, vertices[ct].y, vertices[ct].z);
    29.                         positions[ct] *= (1.0f / 256.0f);
    30.                     }
    31.                     // Assign vertex data to the mesh.
    32.                     mesh.vertices = positions;
    33.  
    34.                     // For collision meshes the vertex positions are enough, but
    35.                     // for meshes which are rendered we want all vertex attributes.
    36.                     if(!onlyPositions)
    37.                     {
    38.                         for (int ct = 0; ct < noOfVertices; ct++)
    39.                         {
    40.                             // Get the materials. Some are stored in color...
    41.                             colors32[ct].r = vertices[ct].m0;
    42.                             colors32[ct].g = vertices[ct].m1;
    43.                             colors32[ct].b = vertices[ct].m2;
    44.                             colors32[ct].a = vertices[ct].m3;
    45.  
    46.                             // And some are stored in UVs.
    47.                             uv[ct].Set(vertices[ct].m4 / 255.0f, vertices[ct].m5 / 255.0f);
    48.                             uv2[ct].Set(vertices[ct].m6 / 255.0f, vertices[ct].m7 / 255.0f);
    49.  
    50.                             // Get and decode the normal
    51.                             ushort ux = (ushort)((vertices[ct].normal >> (ushort)8) & (ushort)0xFF);
    52.                             ushort uy = (ushort)((vertices[ct].normal) & (ushort)0xFF);
    53.  
    54.                             // Convert to floats in the range [-1.0f, +1.0f].
    55.                             float ex = ux * (1.0f / 127.5f) - 1.0f;
    56.                             float ey = uy * (1.0f / 127.5f) - 1.0f;
    57.  
    58.                             // Reconstruct the origninal vector. This is a C++ implementation
    59.                             // of Listing 2 of http://jcgt.org/published/0003/02/01/
    60.                             float vx = ex;
    61.                             float vy = ey;
    62.                             float vz = 1.0f - Math.Abs(ex) - Math.Abs(ey);
    63.  
    64.                             if (vz < 0.0f)
    65.                             {
    66.                                 float refX = ((1.0f - Math.Abs(vy)) * (vx >= 0.0f ? +1.0f : -1.0f));
    67.                                 float refY = ((1.0f - Math.Abs(vx)) * (vy >= 0.0f ? +1.0f : -1.0f));
    68.                                 vx = refX;
    69.                                 vy = refY;
    70.                             }
    71.                             normals[ct].Set(vx, vy, vz);
    72.                         }
    73.                         // Assign vertex data to the mesh.
    74.                         mesh.normals = normals;
    75.                         mesh.colors32 = colors32;
    76.                         mesh.uv = uv;
    77.                         mesh.uv2 = uv2;
    78.                     }
    79.  
    80.                     // Assign index data to the mesh.
    81.                     mesh.triangles = indicesAsInt;
    82.                 }
    83.                 else if(!smoothEdges)
    84.                 {
    85.                     // Cubiquity uses 16-bit index arrays to save space, and it appears Unity does the same (at least, there is
    86.                     // a limit of 65535 vertices per mesh). However, the Mesh.triangles property is of the signed 32-bit int[]
    87.                     // type rather than the unsigned 16-bit ushort[] type. Perhaps this is so they can switch to 32-bit index
    88.                     // buffers in the future? At any rate, it means we have to perform a conversion.
    89.                     int[] indicesOriginal = new int[noOfIndices];
    90.                     for (int ct = 0; ct < noOfIndices; ct++)
    91.                     {
    92.                         indicesOriginal[ct] = indices[ct];
    93.                     }
    94.                     int[] indicesAsInt = new int[noOfIndices];
    95.  
    96.                     // Clear any previous mesh data.
    97.                     mesh.Clear(true);
    98.  
    99.                     // Create the arrays which we'll copy the data to.
    100.                     Vector3[] positionsOriginal = new Vector3[noOfVertices];
    101.                     Vector3[] flatPositions = new Vector3[noOfIndices];
    102.                     Vector3[] normals = new Vector3[noOfVertices];
    103.                     //Vector3[] flatNormals = new Vector3[noOfIndices];
    104.                     Color32[] colors32 = new Color32[noOfVertices];
    105.                     Color32[] flatColors = new Color32[noOfIndices];
    106.                     Vector2[] uv = new Vector2[noOfVertices];
    107.                     Vector2[] flatUv = new Vector2[noOfIndices];
    108.                     Vector2[] uv2 = new Vector2[noOfVertices];
    109.                     Vector2[] flatUv2 = new Vector2[noOfIndices];
    110.  
    111.                     // Copy the vertex positions from Cubiquity into the Unity mesh.
    112.                     for (int ct = 0; ct < noOfVertices; ct++)
    113.                     {
    114.                         // Get and decode the position
    115.                         positionsOriginal[ct].Set(vertices[ct].x, vertices[ct].y, vertices[ct].z);
    116.                         positionsOriginal[ct] *= (1.0f / 256.0f);
    117.                     }
    118.                     for (int ct = 0; ct < noOfIndices; ct++)
    119.                     {
    120.                         // Get and decode the position
    121.                         flatPositions[ct].Set(vertices[indicesOriginal[ct]].x, vertices[indicesOriginal[ct]].y, vertices[indicesOriginal[ct]].z);
    122.                         flatPositions[ct] *= (1.0f / 256.0f);
    123.                         indicesAsInt[ct] = ct;
    124.                     }
    125.                     // Assign vertex data to the mesh.
    126.                     mesh.vertices = flatPositions;
    127.  
    128.                     // For collision meshes the vertex positions are enough, but
    129.                     // for meshes which are rendered we want all vertex attributes.
    130.                     if(!onlyPositions)
    131.                     {
    132.                         for (int ct = 0; ct < noOfVertices; ct++)
    133.                         {
    134.                             // Get the materials. Some are stored in color...
    135.                             colors32[ct].r = vertices[ct].m0;
    136.                             colors32[ct].g = vertices[ct].m1;
    137.                             colors32[ct].b = vertices[ct].m2;
    138.                             colors32[ct].a = vertices[ct].m3;
    139.  
    140.                             // And some are stored in UVs.
    141.                             uv[ct].Set(vertices[ct].m4 / 255.0f, vertices[ct].m5 / 255.0f);
    142.                             uv2[ct].Set(vertices[ct].m6 / 255.0f, vertices[ct].m7 / 255.0f);
    143.  
    144.                             // Get and decode the normal
    145.                             ushort ux = (ushort)((vertices[ct].normal >> (ushort)8) & (ushort)0xFF);
    146.                             ushort uy = (ushort)((vertices[ct].normal) & (ushort)0xFF);
    147.  
    148.                             // Convert to floats in the range [-1.0f, +1.0f].
    149.                             float ex = ux * (1.0f / 127.5f) - 1.0f;
    150.                             float ey = uy * (1.0f / 127.5f) - 1.0f;
    151.  
    152.                             // Reconstruct the origninal vector. This is a C++ implementation
    153.                             // of Listing 2 of http://jcgt.org/published/0003/02/01/
    154.                             float vx = ex;
    155.                             float vy = ey;
    156.                             float vz = 1.0f - Math.Abs(ex) - Math.Abs(ey);
    157.  
    158.                             if (vz < 0.0f)
    159.                             {
    160.                                 float refX = ((1.0f - Math.Abs(vy)) * (vx >= 0.0f ? +1.0f : -1.0f));
    161.                                 float refY = ((1.0f - Math.Abs(vx)) * (vy >= 0.0f ? +1.0f : -1.0f));
    162.                                 vx = refX;
    163.                                 vy = refY;
    164.                             }
    165.                             normals[ct].Set(vx, vy, vz);
    166.                         }
    167.  
    168.                         for (int ct = 0; ct < noOfIndices; ct++)
    169.                         {
    170.                             flatColors[ct] = colors32[indicesOriginal[ct]];
    171.                             flatUv[ct] = uv[indicesOriginal[ct]];
    172.                             flatUv2[ct] = uv2[indicesOriginal[ct]];
    173.                         }
    174.                         // Assign vertex data to the mesh.
    175.                         //mesh.normals = normals;
    176.                         mesh.colors32 = flatColors;
    177.                         mesh.uv = flatUv;
    178.                         mesh.uv2 = flatUv2;
    179.                     }
    180.  
    181.                     // Assign index data to the mesh.
    182.                     mesh.triangles = indicesAsInt;
    183.                     mesh.RecalculateNormals();
    184.                 }
     
  47. joferjoe

    joferjoe

    Joined:
    Feb 2, 2016
    Posts:
    95
    This looks lovely, i hope its possible :)

    A low poly check box would be dope :D
     
  48. joferjoe

    joferjoe

    Joined:
    Feb 2, 2016
    Posts:
    95
    @Amandin-E by any chance do you have an eta for the path finding stuff? :D
     
  49. NeilBeresford

    NeilBeresford

    Joined:
    Jun 23, 2018
    Posts:
    2
    Hey, just purchased UT and please could you offer some help on adding AQUAS to it. (I am assuming the water effect was AQUAS not AQUA as stated in the demos , or have I got that wrong.
    I'm hoping it will work without actually having a terrain, needed for the quick setup.
    Thanks in advance,
    Neil
     
  50. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    Actually I think that if you set Voxel Types blockiness to, let’s say, 0.5 that should do the trick.
    I can’t check it myself right now. Could anyone kindly try it?

    I still need some time. So many things to do! I prefer not to give any ETA.

    Unfortunately, blending is always handled on shader side. This means that two different materials won’t blend between each other. This is not an issue specific to uTerrains, it is like that for any multi material mesh. Is you want blending, you should use only one material that supports multiple textures.


    Yes you’re right this is AQUAS. This should work independently from uTerrains. If you have any problem making it work you should contact AQUAS developer/support.