mgoss

Members
  • Content count

    27
  • Joined

  • Last visited

Community Reputation

225 Neutral

About mgoss

  • Rank
    Member
  1. WOA2: Final thoughts

    Riu pretty much summed it up for us. For preparations, I used a state machine I had made awhile back and used it for this game and made a behavior tree system. The current pigs you see in the game used my behavior tree system. However, the behavior tree wasn't really fleshed out enough to crank out AI. So improving it got pushed back. We switched to a behavior tree which we bought on Unity's asset store and that's what byte troll used. However, due to time constraints, I didn't have time to implement his work in the final submission. I was more focus getting the farming done and other aspects working.    During the week of the event, I created a Unity Editor tool to quickly generate a random farm for me and make changes for me. That tool was invaluable for me.    For the animations, I used Mecanim and interface it with my event manager system I had made. So it was easy to plug in new animations on the fly. Whenever Riu made a new tool(hoe, hammer, sickle) animation, it literally would only take 5 minutes to implement and ready to use.    I definitely had fun doing this game jam despite lack of time I had. I will most likely participate next year's game jam!
  2. D3D11 Tessellation In Depth

    Best article I've came across about tessellation. Stuff like this has to be explain to me like I'm 5. 
  3. Xbox One dev. language and engine etc?

    I heard Xbox One will support Unity. So there's that. 
  4. I improved the averaging of vertex normals. I just need to improve the speed of it and chunk seams.   
  5. After reading the source code. It seems like they are just sampling the normals from a raw file. So I'm not sure how to translate that into perlin noise code.   private Vector3 SmoothNormal(Vector3 position) { float dxz = 1.0f / 16.0f; float dy = 1.0f / 64.0f; Vector3 grad = Vector3.zero; grad.x = PerlinNoise.Noise(position.x + dxz, position.y, position.z) - PerlinNoise.Noise(position.x - dxz, position.y, position.z); grad.y = PerlinNoise.Noise(position.x, position.y + dy, position.z) - PerlinNoise.Noise(position.x, position.y - dy, position.z); grad.z = PerlinNoise.Noise(position.x, position.y, position.z + dxz) - PerlinNoise.Noise(position.x, position.y, position.z - dxz); grad.Normalize(); return grad *= -1; } position is the vertex position
  6. Cool thanks.    My next question is this line float d = 1.0/(float)voxels_per_block; What's the voxels per block variable? And does the noise generator have to be anything like what I used for generator the scalar field?
  7. I have it somewhat working. However, doing it this way is a lot slower.    for each vertex v in vertex list { Vector3 n = Vector3.Zero for each triangle t that shares v's vertex { n += Normalize(v+ t.normal) } v.normal = Normalize(n) }    
  8. The source code is straight from the famous marching cube article. Which I'm doing on CPU side in Unity. http://paulbourke.net/geometry/polygonise/   I wouldn't know how to go about using a dynamic table. Doing a gradient sounds easier what I read in the Nvidia article. But not entirely sure how to implement in my current setup.    private static List<Vertex> GenerateTriangles(Gridcell grid) { //List<Triangle> triangles = new List<Triangle>(); List<Vertex> vertices = new List<Vertex>(); int cubeIndex = 0; for (int i = 0; i < 8; i++) { if (grid.Density[i] <= Isolevel) cubeIndex |= (1 << i); } Vector3[] vertlist = new Vector3[12]; int index = edgeTable[cubeIndex]; if ((index & 1) > 0) vertlist[0] = VertexInterp(grid.Positions[0], grid.Positions[1], grid.Density[0], grid.Density[1]); if ((index & 2) > 0) vertlist[1] = VertexInterp(grid.Positions[1], grid.Positions[2], grid.Density[1], grid.Density[2]); if ((index & 4) > 0) vertlist[2] = VertexInterp(grid.Positions[2], grid.Positions[3], grid.Density[2], grid.Density[3]); if ((index & 0x8) > 0) vertlist[3] = VertexInterp(grid.Positions[3], grid.Positions[0], grid.Density[3], grid.Density[0]); if ((index & 0x10) > 0) vertlist[4] = VertexInterp(grid.Positions[4], grid.Positions[5], grid.Density[4], grid.Density[5]); if ((index & 0x20) > 0) vertlist[5] = VertexInterp(grid.Positions[5], grid.Positions[6], grid.Density[5], grid.Density[6]); if ((index & 0x40) > 0) vertlist[6] = VertexInterp(grid.Positions[6], grid.Positions[7], grid.Density[6], grid.Density[7]); if ((index & 0x80) > 0) vertlist[7] = VertexInterp(grid.Positions[7], grid.Positions[4], grid.Density[7], grid.Density[4]); if ((index & 0x100) > 0) vertlist[8] = VertexInterp(grid.Positions[0], grid.Positions[4], grid.Density[0], grid.Density[4]); if ((index & 0x200) > 0) vertlist[9] = VertexInterp(grid.Positions[1], grid.Positions[5], grid.Density[1], grid.Density[5]); if ((index & 0x400) > 0) vertlist[10] = VertexInterp(grid.Positions[2], grid.Positions[6], grid.Density[2], grid.Density[6]); if ((index & 0x800) > 0) vertlist[11] = VertexInterp(grid.Positions[3], grid.Positions[7], grid.Density[3], grid.Density[7]); for (int i = 0; triTable[cubeIndex][i] != -1; i += 3) { Vector3 one = vertlist[triTable[cubeIndex][i]]; Vector3 two = vertlist[triTable[cubeIndex][i + 1]]; Vector3 three = vertlist[triTable[cubeIndex][i + 2]]; Vector3 normal = CalculateFaceNormal(one, two, three); vertices.Add(new Vertex(one, normal)); vertices.Add(new Vertex(two, normal)); vertices.Add(new Vertex(three, normal)); //Triangle tri = new Triangle(one, two, three); //{ // tri.faceNormal = normal; //} //triangles.Add(tri); } return vertices; } public static void CreateMesh(List<Vertex> vertices, Vector3 position) { Mesh mesh = new Mesh(); Vector3[] verts = new Vector3[vertices.Count]; Vector3[] normals = new Vector3[vertices.Count]; int[] triangle = new int[vertices.Count]; Vector2[] UVs = new Vector2[vertices.Count]; for (int i = 0; i < vertices.Count; i++) { verts[i] = vertices[i].Position; normals[i] = vertices[i].Normal; UVs[i] = Vector2.zero; triangle[i] = i; } mesh.vertices = verts; mesh.normals = normals; mesh.triangles = triangle; mesh.uv = UVs; GameObject terrain = GameObject.Find("Terrain"); if (terrain == null) terrain = new GameObject() { name = "Terrain" }; GameObject meshObject = new GameObject(); meshObject.AddComponent<MeshFilter>().mesh = mesh; meshObject.AddComponent<MeshRenderer>(); meshObject.renderer.material = material; meshObject.transform.position = position; meshObject.transform.parent = terrain.transform; meshObject.name = "Region"; }
  9. Hey sorry guys that I went AWOL. I went out of town unexpectedly and couldn't check this post. I will check out the links and report back.    Note. I'm using marching cubes and a perlin noise to generate the scalar data field.    This is the closes I can get to a smooth surface without vertex normals.    http://i.imgur.com/gWtCX2H.png
  10. foreach( Vertex v ) { Vector3 normal = Vector3.Zero; foreach (Face f adjacent to v ) { normal += f.GetNormal(); } normal.Normalize(); }   I found this algorithm. However, I'm not sure how to figure if a face is adjacent to a vertex. The reason I'm doing this is because I'm generating terrain and it's very blocky. I was told using vertex normals for lighting will smooth it out.  
  11. I believe it's the UV of the fullscreen quad. Since it's a post processing effect. And most post processing effects use fullscreen quads. 
  12. struct VS_INPUT { float4 vPos : POSITION0;                  <---- should this be a float3?  float2 vTex0 : TEXCOORD0; float3 vNrm : NORMAL0; float3 vTan : TANGENT0; float3 vBin : BINORMAL0; };   That maybe not be your problem. I know I had some problems with using a float4 instead of a float3. The rest of the code look fine. 
  13. Edit: Never mind I got it working. 
  14. Lighting in caves

    I think the best and fastest way is this. We already have light propagating for each block. In the GBuffer, I can pass those lighting values to a channel. Then in the Directional Lighting, apply the ambient lighting according to whats in the channel.
  15. DX11 DX11 Depth RT issue

    I can for a stand Depth map. However, when I want a custom depth like float4(depth, depth * depth, 1, 1)(variance shadows); I can't use that. EDIT: Never mind, got it working.