I finallly found the time to implement per-vertex precalculated lightning in the landscape engine. I’m quite satisfied with the result and it gives the landscape a less boring look.. The reflection method I use is called Lambertian reflection, but you might now it better by the more common name diffuse reflection. Anyway, whatever you call it it’s easy to implement – all you need is the vector from the vertex to the sun and the vertex normal.I’ve also written a new function for the octree system that tests whether a ray intersects any of the triangles in the octree, at first I used that function along with the reflection technique above to make sure that the points could “see” the rays from the sun. I removed that however since the check of the thousands of verts took several minutes on a large heightmap :). Instead I moved the sun far away so that all rays has become almost parallel ensuring that all points on the landscape are hit (I have no overhangs and such).
A completely new logging system has also been added to the engine, the old one was rather clumsy and way to simple. It’s still simple, but at least it looks like OOP now :).
You can download the new engine, and the source, right here: landscape.zip.
Tommorow I’m going 250km by car to my aunts birthday, we’ll be sleeping in our Compi-Camp (some kind of tent wagon) so don’t expect any updates tomorrow . And about the move to the new server, I expect that I can be finished with all the uploading and stuff by the weekend, then I need a “hosted by” image which Scorpion will supply, and then It’ll be up and running. See you there :).
Added a new link on the “links” page. It’s to the site called Occultforces which is driven by Scorpion:
The win2k problems are solved, at least I think so. MiNDHiVE has tested the engine again, and unlike previous attemps, it worked. MiNDHiVE is making is own engine by the way, it looks really cool, go check it out at his homepage. Oh and I know it’s been a while since my last newspost, but I’ve been busy with exams. I only have one more to go – a physics exam on monday, then I’ll graduate :).
I’ve gotten some report from ppl saying that the engine I uploaded yesterday wouldn’t work – they all had one thing in commmen, they were using win2k. I browsed through the source a couple of times and found a (minor?) bug (some memory was deleted twice), perhaps win2k is more strict conserning memory – anyways, it should be working on win2k machines now I hope. I’m waiting to hear… Get the program (with source ofcourse): landscape-engine
I made a minor change last night which nearly doubled the framerate – and I included some other textures. The file from yesterday has been replaced with a new one since I’m out of serverspace :(. Here’s a screenshot of the new build:
Get the program and source here.
I’ve uploaded the lates build of the landscape engine. I don’t have a lot of time right now so I’ll make a brief description. It has frustum culling (using an octree) and textures generated from data in the heightmap, here’s a screenshot:
And here’s another showing a tiny part of the octree:
The next thing I’ll have to add is precalculated lightning (using raytracing) and some better looking textures. I’d like some feedback if you have any. You can download the engine from here.
Did I mention that the source is included?
If you run the program in windowed mode the settings are a bit strange, you’ll only see it in wireframe. Press ‘i’ to make it solid again, and ‘u’ to turn the textures on.
The frustum culling part is now finished, the engine now does a rough hidden source removal based on the octree. So I’m able to load large heightmaps and display them smoothly now :). But I ruined the textures and the fog feature as I changed the renderer to use vertex arrays so you’ll have to wait a couple of days for the upload.
Did you see the CL final yesterday? What a match, I was cheering for Bayern so I’m glad that they won, but both teams played a great match I must say! Anyways, I have an oral in ancient history coming up next thursday so I might be a bit sloppier with my programming and updates, we’ll see.
First I would like to send express my sympathy for the supporters of the german football club Schalke 04, you deserved to be the champs, but _what_ an ending!! :(. Anyways, now that were’re talking football, AaB won today for the second game in a row. We might not make it to be danish champs this year, but next year we’ll show them.. (btw, I’ve had a discussion with some ppl whether it’s okay to say ‘we’ when you talk about a team that you support actively or not, I think it’s ok since us fans on the stadion gives the players a final boost, or we would like to think so at least ).
Anyways, the octree stuff is going fine, with my last written exam long forgotten (it was a danish exam last friday), I can focus on my landscape thingy for a few days until the oral exams kick in :). Here’s a couple of screenshots from the program. The following shot shows an ordinary landscape:
The program is running at an fairly high framerate on my computer (the shot was taken on a lousy old P2). The last shot shows the same landscape as before, but _with_ the octree displayed:
Now I just have to finish the frustum culling parts.
Ohh, and It’s my birthday tomorrow, I’ll turn 19 :).
I’ve just finished writing the parts of the octree classes that generate and draw the octree, looks nice. Now I’ve got to include some HSR functions in it, it’s not much fun having an octree if all you use it for is to display cubes :).
I have a math exam tommorow, I’m fairly tired right now – I’ve played football for 1?ÃƒÂƒÃ†Â’ÃƒÂ†Ã¢Â€Â™ÃƒÂƒÃ¢Â€ÂšÃƒÂ¢Ã¢Â‚Â¬Ã…Â¡?ÃƒÂƒÃ†Â’ÃƒÂ¢Ã¢Â‚Â¬Ã…Â¡ÃƒÂƒÃ¢Â€ÂšÃƒÂ‚Ã‚Â½ hour in the sun, that drained all my energy, gotta get some sleep tonight.
Denmark finished second in the Eurovision song contest last night, I watched the contest at a bigscreen at a bar, and ppl was cheering when we got points, great evening :)
My texture generation function for the landscape works fine now, I’ve spend a lot of time debugging it and just recently realized that the problem was that I forgot that bmp files are stored in a BGR format instead of RGB format, so I got a really weird looking landscape texture:). But I’m not really satisfied yet, since the generated landscape texture is at the same resolution as my heightmap I’ve only got colors for the vertices, and not the pixels inbetween, I guess I need another approach, right now I just use the generated texture to set the colors for the the vertices and then apply an ordinary textue on each triangle, it looks ok – and runs twice as fast as the prev version which used per-vertex lightning – but I’m not _fully_ satisfied.
I’ve also decided to try to implement a visible surface determination feature based on octrees, I’ve never worked with any kind of recursive algorithm before so I’m not sure It’ll go as smoothly as I’d like it to go.
That was what I had to say today, if you have any advise about the texture thing or something else, please mail me here, thanks.