Sign in to follow this  
AMcIntyre2010

Terrain, Water and Sky

Recommended Posts

My project is coming along nicely but I would be so grateful if someone just could spend a small amount of time with me to create terrain, water and sky for the enviournment just to get things started off and I would be able to do the rest myself. I have already created the DirectX 9 application and but it look very dull with no enviournment and I would be over the moon if the enviournment was put in. If you can help please reply to this post so I can talk more about it as it's only three simple things to do. Thank you very much. Andrew

Share this post


Link to post
Share on other sites
I don't think someone will just spend a little time on the immense task you presented. Just to start:

The sky can be done by using a nice toned blue. Use this as the background colour of your scene.
You can also use a sky-box.

Water is a bit more difficult, but fortunately you can create stunning images without it, so I'll leave it open.

For the terrain you could use a simple mesh. You can create that in a 3d modelling program. If you want to get your hands dirty, you can go for height-maps. Take a look at this site, to get an idea. It's in C#, but the basic principals are the same. You can also read the heights in from a file, as in the next chapter. A search on Google provides enough code examples.

I don't know if you can use shaders in your project, but if you can, I can provide some examples when using shaders.

Emiel

Share this post


Link to post
Share on other sites
I'll help you

1) Water: This is extremly complicated: You'll need to get into advanced shader, frenels, reflections, bla bla bla. BUT!!!! i have an easy solution for you!!! Go to this website http://www.magicindie.com/ and download the Aquatica Engine, a well documented, nice looking water engine for Direct3D 9.
2) Terrain: There is a lot of tutorials for terrain out (most of theme are for OpenGL, so they'll require a little translation on your part) but I'll give you a little sample here (Note this is a brute force approach:


// width/depth
float w = (vertCols-1) * dx;
float d = (vertRows-1) * dz;
for(int i = 0; i < vertRows; ++i)
{
for(int j = 0; j < vertCols; ++j)
{
DWORD index = i * vertCols + j;
v[index].pos = verts[index];
v[index].pos.y = // Get you height from TGA image;
v[index].tex0.x = (v[index].pos.x + (0.5f*w)) / w;
v[index].tex0.y = (v[index].pos.z - (0.5f*d)) / -d;
}
}

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

Sign in to follow this