Jump to content

  • Log In with Google      Sign In   
  • Create Account

Mythix

Member Since 14 May 2013
Offline Last Active Jun 25 2013 04:04 AM

Topics I've Started

Voxel Terrain Performance (rendering)

19 June 2013 - 10:25 AM

Hello all,

 

I'm trying to find out some opinions related to rendering techniques for a procedural minecraft like terrain system made of cubes. It's just a toy and a learning experience for me.

 

So, my question for the community is how to store/use textures in regards to the vertices in question. It'd be fewer vertices for certain if I merge adjacent faces that would use the same image. The only way I know to do this without a buffer per image would be to abuse the wrapping capabilities of the graphics card by storing faces in strips. Then I could use a vertical strip and a horizontal strip of possible face images as two atlases depending on if the faces are merged vertically or horizontally.

 

I could also simply use a typical atlas map with 4 vertices per face. It's simple, works well, and there's no tricks going on that might result in more texture swapping than desirable.

 

 

Any other possibilities anyone else knows of that might be a performance increase? If nothing else, I'm considering storing a vertex buffer per face normal (that's 6 buffers) per chunk and rendering those individually to perform a software like backface culling. Depending on the chunk size, that might be a decrease or an increase in performance (overhead of draw calls).. not too sure.


How to sort array of tiles by direction character faces

18 June 2013 - 04:24 PM

In a 2D grid, I have the center location of all tiles on the map in an array. I also have the character's facing ray (the starting position is the player's position). The character can rotate 360 degrees.

 

My goal would be to sort the array by the distance they are to that ray in a sweeping motion from the character's position outwards.

 

If you had two second hands on a clock set to noon, one going clockwise and the other going counter clockwise, the array would be:

 

12, 1, 11, 2, 10, 3, 9, 4, 8, 5, 7, 6

 

The only difference between that and what I'm hoping for is to do it on a 2D grid of tiles rather than just the numbers on a clock :P. Well, that and I'd hope if the lines intersect multiple tiles that I could add those tiles to the array based on their distance to the player.

 

Can someone point me in the right direction for this, perhaps even a term to describe the concept? If I'm not describing it well enough, please let me know and I'll do my best to draw a picture.


How to get sliding response to collisions (voxel terrain, mini-voxel camera)

04 June 2013 - 10:22 AM

My collision detection seems to work well. Responding to it, however, does not. My terrain is made of cubes. My player is made of a cube. They are all axis aligned. As my terrain is divided up into cubes, I simply check to see if every corner of the player's cube is in empty space or a solid block. If even one is in a solid block, then I know a collision has occurred.

I'm wanting to slide the player along the plane of the collision, but I'm having some difficulty understanding how to identify the plane to slide on and how. Everything I've tried so far seems to have issues determining the exact plane to slide on/propel from.

As the picture below demonstrates, from one frame to the next, if the red square moved from bottom up as the arrow points, I need something to show that the bottom face of the black square is what was collided with (or the top face of the red square).

 

phOST.png


Procedural Terrain and Biomes

17 May 2013 - 05:21 AM

Hello all,

 

I'm working on a terrain generator. Through multiple noise functions, I'm able to create many kinds of terrain I like, but I'm having a bit of difficulty joining them together in a seamless fashion. 

 

My first thought was to use a single low level noise call (calling it the mask) and then I could simply say things like:

if (returnVal < .1) GenerateBiome1();

if (returnVal < .2) GenerateBiome2();

if (returnVal < .3) GenerateBiome3();

and so on...

 

The issue here is that the height of the terrain doesn't blend together very well. If biome 1 was more mountainous and biome 2 was flat land, it's a drastic switch from one to the other and it looks atrocious.

 

My next thought was to attempt blending by giving a 'strength' to each biome based on what my mask noise returns. In C# code, it looks something like this at the moment:

tatic public float GetHeight(float X, float Z)
{
    float fRollingHills_Location = .25f, fRollingHills_Impact = .5f, fRollingHills = 0;
    float fMountains_Location = .75f, fMountains_Impact = .5f, fMountains = 0;

    float fMask = Game1.GetNoise2(0, X, Z, .01f);
    float fRollingHills_Strength = (fRollingHills_Impact - Math.Abs(fMask - fRollingHills_Location)) / fRollingHills_Impact;
    float fMountains_Strength = (fMountains_Impact - Math.Abs(fMask - fMountains_Location)) / fMountains_Impact;

    if (fRollingHills_Strength > 0) fRollingHills = fRollingHills_Strength * (Game1.GetNoise2(0, X, Z, .02f) * 10f + 10f);
    if (fMountains_Strength > 0) fMountains = fMountains_Strength * (Game1.GetNoise2(0, X, Z, .05f) * 25f + 10f);

    return fRollingHills + fMountains;
}
 

 

The issue I have here is that even for only two biomes, it's pretty important for me to manually choose the "location" and "impact" values to ensure I'm getting some combination of strengths to total 100% by the time it returns a value (if not, I get things like giant cliffs making the borders from one biome another ugly and obvious). I'm also not entirely sure I understand it just yet, but the way in which I multiply the noise for a height looks like it needs to change to handle multiple biomes blending smoothly.
 
Does anyone have any experience in this and can either help correct me, explain it better, explain a whole new method to do this that might be easier, or just point me to some good resources on the subject? While I've managed a few good looking maps, if I try to go up to 10 or more biomes, without having more automation in my code which I think might be just beyond me with this method, I don't think I'll be able to succeed.
 
 
Thanks,
Mythix

PARTNERS