• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Swatchoos

      Hi Guys,
      We would like to present our new panel: Swatchoos, the most advanced swatch panel for Adobe Photoshop CC with lots of features and improvements like:
      - Group Creation and Management
      - Swatch and Group Reordering
      - Change brightness and darkness of any color
      - Sort Swatches by Luminosity or HUE
      - Fill any Shape/Text/Bitmap layer
      - Generate Swatches from bitmaps and .psd layers
      - Customisable the look of your color
      - Import .aco or bitmaps
      - Share your swatch palettes with others
      - Auto color naming
      and much much more.
      You can try it for free so go to www.swatchoos.com and test it out!
    • By Jens Eckervogt
      Hello guys, 
      Please tell me! 
      How do I know? Why does wavefront not show for me?
      I already checked I have non errors yet.
      using OpenTK; using System; using System.Collections.Generic; using System.IO; namespace Tutorial_08.net.sourceskyboxer { public class WaveFrontLoader { private static List<Vector3> vertices; private static List<Vector2> textures; private static List<Vector3> normals; private static List<int> indices; private static float[] verticesArray; private static float[] normalsArray; private static float[] texturesArray; private static int[] indicesArray; private static string[] lines; public static RawModel LoadObjModel(string filename, Loader loader) { if (!File.Exists("Contents/" + filename + ".obj")) { throw new FileNotFoundException("Error: wavefront file doesn't exist path: " + filename + ".png"); } vertices = new List<Vector3>(); textures = new List<Vector2>(); normals = new List<Vector3>(); indices = new List<int>(); lines = File.ReadAllLines("Contents/" + filename + ".obj"); try { foreach (string line in lines) { if (line == "" || line.StartsWith("#")) continue; string[] token = line.Split(' '); switch(token[0]) { case ("o"): string o = token[1]; break; case "v": Vector3 vertex = new Vector3(float.Parse(token[1]), float.Parse(token[2]), float.Parse(token[3])); vertices.Add(vertex); break; case "vn": Vector3 normal = new Vector3(float.Parse(token[1]), float.Parse(token[2]), float.Parse(token[3])); normals.Add(normal); break; case "vt": Vector2 texture = new Vector2(float.Parse(token[1]), float.Parse(token[2])); textures.Add(texture); break; case "f": texturesArray = new float[vertices.Count * 2]; normalsArray = new float[vertices.Count * 3]; verticesArray = new float[vertices.Count * 3]; indicesArray = new int[indices.Count]; int vertexPointer = 0; foreach (Vector3 vex in vertices) { verticesArray[vertexPointer++] = vex.X; verticesArray[vertexPointer++] = vex.Y; verticesArray[vertexPointer++] = vex.Z; } for (int i = 0; i < indices.Count; i++) { indicesArray[i] = indices[i]; } break; } } } catch (FileNotFoundException f) { throw new FileNotFoundException($"OBJ file not found: {f.FileName}", f); } catch (ArgumentException ae) { throw new ArgumentException("OBJ file is damaged", ae); } return loader.loadToVAO(verticesArray, texturesArray, indicesArray); } } } And It have tried other method but it can't show for me.  I am mad now. Because any OpenTK developers won't help me.
      Please help me how do I fix.

      And my download (mega.nz) should it is original but I tried no success...
      - Add blend source and png file here I have tried tried,.....  
      PS: Why is our community not active? I wait very longer. Stop to lie me!
      Thanks !
    • By Paszq
      Troglodytes are a playable races in Arpago - they usually don't talk much and most of them lives near water sources.
    • By Paszq
      a Fox in a dungeon :)
    • By Paszq
      Fox Folk is one of 3 playable races in Arpago.
  • Advertisement
  • Advertisement

Taming procedural mesh generation

Recommended Posts

I'm trying to generate a mesh for my game and I'm being overwhelmed by all the tricky details. I keep simplifying my goals to try to make it easier, but it's still a struggle. Soon I'll have nothing but a Tomb Raider grid, but I desperately want to find a design pattern or a trick of some sort to make the whole thing more manageable.

The game level is represented by a 2D array, like a height map, but I very much want vertical cliffs, so each corner of each cell has its own height, allowing it to be discontinuous with neighboring cells. That's good, but I very much want more than just axis-aligned cliffs; that would never look natural. I used to try to have cliffs at arbitrary angles, but I've since abandoned that ambition, and now I just want diagonal cliffs, so each cell can be divided into two triangles along one of the two diagonals, with each corner of each triangle getting its own height.

That's the vertical element. Horizontally I want to use Marching Squares to define various regions in the level, like desert, forest, lake, and so on. We just have to create fields of values across the corners of all the cells, then linearly interpolate between the corners to determine which field has the greatest value at any point. So, if value of the desert field is greater than value of the forest field, then that point is part of the desert, and so on. The beauty of Marching Squares is that it meshes each cell independently, so if we can just mesh a single cell, we can mesh the whole level. Unfortunately, the cliffs turn some of the squares of marching squares into triangles, as well as creating other complications.

The usual advice for marching squares is to have a lookup table filled with predefined meshes, but thanks to the cliffs the number of possibilities is exploding and the lookup table seems awkward. Now I'm thinking that we should generate a half-edge data structure from the grid to represent all the squares and triangles of the cells, then procedurally construct the game mesh from that.

I feel like I'm missing something and that this is all much harder than it should be. Is there some book I should read, or some algorithm I should be using? Is there some data structure that would solve all my problems?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement