View previous topic :: View next topic |
Author |
Message |
Il Buzzo DeleD PRO user
Joined: 12 Aug 2004 Posts: 271 Location: Italy
|
Posted: Fri Mar 04, 2005 1:23 am Post subject: Irrlicht Loader For Deled files. (Maybe a little off-topic) |
|
|
Hi All,
I've recently started to use Irrlicht as 3D renderer so I've realised today a DMF loader for Irrlicht, so you're able to load directly your dmf files into Irrlicht.
Here you are some screenshots:
Loaded a simple scene, geometry works 100%.
Loaded scene with lightmaps, I'm fixing some issues.
First of all you're obliged to save a lightmap for each face (for now), and then you need to vertically mirror lightmaps generated, owing to different axis configuration.
I think that I'll fix tomorrow lightmap mirroring,and after the use of all kind of lightmap.
This opens new ways for my plugins (have you ever thought of a real time level viewer
with physics engine just like Newton in example).
Anyway , anyone interested please mail me, or wait for a final beta release.
Bye |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Fri Mar 04, 2005 8:04 am Post subject: |
|
|
Hi Il Buzzo,
Great work! I have Irrlicht parked on my harddisk because I wanted to develop something similar, but you have beat me to it (cool). A level preview plugin would be great, but we are also very much interested in an easy-to-follow working example of 'how do I load my dmf into irrlicht'. Might help convincing Irrlicht users to use DeleD
Keep up the great work man!
- Paul-Jan - |
|
Back to top |
|
|
Chris Member
Joined: 08 Aug 2004 Posts: 161 Location: UK
|
Posted: Fri Mar 04, 2005 11:48 am Post subject: |
|
|
Wah hey, Il Buzzo you've saved me a job. I intend to start playing around with Irrlicht and moving away from DB (once Khris lets me). And I intended to write my own dmf loader for Irrlicht, you've save both my time and hair.
I'll wait for the beta though, well for the moment as I'm in no real rush. |
|
Back to top |
|
|
condrula Member
Joined: 07 Oct 2004 Posts: 62 Location: Rome, Italy
|
Posted: Fri Mar 04, 2005 12:29 pm Post subject: |
|
|
Finally, you save me! I was studing the nehe's tutorial on lightmapping for doing this in Irrlicht but Im too noob for this things
-------
visto che sei italiano posso esprimermi come mi viene meglio?
Hai intenzione di rilasciare una classe con codice sorgente per il lighmapping oppure rilascerai qualcos'altro? Io proprio non sono capace, comunque è solo un hobby, se mi puoi aiutare te ne sarei grato
translation: HELP ME!!! |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Fri Mar 04, 2005 1:21 pm Post subject: |
|
|
Oh, an Buzzo, good news: as of version 1.1 of DeleD, the vertical flipping of the lightmaps (and other textures) won't be necessary anymore. That was a DeleD quirck we just kicked out. |
|
Back to top |
|
|
Il Buzzo DeleD PRO user
Joined: 12 Aug 2004 Posts: 271 Location: Italy
|
Posted: Fri Mar 04, 2005 3:37 pm Post subject: |
|
|
Hi guys,
I've actually fixed lightmapping with one texture (My loader will mirror automatically texture in Irrlicht). But there are still troubles with more than one lightmap file (there aren't with a lightmap for each texture. Any Ideas?!!).
So I think I'll wait DeleD 1.1 to definitively release a finished loader, but in the meanwhile, I'll try to solve these little troubles and I'll write a little tutorial.
By the way to load a DeleD file with the loader you'll need only to use these commands:
Quote: |
//let Irrlicht know this new file loader
irr::scene::CDMFLoader DMFLoader = irr::scene::CDMFLoader(driver);
smgr->addExternalMeshLoader(&DMFLoader);
//Load your mesh as usual
scene::IAnimatedMesh* mesh = smgr->getMesh("..\\..\\media\\cube.dmf");
smgr->addOctTreeSceneNode(mesh);
|
So it's really simple, if you want to load your files so you can try my loader at the following address:
http://www.ilbuzzo.net/downloads/DMFLoader.zip
Note that textures and lightmaps had to be placed in the same directory of .dmf file to let it work or you'll just see a grey screen.You can move with your arrows and rotate camera with your mouse. So explore your levels and let me know what do you think of the loader.
Please let me know if there are problems loading levels. Note that only 0.90+ levels are loaded. If you need I'll write a little more code to allow all version levels.
As I've said before you'll experience troubles if you have more than 1 lightmap file in visualization. Please be patient while I'll solve this issue.
When everything will be fixed I'll release CDMFLoader.cpp CDMFLoader.h dmfsupport.h, that is all you need to load your levels.
[Condrula]
Rilascerò la classe per caricare i file DMF completa di commenti! Per quel che riguarda il lightmapping in Irrlicht non è difficile se già hai un file di lightmap (che è una texture come un'altra generata da DeleD), che viene caricata insieme alla texture primaria e poi Irrlicht pensa al resto.
Se hai qualche altro dubbio fammi sapere.
-----------------------
Little Translation:
Irrlicht takes care of lightmap in a very simple way using a second layer texture (lightmap) with its UV values.
------------------------
Anyway Please try this loader and let me know.
Here you are a screenshot of the loader in action (I've loaded warehouse.dmf):
Bye |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Fri Mar 04, 2005 10:56 pm Post subject: |
|
|
Are you using fstream to do the dmf parsing?
And did you have any problems using Irrilicht with DevC++? I donwloaded the 0.8 release, but haven't done anythng with it... |
|
Back to top |
|
|
condrula Member
Joined: 07 Oct 2004 Posts: 62 Location: Rome, Italy
|
Posted: Sat Mar 05, 2005 1:54 am Post subject: |
|
|
Hi Buzzo,
I tried some little lightmapping in this way
1)I made a simple room with Deled and I generated a lighmapping texture
2)I export all in .X format
3)I resaved the x file with Mview(Microsoft's tool, because irrlicht dont like the .x format from Deled)
4)I loaded the mesh with this line:
IAnimatedMesh* mesh2 = smgr->getMesh("test.x");
scene::ISceneNode* node2 = smgr->addAnimatedMeshSceneNode( mesh2 );
5)finally i tried to apply the lighmapping with this one:
node2->setMaterialTexture( 0, driver->getTexture("LightMap0.bmp") );
result: very very ugly ('na schifezza)
"maybe" I miss some concept
|
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sat Mar 05, 2005 8:29 am Post subject: |
|
|
Ad 3) That is rather serious, do you know what exactly is the problem? It should be simple to fix.
As for the general approach, it looks to me like you are just adding a second texture layer (the lightmap) with the same u,v coordinates as the first layer. That is never going to work, as the lightmap has it's own set of u, v coordinates.
The point is: .x files don't allow for that second layer. So that is why we don't store the lightmap into .x files: because we can't.
[note: technically, .x files allow you to store _anything. The problem is that other programs won't know how to interpret the data.]
I have been thinking about a technique that would save the lightmap layer in a different .x file, then you'd have to blend the two x files at runtime. However, that would be a very lame technique. |
|
Back to top |
|
|
condrula Member
Joined: 07 Oct 2004 Posts: 62 Location: Rome, Italy
|
Posted: Sat Mar 05, 2005 10:10 am Post subject: |
|
|
Now I understand the necessity to load the dmf format |
|
Back to top |
|
|
Il Buzzo DeleD PRO user
Joined: 12 Aug 2004 Posts: 271 Location: Italy
|
Posted: Sat Mar 05, 2005 3:40 pm Post subject: |
|
|
Hi All,
Let me answer some questions.
[Vampire_Dark]
No I'm currently have developed some functions like SubdivideString and others that scan manually a string (char by char),and use them with a StringList class to load all DeleD items.
It's really the same I've used in my C++ templates (look at the support.h ).
You can read what DMFLoader is doing in the log.txt file generated after DMF visualization.
DevCpp has no problems with new version of Irrlicht, the only thing is that to use DirectX you need to recompile with DirectX.DevPak.
[Condrula]
To Do a better thing you'd define each material like EMT_LIGHTMAP, and each MeshBuffer like a SMeshBufferLightMap that has two layers (one for primary texture and the other for Lightmap) and two sets of UV (like the texture slots). It's not a difficult thing but you need lightmap UV data.
Anyway had you some troubles with Loader?
I'm thinking to implement dynamic lights by loading not all lights in DeleD but only those having a particular User Info tag (in example : dynamic).
What do you think about it?
Some specifications about the DMFLoader you can try:
Quote: |
Set DeleD Ambient light in Irrlicht - complete
Load Complete Textured Mesh - complete
Load Lightmaps - loads all but some give wrong results
Auto Flip Textures - complete
|
Note that owing to the fact that Irrlicht has a maximum of two layer for material I'm working on implementing the other layers too.
But I must do it modifing the primary texture (like flipping) on the fly before loading so I'll add this later (I need to understand better the way to implement multitexturing and DeleD options).
I'm actually writing a little more comment to generate a better documentation with Doxygen.
I'll probably then release a beta of loader (cpp files to load class) to the community.
I'll then write something in the Irrlicht forum.
Bye |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sun Mar 06, 2005 9:14 am Post subject: |
|
|
Quote: |
Note that owing to the fact that Irrlicht has a maximum of two layer for material I'm working on implementing the other layers too. But I must do it modifing the primary texture (like flipping) on the fly before loading so I'll add this later (I need to understand better the way to implement multitexturing and DeleD options). |
Il Buzzo, it sounds like you are talking about 'texture baking' (merging layers 1:1) here. I wouldn't spend too much time on that right now if I were you, as it will only work for the _current_ DeleD version. The whole point of having those multiple layers in the DeleD ME is that they can have multiple sets of UV coords (DMF already allows for this, but the editor doesn't provide means to edit the seperate layers yet, but will soon). Once you have to deal with separate layers of different UV values, texture baking won't work anymore. [note: theoretically you could prebake all permutations of the layers, but that would costs gigabytes of texturememory for any decent-size model].
The point is: except for lightmaps, multilayering in DeleD only makes sense for quick prototyping, until we get around to implement better texturing. It is a piece of cake for the artist to do the texturing baking _manually_ once they want the level in Irrlicht (or whatever final renderer they prefer).
Condrula: I will try and figure out why irrlicht won't load the DeleD .X files straight away somewhere today. Not sure if I can get it in before the 1.1 release which is scheduled for today though (Jeroen is working on that). |
|
Back to top |
|
|
condrula Member
Joined: 07 Oct 2004 Posts: 62 Location: Rome, Italy
|
Posted: Sun Mar 06, 2005 12:48 pm Post subject: |
|
|
Quote: |
Condrula: I will try and figure out why irrlicht won't load the DeleD .X files straight away somewhere today. Not sure if I can get it in before the 1.1 release which is scheduled for today though (Jeroen is working on that). |
This is a well know problem about deled and Irrlicht, but it isnt a big problem, because all irrlicht's users know how to fix this with mview.exe
However if you search for it in irrlicht forum you will find something about the use of ";" and "," |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sun Mar 06, 2005 2:43 pm Post subject: |
|
|
I fixed it. Wasn't a problem with the ; and ;; (version 0.8 of Irrlicht does a nice check on that particular quirk in the x 3.02 specs), but with the irrlicht tokenizer as used in the xfile parser. It interpreted {materialName} as 1 token in stead of three.
DeleD now saves { materialName } (mind the spaces) and now Irrlicht seems to load my test x files without a problem. I'll report this at the irrlicht forum as well, because it is clearly a bug.
Had a pretty good time debugging (stepping through) irrlicht in VC6 though, I had never done that before |
|
Back to top |
|
|
Il Buzzo DeleD PRO user
Joined: 12 Aug 2004 Posts: 271 Location: Italy
|
Posted: Mon Mar 07, 2005 1:14 am Post subject: |
|
|
Hi Guys,
I've just finished a little documentation, so I've released DMFLoader for Irrlicht.
You can download it from the following address:
http://www.ilbuzzo.net/downloads/DMFLoaderSDK.zip
This small package (44kb) contains the following files:
-CDMFLoader.h : CDMFLoader definition
-CDMFLoader.cpp : CDMFLoader implementation
-main.cpp : A short sample of usage (DMFLoader)
-example.dev : A DevCpp sample project file
-readme.txt : Some infos
-DMFLoader.chm : A little documentation
So I think you'll enjoy DeleD level loading directly in Irrlicht.
I've just now noticed that DeleD 1.1 has been released, so I'm going to download it cause it corrects V flipping.
I'll then change a little my code (cause now it automatically flips textures).
Well, bye and enjoy.
[EDITED]:
I've changed my code so texture from 1.1 on won't be flipped while those of version 1.0 and inferiors will be flipped.
Now everything is working good. |
|
Back to top |
|
|
|