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.

Work in Progress / 3dw Importer for DBP

Author
Message
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st May 2009 16:46 Edited at: 5th May 2009 22:16
Well due to the unfortunate slowing down of the US economy ... I have some more free time now. Yay me! So I am coding again after almost 2 years. First up is to finish the open source 3dw Importer I started appx 2 years ago.

Compiles under DBP U7.3 fine ... others haven't been tested.
The media is for demonstration only and Leadwerks owns the rights.
The code is free to use as you please; you don't even have to mention me

Everything should load fine but some meshs may not color right. If you have any problems or bugs let me know.

Screen Shots 12k appx:


http://www.mapmasterz.com/lit/3dw_loader_SS_00.rar
http://www.mapmasterz.com/lit/3dw_loader_SS_00.zip

Media Download for Complex Example 37MB appx:
http://www.mapmasterz.com/lit/3dw_loader_00_Media.rar
http://www.mapmasterz.com/lit/3dw_loader_00_Media.zip

Download w/ source and exe only 2MB appx:
http://www.mapmasterz.com/lit/3dw_loader_00_exe.rar
http://www.mapmasterz.com/lit/3dw_loader_00_exe.zip

Code Only 20k appx:
http://www.mapmasterz.com/lit/3dw_loader_00_source.rar
http://www.mapmasterz.com/lit/3dw_loader_00_source.zip

use the Load test.bat to load your level just change the filename and or path


`changes as of 05-04-2009

`added crude numbering system to updates. 00 for terrain sectoring update and the object grouping will be 01 when finished and so on until we get near a beta stage. Only the code and exe version will be changing mostly though.

`Added new functionality to creation of terrains for option of 1 object per sector or 1 object per terrain. create terrains a value of 0 passed in = normal and 1 = welded in the first parameter
`second parameter is the creation mode 0 = 1 object per terrain , 1 = 1 object per sector
LiT3dw_Create_Univ_Terrains( 0, 1 )

`changed brush and terrain creation functions. Now call them by:
`create brushes a value of 0 passed in = normal and 1 = welded
LiT3dw_Create_Univ_Brushes( 0 )
`create terrains a value of 0 passed in = normal and 1 = welded
LiT3dw_Create_Univ_Terrains( 0 )

`added support for face welding on brushes to use less verts

`renamed all variable, functions, and arrays to include LiT3dw_ at the first of the name

`fixed typo in brush creation function that would make it crash if the first face was deleted of a brush

`added support for making welded terrains that use a small amount of verts and an index list

`added support for caulking brushes. Texture your faces with caulk.bmp now treats them as delted faces
`if you build with caulk.bmp and only select and texture your faces later it can save you up to 33% in polys from my tests
`as usually you can only see 4 sides of most brushes.

`added TextureMapScale# = 0.5 for texture scaling on terrain
`if you changed it from this in your 3dws ini file make it match
`it's at the very first of the Make_Types_Vars subroutine

`added support to search for a media folder incase you just wanna put all your stuff
`in one folder as long as the names don't overwrite files

`fixed lighting color error on terrain and meshes as the r and b values are backwards in GL

`fixed error in writing of terrain layers above the first ... typo in alpha checking

`added checking to cut polys from first layer if totally covered by any other layer
`saved 17,500 polys appx on the complex.3dw map

`mesh support is very limited due to the 3dw file format limitations
`.x triangulated models allowed only may try to add .smf support later
`but no .x models with quads are likely to work if you have any trouble models
`shoot them my way and I'll see what I can do.



`On the to do list in order pretty much

`add proper entity and grouping support (working on grouping now)
`add LOD levels to terrain
`add support for using a TextureMapScale entity to the map so you don't haveto change the code
`possibly do the same with ambient lighting ifneeded
`get open source FPS engine working with current DBP and Vista ... silent crashes now
`tie this into my open source FPS engine
`update the frustum culling for new optimizations ... may add quadtree or octree support
`modify the inca pro .dbo loader to mimic this importer too as I now have the commands I needed 2 years ago to make it work right
`release all of codes in a program announcements thread for LiT's stuff
`my culling, ngc modifications, open source engine, .3dw loader, and .mesh loader
`and anything else I can find that may help someone
`may write a .smf model loader for DBP
`final version of the open source FPS engine is slated to be able to load levels from 3dws and CSHOP
`I may add TeD support and magicworld/matedit using objects in place of the matrixs or any others people feel would be usefull


ANY problems or suggestion let me know
barfieldjoey at hotmail dot com
barfieldjoey at yahoo dot com
barfieldjoey at mapmasterz dot com
barfieldjoey at gmail dot com

make sure and put LiT, lost in thought, DBP, NGC, or something in the subject so the spam monster will be less likely to eat it



Thanks to:

APEX for his CSM Importer dll and open source DBP versions. Both taught me alot and inspired this.
IanM for all the codes he's posted throughout the years that helped me
Matthew for creating NGC andleaving it in an open include format instead of a Licensed dll.
Green Gandalf for the blend shader
Pixel Perfect for porting this and improving it for the DGDK
JoshK for creating 3DWS
Cash Curtis II, Lawrence, Jason P Sage, Olby and all the others for the encouragement

Attachments

Login to view attachments
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 1st May 2009 18:20 Edited at: 1st May 2009 18:21
If you want, I can make a small LOD terrain plugin which allows you to create terrains sector by sector instead of the whole thing at once. Just like BlitzTerrain but a different way of building the terrain.

Could I use this in an open source game engine im making? you will be credited.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st May 2009 19:22 Edited at: 1st May 2009 19:28
I already have a great idea for the LOD and it won't have to worry about seems and what not I'm already making it sector by sector and with the new welded format I can easily make LOD levels I think. I'll play with that later. I have already thought of using your free version of the LOD plugin for my open source engine, but it's purpose is to do as much as possible with DBP code. I may make a version for each

You can use this or any of my codes however you want. You don't even have to give me credit really. It is still a work in progress though. The main reason I put it and all of my codes up here is so I can have more people test them and give feedback I'm a programmer and lack the media to test with and have no talent to make any LOL. If you have any ides for improvements feel free to post them or ideas/feedback. I'll see what I can do.

This will be used with this engine:
http://forum.thegamecreators.com/?m=forum_view&t=76403&b=8

And the engine will be updated later as well. Especially the crappy weapons handling system...

[edit] I will also be going back and making all the codes stand alone better so they can be more easily added to other's projects by adding like LiT3dw_ to the beginning of all the variables in the 3dw loader and LiTCull_ to the culling code and etc. I have alot of projects I wanna finish while I have some spare time

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 1st May 2009 23:30 Edited at: 1st May 2009 23:35
Glad to see you back LiT. You won't believe but just a few hours ago after almost a year of wandering through various engines, techniques, shaders etc. I decided that I would go with a simple combination of PureGDK + 3DWS + Your importer.

And what a surprise when I found out that you are back and updating it. Now I need to get into your code and try to convert it to PureBasic as it is the language I am currently trying to use.

Once again glad to see you back!

Cheers,
Olby

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.3, PureGDK 1.1
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 2nd May 2009 01:15
It's good to be back

I wouldn't convert it just yet if I were you unless you can use it like it is ... there are lots of changes coming The next version will have all the variables, functions, and subs renamed to allow more portablity for adding to other peoples code. All will be LiT3DW_ plus their names now. The next version will also have the welded brush function. And then the terrain and brush creation and possibly the reading functions will be modified to accomodate the grouping and entity options which I'll be working on very shortly after the brush welding code.

And I know the terrain functions will be modified when I add the LOD layers to it So you may want to wait until I am to the point of making small changes to the code before porting.

