http://img.photobucket.com/albums/v1...no/Terrain.jpg
Hmm..
Moving on up theme song anyone?
Now I gotta learn how to texture map this beast...
http://img.photobucket.com/albums/v1...no/Terrain.jpg
Hmm..
Moving on up theme song anyone?
Now I gotta learn how to texture map this beast...
Sometimes I forget what I am doing when I enter a room, actually, quite often.
Nice Can't quite say I can do that yet.
After all the work you have been putting into this and all the setbacks you have needed to go through, I'm glad to see you have stuck to it and come up with a product however far from a full game it may be .
Sic vis pacum para bellum. If you want peace, prepare for war.
Good job man, keep up the good work.
I'm not immature, I'm refined in the opposite direction.
Good work Shamino!
A simple texture map that applies the texture evenly across the terrain is this:
Code:float fUCoef=1.0f/(float)iMapWidth; float fVCoef=1.0f/(float)iMapHeight; int row=0,col=0; DWORD dwVertexNum; DWORD dwOffset=0; for (int z=iStartZ;z<iEndZ;z+=iCellSize) { for (int x=iStartX;x<iEndX;x+=iCellSize) { float height=(float)pHeightMap[dwOffset]*fScaleFactor; Vertices[dwVertexNum]=TerrainVertex(x,height,y,(float)col*fUCoef,(float)row*fVCoef); col++; dwOffset++; dwVertexNum++; } col=0; row++; }
Lol, I think it's pretty hillarious that I tried to understand what you wrote Bubba last night when I was incredibly trashed..
It was like a foreign language..
Looking at it now, I see that it is basically grabbing a quad of vertices from the heightmap, a "cell" and just iterating through each cell. This sets us up nicely to simply apply a texture right after we find the right vertices.. Where would the actual texture application code go in that?
Right before you increase the col, offset, and the vertex num?
EDIT: POST 500 WOOT
Sometimes I forget what I am doing when I enter a room, actually, quite often.
Well in Direct3D you don't 'bind' textures to anything. You use SetTexture() to change the current texture it's using and every primitive you draw will have that texture applied to it. So the texture code is in the loop. It just sets the u and v texture coordinates and Direct3D uses those to map the texture onto the triangle.
And now we have wireframe
Quality sucks due to jpegage..
http://img.photobucket.com/albums/v1...rrainLines.jpg
Sometimes I forget what I am doing when I enter a room, actually, quite often.
Another question, is upscaling a terrain the same as getting a bigger one?
Sometimes I forget what I am doing when I enter a room, actually, quite often.
why are there no cross-sections in the wireframe?Originally Posted by Shamino
No, because each poly just gets bigger with scaling, if you get a bigger terrain, you can scale it the same way but have more polys per unit area (higher res).Originally Posted by Shamino
I think he renders the terrain as I do; with glBegin(GL_QUADS); but for Direct 3D . I guess that it is a bit faster to do like that since it will become less calls to the API, but this is just what I guess prove me wrongOriginally Posted by Perspective
And that is a cool terrain, what kind of lighting do you use? Nice work.
Daniel
EDIT: Here is a screen of my terrain http://e43.sag.karlstad.se/it18/screenShot.jpg
Last edited by The Wazaa; 03-15-2006 at 10:29 AM.
> but this is just what I guess prove me wrong
ok.
If you render with individual quads or triangles you repeat many many vertices. The same vertex will be sent through the graphics pipeline 4 times (on average, for a uniform grid based terrain). It is much faster to use trianlge strips or trianlge fans which link triangles together.
btw: your quads are split into two triangles in the pipeline anyway.
For Direct3D you cannot render quads by themselves. Everything is in triangles since any 3 points in space are guaranteed to be colinear or lie in the same plane and thus create a plane.
A triangle is easy to texture as well but I won't go into the math right here.
Do what Perspective said. Use triangle strips. Each row of the terrain should be a strip. Depending on your space partitioning algo your setup may differ significantly from just using a regular grid. However I've found that regular grids do lend themselves to a lot of usefulness.
www.vterrain.org - Everything you ever wanted to know about terrain and more.
Still working on my implementation. However I'm more focused on another project at the moment.