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.

Code Snippets / [DBP] The DarkBASIC Pro software renderer.

Author
Message
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 19th Mar 2007 10:43 Edited at: 19th Mar 2007 10:46
The DarkBASIC Pro software renderer.


What is it?
This is a software renderer for DBP, where triangles and objects are drawn using the CPU. The original 3D camera and projection code is by Lower Logic, http://forum.thegamecreators.com/?m=forum_view&t=99092&b=6 I created the object/Tri handling code and tri filling code.

What features does it have?

Objects - You can create 3D objects and have triangles grouped with them, for scale / position / colour etc.
Vertex manipulation - In realtime you can edit all vertecie positions(as they are in an array)
Object settings - Object opacity / scale / position / diffuse.
Wireframe modes - There are 5 wireframe modes to chose from.

What features are planned?

Object rotation - Currently you cannot rotate objects.
Gouraud shading - Support for Gouraud shading is planned.
Vertex diffuse/alpha - Support for more vertex settings are planned.
Z-Depth - Per vertex Z-Depth is planned.
Poly clipping - Fixing the issue with pixels overlapping.

Why use it?

This was more of a fun experiment than anything, I hope to optimize the rendering of the triangles as it's currently rather slow when you have to render a large surface.

Also anyone can feel free to improve the code / make optimizations etc, and again credit to Lower Logic for doing the hard part of the code(bottom 2 functions).

How can I run this?

To run the code below you will need at lest DBP U6.3(coded using) and Cloggys DLL which is used to draw the 2D lines.
http://forum.thegamecreators.com/?m=forum_view&t=69221&b=5



Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 19th Mar 2007 12:12
Pretty cool, a little buggy though.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 19th Mar 2007 15:53
Looks like a good start. Ironically there's been bunch Software Renders written in the DB over the years, mostly just for fun. Here's the one I wrote for DB classic back in 2002... oh dear, was it that long ago..

DB Classic (Software Render)

Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 21st May 2007 07:40
Dark Coder, I was doing my own as well.
Will us join in a single project?
If so, I can just add rotation for your engine, but the engine I was planning shouldn't offer shading modes at all.
Basicly, I just wish to see texture mapped polygons (like UV-Mapping, but without lighting data) and vertex coloring.
I can also help you out for Z-Sorting and clipping, between my limits.
Try and see if this could be ok for you, mine is here: http://forum.thegamecreators.com/?m=forum_view&t=106119&b=1

I could also add skeletal animations in (again, between my limits).
My limits are I can just develop the core algorithm, aplyying to any data structure becomes too complex for me unless the structure itself is just an array or a bunch of variables.

Thanks in advance for any answer.
.

Bye, Berserk.
.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 21st May 2007 12:56
Hey,

A reply! I'm currently not working on this so joining the project wouldn't do much, you can use my code if you wish though. Things like rotation / Z Depth etc aren't that hard to implement just they take a while to do, filling the tris involved enough head scratching . I'm not sure I see the point in adding more advanced features like skeletal animations though, due to software renderers being a lot slower than their hardware counterparts these days, if you're after something people will use then you should try and implement OpenGL support.

Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 21st May 2007 17:41
Basicly I'm in the middle.
Some C/C++ knowledge, but not enough. Some math, but not enough.
I done wireframe nGons, but not filled. I also done skeletal animations, I would be able to do the same way I done with DarkBasic, but is not a conventional way.
So, I'm in the middle in every sense
.

Bye, Berserk.
.
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 22nd May 2007 00:27
ummm.... It didn't work. I got the d3d command error, but i downloaded the dll and put it in the right place, mabey 'cause i'm running the trial.....

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 22nd May 2007 01:55
The trial doesn't support external commands I think.
However, I had similar problems (let's say I don't like external commands very much) and so I got to make it work without the external commands. The only problem is, the camera now rotates but is not moving.



Enjoy
.

Bye, Berserk.
.
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 22nd May 2007 20:34 Edited at: 22nd May 2007 20:35
Thanks, i've got to buy this! DBpro is awesome!!

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 22nd May 2007 23:56
DBPro is awesome as you say.
If you wish to code games, I really can't figure out where should I be now without it.
Let's consider a single thing: you wish to follow a C++ tutorial on how to draw sprites: how do you know if your own version will work the same?
DarkBasic lets you quickly test such an idea, with the guarantee your logic errors will be the only failure cause.
As example, want to test out Bresenham's line plotting algorithm? Use dot command and you're on the way.
DBPro is awesome.
.

Bye, Berserk.
.
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 23rd May 2007 02:52
erm, is this like a model editor or something? I don't get it!

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 23rd May 2007 08:31
No, DarkBasic Pro is a Basic language with a DirectX wrapper.
But, if you wish to learn how to code on your own, you get the full DirectX power in a simple command set.
I done paint programs, realtime vector-drawing based, sprite based and 3D games, a software based rendering engine (wireframe) and a whole bunch of code batches.