I am just posting what I have so far in the hopes people will test it and let me know if anything is broken or something needs changing.

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 2nd May 2009 01:38 Edited at: 2nd May 2009 01:54
Yeah, I understand all that. I am not a coder at all because I'm more of an artist (level design is my area) so it will take me some time to get into the whole format structure and parse it but non the less I will try it at least. Your code helps a lot.

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.3, PureGDK 1.1
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 2nd May 2009 11:50
I have a write all to file code that just reads the data straight in order and writes it to a txt file so you can read the data. I need to include it in the next version too for those just wanted a more BASIC discription of the file format ... especially since the version that comes with 3dws is very wrong 0_o

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 3rd May 2009 13:43
Oh, yes, that would be extremely great. I remember that I got somewhere the previous version of your importer but I cant find it right now, as far as I remember it also had that basic data parser included.

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.3, PureGDK 1.1
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd May 2009 14:07
Yeah I'll hunt them both up ... the new file format, the basic reading and the basic writing and include them in the next download. You may can find something in my old code if you can't wait. All downloads in my old thread should still be active.

http://forum.thegamecreators.com/?m=forum_view&t=100900&b=13

An update here though:

I just finished renaming everything in my code to have LiT3dw_ at the first of the name. And I mean everything. Took forever but I got tired of peoples global variables making bugs happen. Now it is totally self contained and shouldn't be bothered by anyone's code. I may have broken something but it all seems to be working. I am now starting on the make welded brushes code. As soon as that works I'll update the downloads and first post.

x1b
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location:
Posted: 3rd May 2009 16:25
Rather off topic, but it really is awsome to see you around again,LiT.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd May 2009 18:54
Good to be back lol. I'm gonna go to bed and start completely over on the brush welding when I get up ... I really, really hate the 3dw file format. But what can ya do ... my bro loves the editor

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 4th May 2009 00:53
Whats wrong with it ? Seems rather straight forward to me. Well at least if you compare it to something major like collada.

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.3, PureGDK 1.1
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th May 2009 04:09 Edited at: 4th May 2009 16:27
It would be awesome if it had a few things added. 1 copy of each mesh so we know for sure how his 3dws engine loaded them (vert and limb order ... quads or triangles) it gets very messy with anything but triangualted .x meshs and even that is messy. DBP loads them with the limbs and verts in reverse order ... and with a different number of limbs than 3DWS. The 3DW file format was designed for his engine really lol. It also needs to use the mesh extension and material extension functions that it have built in but not being used ... The csm format was way, way better to me. But anyway back to brush welding lol.

That being said I'll probably go back and write a proper .dbo parser to do the same thing this does now that I have all the stuff that prevented me from doing so 2 years ago.

But this is already on the list so it's gotta be finsihed

[edit] Brush welding is finished. Had to settle for a face welding instead of whole brush. The UV's hardly ever matched up and was taking too long really. Takes less that 9 seconds to load that 252,608 poly level with this crappy laptop The DGDK version was aboutthe same time though. Looking for the file format and read/write stuff for Olby before uploading changes.

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th May 2009 20:52
I couldn't find the simple file format I had ... but I did include the read/write all data to text file source and exe's to those downloads. I may break them up later into 2 seperate when I write a new file format. Gonna break up terrains into one object per sector now so I can make an easy LOD system a few steps down the line and allow DBP to auto cull it more.

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 4th May 2009 21:06
Thanks for the upload! It is great. Works quite fast too. On my laptop it loads in about 5-6 seconds which is very fast comparing it with FPSC load times.

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.3, PureGDK 1.1
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th May 2009 21:40 Edited at: 5th May 2009 22:19
It should be faster on the next update with DBP helping on the culling I may post a full example meshing it with my culling code once I get the terrain LOD stuff done. That'll be down the road after I get the entity work done though. I'm pretty much followingthe to do list line by line unless someone asks for something like the terrain option for 1 object per sector with 1 limb for each layer. Will make LOD as well as layer type collision easier so you can tell when your on grass and stuff I haven't messed with LOD in a few years so I'm excited about that lol. My only question is do I just create the LOD with the number of layers listed in the map file and make the actual LOD updating code seperate from this as it's technically not part of the actual loading of the map and more of the engine. Or just bunch them together since the LOD will be kinda written for these terrains.

As I said though any ideas/comments/suggestions or someone see something that needs fixing let me know. And if anyone wants to improve upon or add to the functionality of the code feel free. If I like your changes I'll add them officially. If not I'll provide you with the hosting for your own version of this as long as it's open source.

