Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Ich habe probleme beim renderen/laden von bestimten 3ds files. Die submeshes renderen nicht auf dem richtigen platz.
Das glmulmatrixf hilft auch nicht (opengl matrix vs 3ds matrix?) Ich poste dem code met dem problemhaften 3ds mesh. Ich hoffe das jemand mit einer frischen blik etwas finden kan was ich falsch mache.
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
Hope you don't mind if I answer your question in english .
The problem is that the pivot centers of the submeshes have been moved (maybe for animating them via IK), so that their center is not where it should be.
So you'll have to open up your mesh in 3D-Studio MAX (don't know about other 3D-Modellers) and will have to do this mesh-per-mesh (selecting them and doing it on all meshes won't work) :
- Select mesh
- Click on the Hierarchy-Tab
- Select Pivot
- Click on the Reset Pivot-button
After you have reset the pivot centers of all submeshes, re-export it to 3DS and it should work fine.I tried the above with your model, and it is displayed in your app as it should be.
It's also possible that you can fix this problem in your code, but as I haven't investigated the 3DS-Format that much I can't tell you. But the above mentioned method should always work.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Thanks. I am using cinema4d for editing meshes. I can do about the same. But the problem with cinema4D is that does not seem to write meshes that work with my code. Importing and exporting the file through 3d clipart designer from easy computing fixes it also for me. But that gives me a lot of importing and exporting to do.
So i have to look for some documentation on pivots centers in the 3ds file if i do not want to go the import export way.
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
noeska hat geschrieben:
Can someone give some info on how a skeleton and pivots are stored inside a 3ds file?
Sorry, I can't help you that much.But take a look at wotsit.org, and search there for "3ds".They have some very useful documents on many fileformats, and those 3ds-documents also seem to be almost complete.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
the 3ds loader is rewritten to classes, also material is set in a more inteligent way.
It could do with some more properties, but that is for the next release. Also textures will be back again then.
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Registriert: So Dez 29, 2002 10:37 Beiträge: 251 Wohnort: Ulm
hi noeska
i tried your 3DS file loader but i have some problems!
perhaps you can look at my sourcecode and see what i'm doing wrong:
i load the 3DS-File "schriftrolle" (before i create the rendering context), set up my rendering context and then i want to render in in my render loop -> schriftrolle.render. but there i get an error message (access violation) in the 3dsmesh.render : if _matid[f div 3]<>matid then
if you compile my project, the 3DS file (just make a simple box, same result!!!) should be under data\obj\text.3DS or you change the source...
perhaps i should say that i develop with delphi7 and i made a simple box with 3ds Max R3.
The Link to my source (well, it's not at all a 0.1 version *lol* so don't blame me because of my code-structure..):
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
i dont use dglopengl, so i added a glbindtexture to my gl3ds.pas unit. It is used when loading textures for a 3ds files. As you say you create rendercontext after you loaded your model dglopengl is not initialized when the textures are loaded. I think you use textured 3ds meshes. If not let me know and i will look into it again. Now i go and see if i can get dglopengl somewhere on this site...
Registriert: So Dez 29, 2002 10:37 Beiträge: 251 Wohnort: Ulm
hi
no, i didn't use textured models: i fired up 3dsmax, made a simple box, saved it as 3DS. i tried both options, with 3dsmax texture coordinates saved and without.
the problem still exists when i load the 3DS file after i initialized the rendering context.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
here is a newer version. I thought i uploaded this version already, but i did not. I do not think it will solve your problem, but...
Do your 3ds files work with the example i provide?
Can you post your 3ds file?
Can you post the dglopengl unit so i can compile your example, i cannot get it to compile just now. And i cannot find it here on the site, only the newer 1.5 version.
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
For using models with no material applied to them change to code for loading the 3ds model.
At the end of the EDIT_OBJECT section add the following lines:
//set dummy material
setlength(_Mesh[acount-1]._matname,1);
_Mesh[acount-1]._matname[0]:='';
For using models with no texture coords do the following in the TRI_VERTEXL area:
After the setlength for the vertexes add:
SetLength(_Mesh[acount-1]._mapping,count);
And after where the vertex data is loaded ( _Mesh[acount-1]._vertex[i]:=tv; ) add:
_Mesh[acount-1]._mapping[i].tu:=0;
_Mesh[acount-1]._mapping[i].tv:=0;
I hope this helps. It allowed me to load and render a mesh only 3ds file.
Registriert: So Dez 29, 2002 10:37 Beiträge: 251 Wohnort: Ulm
hi, i attached everything you need.. still doesn't work. i made the changes you said i should make. perhaps you have to change the output folder! (it's M:\poly3Der at me, but i think you don't have M:\ or want it in another folder..)
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
I noticed you did not change opengl in the uses to dglopengl. dgl and opengl are not happy when mixed up. Also as stated before the line with glbindtexture should be commented out. The same goes for glmath and bmp (now texture) units. With the previous version of gl3ds things still bug but with the new one it does not. I cant see anything on screen though only some nice white space. So you need to set up lighting and translate the object.
As a bonus the new version also reads and renders animated milkshape ascii files.
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Mitglieder in diesem Forum: 0 Mitglieder und 10 Gäste
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.