I just started out with D3D 11. My goal is to write a cube voxel engine (Minecraft style). Actually it's working pretty solid already, but when I finally tried to change the size of my cubes, I ran into a problem:
No matter how large I make my cubes, they always appear super large when I move very close to them. Although they appear in a different size when I declare them in a different size and look at them from the same absolute distance.
For example: Let's say I make my cubes have a width, height, and depth of 1.0, and another time I give them a width, height, and depth of 0.01, and both times I look at them from a distance along the z axis of -1.0. The 1.0 cubes look larger than the 0.01 cubes. But I think this is only because the "relative" distance (100 cubes vs 1 cube) is a lot larger. The problem is, when I move very close to my 0.01 cubes, they become just as large as my 1.0 cubes with the front side filling almost the entire screen. I am very confused right now, since I have no clue as to how I can make my cubes appear smaller when I get very close to them. The problem is, the smaller I make my cubes, the closer I have to be able to get to them in order to make them appear as if they were right in front of me, which always results in huge cubes. Can anybody please help me figure out how to make my cubes appear smaller?
I don't know if this matters, but here is how I make my cubes:
1) Create a mesh for each chunk of voxels. In this process, I already define my vertices in world coordinates taking into account the cube size that I want (this is working, I printed out my vertex data with different cube sizes).
2) When rendering, each frame, I take the view projection matrix from my camera and send it to the shader. My vertex shader then simply does the following to my world coordinate vertices:
vout.pos = mul(float4(vin.pos, 1.0f), vpMatrix);
I also made some screenshots to show my problem. I just made a simple 32x3x32 map with different textures at each height.
1) Cube size 1.0, distance 10.0:
2) Cube size 0.1, distance 10.0:
3) Cube size 1.0, close distance:
4) Cube size: 0.1, close distance:
As you can see, at a distance of 10.0, the size difference is noticeable. But the closer I get, the less the size difference appears. A cube size of 0.1 at a close distance is still way too large. Almost as large as a cube size of 1.0 (which should be 10 times bigger?). I can go lower and lower on the cube size, but it just stays way too big at close range. And at some point, I can't go any lower. So, is there a way to make my cubes at a close distance look just a little bit bigger than the cubes seen in the second picture (cube size 0.1 at distance 10.0)?
Here is another screenshot of a more complex "map" proving, that I should actually be rendering stuff correctly: