Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / An attempt from C++ Terrain to DBP Matrix Terrain ( because of Shadowing a Matrix )

Author
Message
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 15th Sep 2011 04:34 Edited at: 15th Sep 2011 04:35
http://www.shamusyoung.com/twentysidedtale/?p=141

Has anyone else read this tutorial. Its VERY informative. The source code to the C++ of his demo is also there ( roughly 4.3 megs ).

What I am curious about is if anyone has attempted to convert it to DBPro. Success or failed attempt. I am more curious if its even possible with the way he has it setup. The reason I ask is because of the shadowing of the terrain. How he figured out how to determine the angle of the shadow based on the height related to the next point in 3D matrix positions. I am currently working on figuring this out for my matrix terrain project I have going on. Seams this was not added as a feature to DBP. ( The self shadowing currently only works with objects, not matrix. )

Either way, I just wanted some feedback and opinions on this. If you have used the actual C++, let me know what you thought of his tutorial. Things like that.

"Life is like a box of chocolates.. eat it before it melts."
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 15th Sep 2011 15:13
The one thing I've not considered yet in my own generator is the shadowing of the texture generation. I've just had a look there and nosed through some other techniques. I've found that adding shadows directly onto the terrain texture is very easy to do, especially if its just coming from north, south, east or west as the texture colouring will be altered by comparing the two cell values. When I get round to implementing it I'll post it.

I suppose that when creating a matrix terrain you could alter the texture tiles so that darker tiles would appear where needed, etc.

Warning! May contain Nuts!
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 15th Sep 2011 15:25 Edited at: 15th Sep 2011 15:26
Yea, I am thinking this as well. I found this command in one of Mugens example code :

SET MATRIX NORMAL Matrix Number, TileX, TileZ, NX, NY, NZ

And this seams to be what I am after to use. But HOW to write the code for this is going to be tricky.

The guy who made that C++ Terrain tutorial though, I loved reading his success and failures. It helped me in understanding how his Matrix worked.

"Life is like a box of chocolates.. eat it before it melts."
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 15th Sep 2011 18:33 Edited at: 15th Sep 2011 18:38
Yeah, so far I've been using the built in "Set Object Normals objID" with auto calcs an objects normals but to do it manually on a matrix you'd have to look into working out the orientation of the face. I had a look a while ago but found I didn't need to because of DBP's built in command. If I spot it again I'll post it here for you man...

EDIT: http://www.gamedev.net/topic/355340-calculating-vertex-normals-solved/

http://www.flipcode.com/archives/Calculating_Vertex_Normals_for_Height_Maps.shtml

Warning! May contain Nuts!
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 15th Sep 2011 19:51 Edited at: 15th Sep 2011 19:56
I have continued this part of the conversation about lighting a matrix here.

http://forum.thegamecreators.com/?m=forum_view&t=189397&b=1&p=0

That way this thread can stay on topic about the C++ Terrain Tutorial.

"Life is like a box of chocolates.. eat it before it melts."

Login to post a reply

Server time is: 2026-07-11 12:03:10
Your offset time is: 2026-07-11 12:03:10