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.

3D World Studio / DBP 3dw Importer Underway

Author
Message
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 27th Feb 2007 13:37 Edited at: 29th Apr 2009 02:18
[edit] 4-26-2009 ... this is back in the works and is going through alot of fixes. I'll make a new WIP when I get it all organised

I am working on a DBP native code importer to mimic APEX's CSM Importer. When done it will be ported to a plugin. You will setup everything in 3DWS like you would in CShop for use with his Importer pretty much. I will be creating the objects and limbs in a slightly different manner which I think will be faster rendering, but time will tell.

[edit]
SS in my last post of this thread. The current DBP code ( Updated 04-27-2009 06:00 AM east US) I have that loads images used, and loads mesh's used and positions/rotates/scales/lights them per the 3dw file creates brushes, should theoretically work with all brushes now and leaves out faces that are deleted. Now loads terrain with layers and only doubles the terrains polys where the alpha of more than 1 layer overlaps(Alpha and lightmapping works on terrain now [vertex colors] looks alot more seemless now, but could use a bit more work later). Terrain texture mapping is fixed now:

Everything should pretty much work, though bugs are inevitable since I only get to work on this in the wee hours of the morning after working night shift. Any ideas and suggestions are welcome. This is going to be the 3DWS loding code in the end for the open source FPS engine I am making.

Also why doesn't 3DWS save the mesh and material extensions in the names? It would save alot of parsing and checking to see which ones match with their extensions removed and not take up but 2 to 4 bytes or so of file space per file used. The extensions aren't showing up for my meshs or images (.x and .bmp).

[edit] Hear from Josh and he was most helpful about the extensions.

[edit] Attached shader to post.

[edit] Examle exe's (one to load level and one to write contents to a txt file) can be found here appx 2MB:

http://www.mapmasterz.com/lit/second_test_3dw_loader.rar

Source only for those who have DBP can be found here appx 18kB:

http://www.mapmasterz.com/lit/second_test_3dw_loader_soource.zip

Screen Shots showing the loading and blockiness I am talking about can be found here appx 143kB:

http://www.mapmasterz.com/lit/ss.rar

[edit] The .mesh loader code can be found in my last post. I'll upload it later.

Attachments

Login to view attachments
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 27th Feb 2007 16:04
Hi LIT, I'll take a look at this mate, see what the deal is. Any help or porting etc, I can help out if you need it. You know where I hang out anyway... infact I did see that you'd popped in earlier but I was AFK. We'll get round to chatting mate Cool!

Paul.

dononeton
19
Years of Service
User Offline
Joined: 12th Jun 2004
Location: Tusaloosa, AL : USA
Posted: 6th Mar 2007 01:48 Edited at: 6th Mar 2007 01:51
I am glad I found this one! So this going to be a plugin? Setup like APEX's CSM Importer. What do you mean. I dont have Cshop. Is going to do through the dbo limbs to see if it brush, enity, mesh, terrain then do something like in IncaPro demo. I was thing last night how would I set up collision on my level exported out of 3DWS. Brushes would be polygon. What about the meshes? I thought make a brush around the mesh and set it hidden, but is there away to make combine the brushes and the hidden brushes,just bought 3DWS last week. Reason I am asking is I am going to use Dark Physics to my collision the synax is


so what this does makes the collisions to polygons.So to increase performance the brushes are already low poly but the meshes are not so hence the hidden brushes around them. So all brushes get exported but the ones that are flagged are set to hidden. What about special enities? In 3DWS you make a object to repersent playerstarts, gunlocations,pickups ect..In the plugin it could search the dbo file for keywords and place the real objects there so if the keyword was GunLocation the plug in will fine this location so the synax could be like


I will help in anyway to see this finished! This is awesome. I am a Noob coder but I could make maps to test with

AMD Athlon 64 x2 Dual Core Processor 3800+,MMX 3DNOW (2CPUs)
1024 MB RAM
GeForce 7300 GT 512 MB
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 6th Mar 2007 11:10
This is an example of what will be possible from the importer (and a few more things later):

http://forum.thegamecreators.com/?m=forum_view&t=76403&b=8