[edit] I'm wicked sleepy so I just posted the new terrain function in the first post. I'll upload new stuff when I wake up.

[edit2] New code and exe's updated. Renamed the SS and media links but they didn't change. From now on any version number changes will show a change. Silly me for not doing something already there ...

Data
19
Years of Service
User Offline
Joined: 26th Nov 2004
Location: Winnipeg,Canada
Posted: 6th May 2009 03:26
Hey LiT,

You helped me out on another thread dealing with 3DWS and pointed me in this direction. My question is what exactly does your importer to as compared to simply exporting in the .dbo format?


Thanks

Data

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 6th May 2009 06:01
Nothing much at the moment really. Once I get the entity and grouping work done though you'll be able to group your objects together in 3dws and they will be one object in DBP. You'll be able to set their rotational and positional centers with an entity. For swinging doors and etc. And you'll be able to make better use of the entities in the map. That being said I started this a few years ago when I didn't have everything I needed to do this with dbo objects. I do now and am gonna expand this later to include dbo support most likely. Or just expand his IncaPro demo like I did with the culling and collision update. However I have no idea nor the time to explore as to how groups relate to limbs in dbos. I have the info straight up in the 3dw file format though I uploaded the terrain splitting version and am now working on the grouping. Once I get that and the entity work done it should get more interesting

Data
19
Years of Service
User Offline
Joined: 26th Nov 2004
Location: Winnipeg,Canada
Posted: 7th May 2009 00:19
Nice thanks That really clears things up. One more tiny question if you don't mind me bothering you, with .3DWS, if you created a lightmap on a model and export the model as a .DBO, should the lightmap load along with the model all at once? Or is there a separate procedure for using the lightmap?

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 7th May 2009 01:54
It should load automatically with no extra code I believe. However it seems they used to be darker in DBP than they were in 3DWS. I used a blend shader to correct that which dropped the FPS a bit but looked perfect. Josh used mod blending instead of 2x mod in the dbos. I think it may export the lightmap files though so you may have to put them in the same place as the dbo. Not sure though. Like I said it's been 2 years almost since using dbo.

Data
19
Years of Service
User Offline
Joined: 26th Nov 2004
Location: Winnipeg,Canada
Posted: 7th May 2009 02:25
ok thanks, I'll check it out. thanks again so much for the help

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 7th May 2009 05:23 Edited at: 7th May 2009 05:23
No problem. I didn't get much work done on this last night I'm still kinda sick. But I do have the grouping worked out now in my head I just gotta code it. You'll then be able to group a set of brushes in 3DWS and it will be one object in DBP. You will be able to control the way DBP creates them. The answer to what is a limb/object in 3DWS will be answered. After that i gotta code the entity feedback commands so you can group the brushes / meshes with an entity and use them for doors, fans, teleporters or whatever you want and it'll be positioned and rotated at the entities position.

Data
19
Years of Service
User Offline
Joined: 26th Nov 2004
Location: Winnipeg,Canada
Posted: 7th May 2009 07:13
ah excellent defiantly will be using then. keep up the great work and get better

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 9th May 2009 01:30 Edited at: 14th May 2009 14:22
Bah ran into a snag in working on the grouping. Meshes are lightmapped with vertex colors and brushes are done with textures ... so I'm gonna have to recode it. Meshes will be ommited from groups that contain brushes and meshes. And only 1 mesh per group is allowed. But you will still be able to group a mesh with an entity(s). You will also be able to group as many entities as you need with either brushes or meshs. An you can group as many brushes as you need together and it'll be 1 object. Hope to have it done in the next day or 2.

[edit] Getting a little behind on this as time is getting a bit short again. I got the grouping sorted out today though for up to a combination of 2 groups. That's all I need, but I may come back and add support for more complex groups later. I just gotta modify the code now to great one brush object per group and I'll post the next update when that's done.

Login to post a reply

Server time is: 2024-09-28 14:13:38
Your offset time is: 2024-09-28 14:13:38