This is for modest game development, but you can experiment far beyond than just using models, textures and putting up a game.
.

Bye, Berserk.
.
Indecom
16
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 23rd May 2007 14:56
has anyone thought of adding voxel terrain? i would love to see smooth voxel landscapes!
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 23rd May 2007 19:09
As far as I know, voxels are just colored cubes wich resembles pixels (while pixel is a squared dot, a voxel should be a cubed dot).
So if you wish to see such terrain, just making a bunch of cubes could be enough.
.

Bye, Berserk.
.
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 23rd May 2007 21:21
i know THAT thc03, i meant the SOFT.Ren. thing dark coder made.

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 24th May 2007 19:00
Sorry n008.
I thunk otherwise.
It's a software rendering engine, but is not for modeling.
Primitives creation is just to see polygons on the screen, DarkBasic does the same (make object cube/sphere/others).
.

Bye, Berserk.
.
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 25th May 2007 01:18
oooooooooooooh, lol.

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Indecom
16
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 27th May 2007 01:57
by voxel terrain i meant the kind that was used in the game outcast back in the late nineties. nearly infinite detail, software rendered.



like this, very cool for software only rendering.
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 27th May 2007 21:54
Maybe that's fractal terrain?
Fractal terrain sounds familiar, voxel only recalls me those cubic pixel in very-old school demos.
.

Bye, Berserk.
.
Indecom
16
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 28th May 2007 06:23
those are voxels, i have programmed them before, the terrain is basically draw on line at a time, starting at the bottom of the screen and moving up to the terrain height in accordance to distance, camera height and so on. They are the reason why i started using dbpro, gamemaker was far too slow to calculate the voxels at a playable rate.

check out the following site to see what i mean:

http://www.massal.net/article/voxel/
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 28th May 2007 08:44
I read that page, Voxel is still this: http://en.wikipedia.org/wiki/Voxel
That page explains they used Voxel to render an heightmap without placing textures on it, then they done a bicubic interpolation on both the beackground and the heightmap to obtain that detail illusion.
.

Bye, Berserk.
.
Indecom
16
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 28th May 2007 10:46
Yeah, i know, i did have voxlap some time ago, it is a free c based voxel engine you can google if you like.

anywhoo, i think it would be cool to see voxel terrain implemented into this engine!
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 29th May 2007 04:21
Erm, gamemaker is 3d compatible!?! Gosh, i thought it was an arcade-game maker.

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 29th May 2007 04:29
Looks really cool... BUT WHY DID YOU HAVE TO HAVE NUMBERED OBJECTS?!!?!

Heheh, keep up the amazing work anyhow

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 29th May 2007 08:59
Because using an index value to reference objects is the fastest? Using a hash table so you could access them using strings would be a lot slower and rather pointless, just use a constant or a variable if you don't want to write numbers.

Quote: "anywhoo, i think it would be cool to see voxel terrain implemented into this engine!"


Well the code is there

Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 29th May 2007 09:29
GameMaker is not really "3D compatible", but offers Irrlicht plug-in for 3D Game Making.
It's also exactly as you would see in Irrlicht, so it's quite cool.
The problem is, an executable will always look as a GameMaker's executable, is not really statisfacting and neither easy to sell.
Use it, if you just wish to get the job done. Otherwise, use Irrlicht directly, with IrrWizard and IrrEdit.
.

Bye, Berserk.
.
Indecom
16
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 29th May 2007 10:18
Actually, i programmed a software renderer in gamemaker using its 2d commands. but the interpretation of the gml source code into delphi causes a slow down, and there is no fast way to get a pixel color at a spot on a texture. So, yeah, it was my first attempt tho, at creating a voxel let alone software 3d engine. it was a good learning experience but way too slow to be practical!

ps, the new gamemaker 6 and up include inbuilt 3d functions, but no advanced shaders or model support without knowing extensive gml programming!

Anyways, back on track, this engine.
i like it.
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 29th May 2007 21:58
Yes, I know GameMaker.
I used it as well, and it'd nice. But, as I sayd, 3D and GameMaker don't really "agree".
Check out the Irrlicht plug-in, it's linked on the Irrlicht page.
As for Voxel and terrains, maybe you'll want to try with Allegro?
.

Bye, Berserk.
.
Thc03
19
Years of Service
User Offline
Joined: 19th May 2004
Location: Pavia - Italy
Posted: 29th May 2007 21:59
P.S.: Let's stop posting OT. I would like to keep answeinr you by either email or another thread, but ket's avoid this being locked.
.

Bye, Berserk.
.
alucart13
16
Years of Service
User Offline
Joined: 16th Jun 2007
Location:
Posted: 18th Jun 2007 22:47
not bad!

Login to post a reply

Server time is: 2024-05-17 03:25:33
Your offset time is: 2024-05-17 03:25:33