This uses CShop and the CSM Importer, but the 3dw importer will be very similar. In the end, by default the meshes will not have collision tied to them unless you specify it. You can easily setup your own system of setting a hidden brush to collision and linking it to the mesh.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 12th Mar 2007 09:13 Edited at: 12th Mar 2007 14:15
This "Mesh referrencing" seems to be the devil. How are we supposed to know how 3dws loads the meshs for us to match our data to? DBP and 3dws gives different number of limbs per mesh and the verts/ limbs don't seem to be in the same order. Anyone wanting to directly load a 3dw file in any engine will have to figure out exactly how to load the meshs the same way Josh does 0_o

Seems alot more crappy than just loading one set of data into the file format and then referrencing it. Then we could build our own meshs in whatever engine we wanted to use. 0_o As it looks for now I haven't seen any good way to automatically match the data (vert color) up for evey occasion. I have successfully manually matched a couple up, but nothing seems to hold standard as of yet for every type of mesh.

Until something gives way it looks like mesh coloring is out of the question in DBP from an automatic level. Meshs are loading, positioning, rotating, and scaling as of now. Just need the coloring. Going to start working on brushes tomorrow and try and come back to this later. I may be able to come up with some kind of formula if I leave it for a while.

[edit] Just found a nasty work around as I couldn't sleep. The limbs are in reverse order (plus the extra limbs in between), the verts are offset by 1 index, they don't use indexs (just 3 verts per face) like normal optimized meshs, and 3DWS even adds 2 mystery limbs to it with a texture not even used in my map 0_o

New code uploaded. Everything with meshs should be working now, though I am too sleepy now to try it out fully.

Attachments

Login to view attachments
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 12th Mar 2007 23:17
This is looking very cool LIT so far. I'll have a good'ol look in a bit when I've sorted out some other pressing things, but you've obviously nearly got this licked. Top work mate

Paul.


322 is the time that the world will change.... forever!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 13th Mar 2007 12:07 Edited at: 22nd Mar 2007 12:49
Thx man, I just spent 2 hours with the meshs and it turned out to be a DBP bug with 6.5 and re-dimming arrays for auto sizing Working on a reproducable-short code example now to send to Lee.

[edit] See this thread for more info:

http://forum.thegamecreators.com/?m=forum_view&t=101917&b=15

[edit3] Ran into some wierdness in reading files where faces were deleted before lightmapping and restored afterwards. Gonna have to come back to this tomorrow before I can actually finish building the brushes. For now it will be one object per brush and one limb per materials combo. If you have 6 faces and all have the same lightmap and main texture images then it will only have one limb. If they all have the same main and 3 have one lightmap image and 3 have another there will be 2 limbs. If they all have the same lightmap and 3 have one main and 3 have another, then there will be 2 limbs. and etc. This will keep the number of limbs down and keep DBP happy. When the importer is done there will be another optimization check that will make all the brushes in one group be one object and the limbs will still be matched by material combos. This way you can make a door and it will be all one object and cut down on the number of limbs. This will mean less limbs and objects to keep DBP happy.

[edit4] Fixed wierdness problem. Left out an exit command Shouldn't be coding while so sleepy. Fixed code uploaded to first post. The Create Brushs function only supports brushes with 4 indices per face for now. I have the theory for supporting any number of indices per face down and will try to add it tomorrow night. It uses the shader attached to the first post for the lightmapping which only works in U6.4 and earlier. I have sent Lee an email about it.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 23rd Mar 2007 12:25 Edited at: 23rd Mar 2007 13:51
Just uploaded new code. Meshs and brushes (should work with any number of indices per face now [3 and up]) should pretty much be done until I get back to them for proper object grouping later. I'll be starting on terrain.

[edit]
For the brush face triangulation I just used a basic fan technique, see picture:



This seems to be working good, but I am open for suggestions if anyone knows a better way.

Attachments

Login to view attachments
JoshK
Retired Moderator
20
Years of Service
User Offline
Joined: 17th Jun 2003
Location:
Posted: 30th Mar 2007 04:42 Edited at: 30th Mar 2007 04:47
I think this project is supremely important.

If you are having problems with the mesh references, you might try loading my own .mesh format files. This is my engine's native format. Download the Leadwerks Engine SDK for sample .mesh files, a converter, and a .mesh analyzer. The format is only a list of subobjects...there's no mesh hierarchy, and everything is in global space, so it is super-easy. .x files are kind of messy, and this approach is much cleaner and simpler for simple static meshes. I know there have been some various native file formats in the past, but this is the format my own engine is using, and it will be around for a while:
http://www.leadwerks.com/index.php?page=engine_overview.htm

Please let me know if there is anything you have further problems with. If you can load up the "Complex" map in DBPro, we'll have a Newsletter cover for sure!

WindowsXP Media Center Edition, Pentium 4 2.53 GHz CPU, 1.5 GB DDR RAM, GEForce4 MX 440
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 30th Mar 2007 05:19
Thanks for the input I will be adding the .mesh support when I get the chance. Right now the terrain layers are giving me a bit of a fit, but I may have it solved. I'll try and finish up tonight if I don't have to work late again. I have to remove some spyware from my computer first (spylocked) that got on there from other people using my computer and run some benchmarking tests for a couple of plugins. I have to get up early in the morning, so time will tell.

I'll start using the Complex level as a test level, after I get terrain working, since I am looking for a new one. My mapping skills are very much lacking LOL.

Also the chances of this turning into a plugin for increased loading speed when done have just went up alot. I have had a couple of offers and we can now use PureBasic dlls with DBP through PurePlugin. We'll know more about this when it is finished in DBP code.

JoshK
Retired Moderator
20
Years of Service
User Offline
Joined: 17th Jun 2003
Location:
Posted: 30th Mar 2007 06:07 Edited at: 30th Mar 2007 06:14
First, there is a minor omission from the terrain data documentation. The lightmap data is only included if "1" is set in the bitwise flags at the beginning of the data structure. Sorry I left this out of the documentation. Also, the lightmap data is power-of-two, so where the terrain would be 257x257 vertices, the lightmap would be 256x256 (you probably figured this out already).

The terrain alpha is always included, in every layer after the first layer. Obviously, the first layer is always drawn, so it has no alpha values.

So for the first layer:

int name (name displayed in the editor)
int material

Then for each layer after that:

int name (name displayed in the editor)
int material
For x=0 to resolution-1
for z=0 to resolution-1
byte alpha

This is also stored like a texture, so a 257x257 vertex terrain would have a 256x256 pixel alpha map on each layer (after the first layer).

BTW, BlitzMax can do plugins as well.

WindowsXP Media Center Edition, Pentium 4 2.53 GHz CPU, 1.5 GB DDR RAM, GEForce4 MX 440
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 30th Mar 2007 18:52
Hey LIT, your importer is really starting to take shape now, and looks very good! When you get to a milestone for converting to other languages, if you want me to move it over to DGDK or DGDK.NET, just let me know.

I'm more or less tied up with DGDK.NET now, and there's work on bring some essential documentation online etc which will prove interesting as well.

All looking good buddy, so my hand goes out to you

Paul.


Abundance = Choice = Freedom - Scarcity = Dependancy = Control, Truth!
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 1st Apr 2007 00:36
This is just awesome project you have started there LIT! I know how hard it is to work with DBO's exported from 3DWS so a native importer might fix this. Currently I am on a large FPS engine and importing 3DWS level and breaking it up into small chunks (faces) is a real pain. So I am another person looking forward at this!

AMD Sempron 1.8+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP Pro SP2, DirectX 9.0c (Feb2007), DBPro 6.6
http://www.myspace.com/producerolby
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st Apr 2007 09:56 Edited at: 9th Apr 2007 11:13
Thx Olby,

The file format was actually alot simpler than I thought when first looking at it. There is alot of stuff in it that we don't need for loading in DBP and the stuff that we do need is in pretty good ordering. I love the datasize and offset values being in the file so I can preparse faster and skip unwanted stuff.

I just got off work for the weekend and am going to have a serious go at the terrain again. Now that I can spend more than 15 mins or so on it, I should be able to get more done. When I get that done, is there an actual file format for the .mesh Josh? If not I may be able to look at the analyzer and figure it out. If there isn't one I'll write one when I get it figured out. And then on to the entity and grouping work after a quick update to my culling code in the code snippets forum that will be used with the engine for this.

[edit]I found another error in the docs for terrain I believe as terrains with 3 layers (like the complex.3dw) crashed here. Under investigating it looks like the format is this:



Instead of this:


Between that and a couple DBP bugs I didn't get much going. I'll try again later on today hopefully.

SS of Complex.3dw inside of building (outside is ugly due to no terrain yet) attached with correction of lightmap color and higher res.

Attachments

Login to view attachments
JoshK
Retired Moderator
20
Years of Service
User Offline
Joined: 17th Jun 2003
Location:
Posted: 9th Apr 2007 04:34 Edited at: 9th Apr 2007 04:48
Wow, that looks awesome. You might have the red and blue values switched, I think that room is lit kind of bluish.

Sorry for the omission, the "1" value in terrain flags indicates that lights have been calculated.

The .mesh format is below. I am having import plugins written right now that will load .obj, .3ds, and other file formats, and export a .mesh, so this will be a good format to use in the future:


WindowsXP Media Center Edition, Pentium 4 2.53 GHz CPU, 1.5 GB DDR RAM, GEForce4 MX 440
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 9th Apr 2007 11:09 Edited at: 9th Apr 2007 15:05
You are correct in the r and b values switched. DBP's image memblock format swaps them. I noticed this when loading a few of my bro's levels. New SS attached to previous post with this corrected.

Thanks for the .mesh format I'll add it as soon as terrain is done.

I've had alot of things come up to keep me from working on this. However I got about 20 hours sleep yesterday. So after I run to town and get a few things straightened out, I'll see if I can finish up terrain.

[edit] I have removed all of my terrain building code and am starting over. Here are a couple of links that have my current codes and precompiled exe's (one code and exe for loading the world to see [load] and one to just wrtie all the data to a txt file [wra])

http://www.mapmasterz.com/lit/Test_3dw_loaderFull.zip
http://www.mapmasterz.com/lit/Test_3dw_loader.zip

The first link is for those who don't have DBP6.6b installed (has larger exe's and is about 3.2MB download.

The second link is for those who do have DBP6.6b installed and is only .2MB download. It will use the dlls in your DBP compiler folder for running so I don't have to include them in the exe.

I don't have any media paths setup yet I am just putting the folders where I want them since I don't really know how 3dws's folder setup is yet. When done I will make a media copy tool like APEX's CSM Media copy that will setup the paths for you.

Omen
17
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 16th Jun 2007 22:13 Edited at: 16th Jun 2007 22:15
LiT,

Do you have any plans of adding portal support into your 3DWS importer and engine (maybe you already have it and I'm just not seeing it) to do portal-based occlusion culling?

Josh explains the "normal" way this is done for use with their SDK here:

http://forum.leadwerks.com/viewtopic.php?id=347

And thanks a million for all your work on this - awesome work!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th Jun 2007 00:00
Now that the new building project is finished at work, I should be able to get some more work done on this. There are no plans as of yet to add occlusion culling for sure, but I will investigate it. The last time I tried it was way too slow with DBP code and actually lowered the FPS alot. I might be able to add an option to use the built in portals that come with DBP, but no promises there as I haven't used them yet. Some time this coming up week I'll start back on the terrain. Once thats done I can add .mesh support and do the grouping and entity work.

FrozT
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: The Webinet
Posted: 5th Jul 2007 21:46
LiT,

Pretty amazing importer. It's exactly what I have been looking for.

Is there some way to access the Classnames or Visgroup names? I can access the Visgroup ID through the brushInf(x).realvisgroupInd, which I guess I can make work if I number them all in my world, but it would be nice to know how to select them by name.

Many thanks for making this - It's awesome!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 6th Jul 2007 11:56
Thanks for the interest in the project.

You can access the classnames through the .keyName and .keyVal types of each object's array, where it is being temorarily stored. Just search through the .keyName's until you reach "classname" and then the .keyVal of the same index will be it's classname. I am going to make this very similar to APEX's csm importer, but haven't had much time to work on it lately.

Something like this would search and find classnames for brushes, though is simple and doesn't really do anything to keep it simple. You can easily modify it to do whatever you want:



Progress has been pretty much non-existant for the past few months on this, though I am hoping to have some free time any day now. We just put in a new building ($5 million US Project) and it is eating up all my time until we get all the bugs out of it and all the equipement installed fully. This project hasn't died and luckily I wrote the code in such a way that I can come back to it and very quickly pick up right where I left off.

FINN MAN
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 18th Jul 2007 04:45
lost in thought are there any updates?

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st Aug 2007 01:39
Hey man, sorry for the response delay as I just seen this. There hasn't been any work done on this at all really. Been busy at work still and am having some family problems, so I haven't been at my dev computer for the past couple of weeks. Hopefully I can get caught up and get back on this soon. I am going to finish it as my bro wants to make a game and it will also use this.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 13th Aug 2007 20:17
Hope things are all ok LIT. Glad to see you've still got plans for the importer.

Paul.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 18th Aug 2007 11:53 Edited at: 18th Aug 2007 11:56
Thanks man, I keep hoping everything will wind down here and I can get back to coding, but it isn't looking too good. One thing after another keeps hitting me lately. I knew all of this was coming, so I tried to finish this before it. Then they moved the date up on us a few weeks and screwed everything up. And then, eveytime I am supposed to be off I end up working or a family matter comes up. I mean to finish this, I just hope it is sooner than later.

[edit] Thats another reason I made it open source, if anyone see's any improvements or just wants to help out ... feel free to post it here. I always try to check in at break time to see whats going on.

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 18th Oct 2007 21:10
Well LIT, hang in there buddy. If you're making this in C++ , then it should be easy to make a DLL for DarkGDK, and another for C#.

Just had to throw that out there. Many of us DBPro DieHards are moving into deeper water with DarkGDK - just as important No pressure - just throwing it out there - I'm rather busy with work and home stuff too - know the drill.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 25th Nov 2007 08:06 Edited at: 25th Nov 2007 13:37
Been working on this this weekend and now have terrains loading with the layers. Just need to sort the alpha layering and vertex colors. It seems he didn't use the same ordering for the alpha and color saving as he did with the heights. I am having to use the heights from bottom left to top right and bottom to top and then left to right. I am having to use the alpha values from shifted 270 degrees from that. It also seems the color data may be 270 deg from the height data AND mirrored 180 deg from that.

SS attached of the alpha in place. I just need to use a better transparency mode it seems to fix the blockiness.

[edit] New code fixes ordering of alpha and vertex colors. Fixed all issues with alpha and coloring. Just need to figure out how to blend them more seemlessly now 0_o Also added code to not make double polys that would be hidden anyway (alpha of 0).



Attachments

Login to view attachments
Roxas
18
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 25th Nov 2007 18:11
Does this aswell fix all the bugs with default export?

Eg losing lightmapping on transparent objects..


Click For Details!

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 25th Nov 2007 19:21
No idea lol. I never lightmap transparent objects as I don't have any good textures. It always trys to lightmap the transparent part too.

If you could make me a small level and send me the transparent texture to test with I might be able to do something.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 27th Nov 2007 19:46 Edited at: 27th Nov 2007 19:47
New SS comparing my 3dw imported Complex terrain to one of Josh's DBO exports:



Attachments

Login to view attachments
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 28th Nov 2007 02:35 Edited at: 28th Nov 2007 02:40
As far as I can tell that looks perfect. Some minor texture variations, but the colors look right on. I'm so glad that you found time to work on this again! So, would you consider it complete now?

[edit]
I saw the first post

Quote: "Also why doesn't 3DWS save the mesh and material extensions in the names?"

I discovered that recently as well, it's quite annoying. I'm parsing the object to apply bump maps to each limb and the meshes get left out. I'll code a messy workaround I suppose.


Come see the WIP!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 28th Nov 2007 05:50
It's not complete yet by no means. When I get home tonight I am going to fix the texture variations. I assumed it used 1 texture per tile, but Josh tells me there is a formula. I'll try it in about 5 hours. Then I need to write the .mesh loader, which shouldn't take too long if the file format he gave me is accurate. I'll let everyone test it with their levels for bugs and such. Once I have all the brushes, meshes, and terrains loading properly ... I'll start on the grouping and entity stuff.

Once I have all of that working, I'll clean up and optimize the code and it will be for the most part complete. Right now the code is messy and unoptimized due to short time to work on it and having to use brute force to get the kinks out of the file format. I have all the corrections to the 3dw file format if anyone needs them.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 28th Nov 2007 12:53
Great to see you're working on this again. If you need any testing doing, once you get it to that point, I'll be more than happy to help.

No matter how good your code is, someone will improve on it
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 29th Nov 2007 12:00 Edited at: 3rd Dec 2007 21:08
Thx. I will be trying to keep my latest code and exe's in the thread's first post. So anyone can test it and give suggestions. Terrain texture mapping is fixed now. Updating the first post very shortly with code and updated download links (minus the Screens as I don't have time to take new ones yet).

[edit] Starting on the .mesh loader tomorrow.

[edit2] Running later than I thought on the .mesh loader. Here is the code to read a .mesh file and write it's contents to a txt file:



I'm just too sleepy to actually write the code to use the data. I'll try and get it before work today or after work.

[eidt3] Here's the code to read a .mesh file and create a textured object from it. With the texture filename stored in the file.



[edit4] Fixed typo in code

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 2nd Dec 2007 13:37
I've tested quite a few levels and it's working well and really fast to load too. The only thing I've noticed is the texture scaling is out. But judging from one of your posts above I think you're already aware of this. I've included a comparison picture to highlight it (3DWS on top with DBP below). Otherwise, great job LIT!

I'll start looking at your code in a bit more detail as I'd really love to port to this to C ++ for use in DARK GDK once it's finished.

No matter how good your code is, someone will improve on it

Attachments

Login to view attachments
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 2nd Dec 2007 23:16 Edited at: 2nd Dec 2007 23:42
weird. can you send me that level and textures or the details of the terrain and texture size. the texture scaling seems to be working here 0_o

[edit] Also remember that if you change the size of the texture the texture changes. If you have a 512 by 512 in 3dws and a 1024 by 1024 in DBP, it will look similar to that. 3DWS bases the texture scale on the image size so I followed suit with the importer.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 3rd Dec 2007 00:25
The terrain resolution is 128x128 (16384 square) with 8x8 sectors. The texture files used are all 512x512 apart from the Moss and Pebbles texture which is 1024x1024.

Having investigated a bit since I think I know what is happening here now. The texture scaling is configurable in 3DWS and can be adjusted by changing the 'TextureMapScale' setting in the Settings.ini file. I think this defaults to 0.5 in the shipped ini file but I adjusted mine a while back to 0.125 which fits 4 times as many in the same size terrain. This was due to the fact that I'm using close up photographic textures to maintain a high resolution and the standard setting resulted in the textures scaling much to large.

They are successfully exported to the .DBO format files that Josh produces, however, I'm not sure if this is recorded in the .3DS file. If not then I guess changing this value is not recommended if doing anything with the file outside of 3DWS itself!

No matter how good your code is, someone will improve on it
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd Dec 2007 00:54 Edited at: 3rd Dec 2007 01:00
Hrm, that may be what is stored in the terrain lightmap scale. I'll check on it. Thanks for testing

[edit] That is indeed the problem and it isn't stored in the 3dw file anywhere. I'll prolly just add a settings file to the importer and let you set it there for now.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 3rd Dec 2007 11:05
That would be great, thanks LIT.

No matter how good your code is, someone will improve on it
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd Dec 2007 21:07 Edited at: 6th Dec 2007 12:05
I'll add it tonight when I get home and integrate the .mesh loader with it. Then I'll repost. Was gonna do that today, but got a request to re-write the .mesh loader without UDT's for easier portability. So I done that today and here is it's code:



[edit] I have hit a pretty big snag here. I am having trouble with a couple of the .mesh models in the complex example crashing when trying to color the verts for lightmapping. Since I don't have the .smf or .x of these models and 3dws doesn't load .mesh models ... I am going ot have to write a .mesh to .smf converter. Or a .mesh to .x converter. This also means I guess that I can add .smf loader support to the importer

Of course if you need the texture scale fix I can recompile it for you with the changes (but no .mesh support) or you can just change the 2 lines in the create terrain function that sets the scale. Change this:



To this:



Where TextureMapScale is the value you set it to in your settings.ini file.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 6th Dec 2007 15:28
No problem LIT, I can hand modify the code as per your illustration. You concentrate on what you need to do.

I've never come accross .mesh files before but the .smf loader support would be useful for sure!

No matter how good your code is, someone will improve on it
Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 6th Dec 2007 21:51
Looking great. The scaling worked a treat! I added the Set Ambient Light command as the model meshes were looking a little dull colour wise. You have really done a great job with this LIT.

Latest screen shot attached.

No matter how good your code is, someone will improve on it

Attachments

Login to view attachments
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 6th Dec 2007 22:28
Thx man. Yeah the model lightmapping has never been tweaked. I just added the code, but never really compared and worked on it. I was waiting on the .mesh loader as I had it's file format and could load it as I wanted, but I had no idea that 3DWS didn't load them or I would have just went with .smf. I'll try and get ahold of Josh today or tomorrow before I make my final decision on this.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 6th Dec 2007 23:40
Yeah that’s cool. I appreciate you've not had time to fine tune this yet. I'm just really grateful that you've invested so much time and effort in this!

One thing I've noticed, which I also had to deal with in my own engine when loading levels exported in .dbo format, is that although transparency mode 4 in DBPro gives the nicest rendition of trees when close up, it doesn't support auto mip mapping, so as you move away and view them at greater distances you start to rapidly loose any sense of the leaves resulting in a somewhat un-realistic rendition. I was forced to switch the transparency mode dependent on distance from the camera in order to avoid loosing all sense of the leaf canopy at distance and produce a more realistic view.

My aim eventually will be to integrate your loader into my DarkDGK engine along with effective culling routines including your frustum culling to ensure good frame rates for high poly count scenes.

No matter how good your code is, someone will improve on it
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 7th Dec 2007 10:51
Yeah one thing that has alwyas bothered me about DBP was it's transparency modes. It should just pick up the transparency data in the image and use it by default, but you have ot set it yourself and then you have to deal with the image colorkey in all modes. There should be one mode that is just straight alpha channel/image transparency with no colorkey.

I will be meshing this code with this engine when done:
http://forum.thegamecreators.com/?m=forum_view&t=76403&b=8

My aim is to port all of my codes to DGDK.net under Visual Basic. I will also be making an open source quake style engine with Josh's Engine (the dll version using a language not yet determined), Nuclear Fusion (under Visual c++ 2005 express most likely), and Nuclear Basic. All of my codes (in all languages) up until my actual engine will be open source. My goal is to make an engine in each of these to determine which I want to use for my actual engine.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 7th Dec 2007 22:39
Have you used Josh's Engine yet then LIT. I've looked at the demo and it looks very promising. Is the dll version available now. I had a quick look on the Leadwerks site but couldn't find any detailed information on the API.

No matter how good your code is, someone will improve on it
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 7th Dec 2007 23:11
I believe the dll version is available. I'm just waiting until the first of the year, when I buy all of my software for the year, to try it.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 8th Dec 2007 10:30
Ah ok. Will see if I can track down some API info and maybe a trawl through the Engine forum. I had a look at your FPS Engine - great work. Have you worked in the gaming industry or do you just have a natural gift for this!

By the way, I assume you will be providing access to the Entity data but how about the VisGroup data. Its just with careful level design I could envisage VisGroups being used for some fast and effective culling routines, especially on large levels, leaving the more intensive culling routines to just deal with the remaining items.

No matter how good your code is, someone will improve on it
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 8th Dec 2007 14:17
I don't work in the gaming industry. I'm an Industrial Maintenence Technician and machine programmer by trade. I program machines in about a dozen different languages. I just got into this because my brother wants to make a game and I like to help people (which is why all of my stuff is open source). He does all the textures and level building. I'm doing all the programming and we have a few texture artists and modellers lined up once the engine is done.

I currently don't have any plans for vis groups as I don't map and my bro uses them for his own purposes. However since it is open source it would be easy to add yourself, or I can add a visgroup field to the entity list of the engine and you can then group an entity such as VisGroup1 with this set of brushes/meshes and a VisGroup2 with another and so on.

I'm really totally open to the entity setup and will be asking opinions when that time comes, so I may add visgroup support anyway if it doesn't get in the way of my bro's mapping.

Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 8th Dec 2007 17:22
Yeah, thats fair comment. I'm quite happy to code that myself if need be. Once again my thanks for making this open source. I, and I'm sure many others, will benefit from this. I will ensure your name is credited on anything I use it with.

No matter how good your code is, someone will improve on it
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 9th Dec 2007 10:53
I have the mesh memory error fixed I believe. A typo and logic error (from coding sleepy most of the time no doubt). However several of the meshes looked positioned incorrectly and possibly even rotated incorrectly. I am using the Complex.3dw level to test this and don't have all the .smf or .x models to look at it properly inside 3dws itself. I am in the process of writing a .mesh to .x converter to get around this problem since all the models I have are .mesh for it. I have decided to put the smf loader on hold until after I get the vertex lighting, positioning, and rotating of the meshes worked out properly and may not write it at all if there isn't enough call for it as I have a .smf to .mesh converter from the leadwerks engine demo.

Login to post a reply

Server time is: 2024-04-20 07:12:40
Your offset time is: 2024-04-20 07:12:40