Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Sa Jul 05, 2025 15:23

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 33 Beiträge ]  Gehe zu Seite 1, 2, 3  Nächste
Autor Nachricht
BeitragVerfasst: Mo Mai 14, 2007 13:34 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Hello... time for a less technical question from me.

As anyone reading in here will see, I am making good progress with my main project HMusicCentre in OpenGL - it used to be completely GDI, now it is a hybrid, and over time I know it will incorporate more OpenGL code. The project is a media player and I have created two 'indicators' by defining vertices and normals line-by-line that can be shown when a certain operation takes place.

One is a default H (for HMusicCentre) and the other is the volume control:

Bild

I would like to start creating more of these indicators, for commands like Play, Next, Random etc., and I could do them line-by-line I guess. I am starting to wonder whether I shouldn't be doing this using some tool (preferably free of course) that will allow me to create 3d models that are simple to maintain and load into OpenGL and either colour or apply textures to... so, obvioulsy, I'd need it to be a well-known file format that I don't have to write a loader for.

Where would be a good place to start creating 3D models that I can easily load into OpenGL programs?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 14, 2007 14:46 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2068
Programmiersprache: C++
You can use Blender for creating models. The only problem is how to load them in OpenGL:
I know of existing loaders for obj and 3ds and at least you can write your own format.

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Milkshape 3D?
BeitragVerfasst: Fr Mai 18, 2007 12:54 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
I downloaded Milkshape 3D to give it a go. I'd had a go with Nehe lesson 31 to display the rotating cross; if I try to point the program at a ms3d file I've created I get an exception deep inside some utility code. I was wondering if there was a good example of an ms3d file loader out there in Delphi that could be used as a utility class. Of course, delving into the ms3d file format and creating my own loader could be a lot of fun, but re-inventing the wheel unnecessarily is just counter-productive.

I just want to get away from creating my 'objects' by hand using OpenGL primitives. Milkshape 3D seems a reasonable way to go... any pointers to loader utilities?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 18, 2007 15:24 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
gl3ds is also capeable of loading and saving of milkshape ascii models. Do give it a try. http://www.noeska.com/dogl/gl3ds.aspx .

PS gl3ds is being rewritten. It will also support wavefront obj in the near future.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Progress... of sorts...
BeitragVerfasst: So Mai 20, 2007 18:41 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
OK, so I have persevered with the loading of Milkshape MS3D files and I have now arrived at the point where I can load the files and render the objects in Delphi. This is true for all 'static' models that I have tried.

Bild

The next obvious step would be to be able to load the skeletal animation information and be able to eventually render that. For now I am stuck on the loading of this skeletal animation information. I have managed to get the fAnimationFPS, fCurrentTime, iTotalFrames and nNumJoints out of the MS3D file correctly.

At least, I believe I have - the number of joints returned by my program matches that which the Milkshape "Show Model Statistics" tells me and the total frames matches that which I can see in Milkshape down by the "Anim" button. Here I am getting a little bit stuck, seems each joint can be a different size and I'm trying to figure my way through the file. I have the name of the first joint in a model - that's good - the second one is a jumbled mess, so obviously my pointer into the data is not getting set correctly on each joint iteration... I'll have to work on that I guess.

This is exactly where I did not want to find myself... trawling through a file structure trying to figure out how to pull that data into my program and then figure out how to work with it.

noeska, does gl3ds load Milkshape ASCII files only? Is this a big consideration for me, should I be bothered about ASCII or MS3D? Will gl3ds load just the models and allow me to display them, or will it also load all of the skeletal animation stuff too and allow me to display that?

My program's log for a model I am loading, you can see it goes wrong after Joint 0:

18:38:50: Opening ms3d model: C:\Documents and Settings\Administrator\My Documents\Programming Projects\Delphi 7\OpenGL\OpenGL Milkshape Loader Animation\character2.ms3d
18:38:50: Model file assigned OK.
18:38:50: Model file read into buffer OK.
18:38:50: Model file header is MS3D000000.
18:38:50: Number Vertices: 1302.
18:38:50: Number Triangles: 1863.
18:38:50: Number Groups / Meshes: 5.
18:38:50: Number Materials: 4.
18:38:50: fAnimationFPS: 1103626240.
18:38:50: fCurrentTime: 1065353216.
18:38:50: Total Frames: 60.
18:38:50: Number Joints: 21.
18:38:50: Joint 0 name: Hip.
18:38:50: Joint 1 name: ×#=.
18:38:50: Joint 2 name: .
18:38:50: Joint 3 name: €.
18:38:50: Joint 4 name: .
18:38:50: Joint 5 name: .
18:38:50: Joint 6 name: ™?.
18:38:50: Joint 7 name: .
18:38:50: Joint 8 name: .
18:38:50: Joint 9 name: .
18:38:50: Joint 10 name: .
18:38:50: Joint 11 name: @.
18:38:50: Joint 12 name: ÍÌL>.
18:38:50: Joint 13 name: Íu>®Gá>.
18:38:50: Joint 14 name: (B Íu>{.?.
18:38:50: Joint 15 name: .
18:38:50: Joint 16 name: .
18:38:50: Joint 17 name: ®?.
18:38:50: Joint 18 name: u>ÍÌÌ?.
18:38:50: Joint 19 name: B Íu>…ë?.
18:38:50: Joint 20 name: C(B Íu>¸@.

I will figure this out, but I'd prefer not to even bother... if gl3ds allows me to load and animate Milkshape models (even better if they're in M3DS format), I'll probably just dump this as a bit of wasted time, I'd much prefer to rely on some utility code and concentrate on adding real value to my project.[/img]

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Mai 20, 2007 19:04 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
OK, it's always the way... you spend half a day on something and you decide to ask for help, and then you manage to get around the problem - well, the immediate problem anyway. I had some stupid operator precedence thing going on - smart use of parenthesis appear to have sorted my joint reading problem...

19:01:34: Opening ms3d model: C:\Documents and Settings\Administrator\My Documents\Programming Projects\Delphi 7\OpenGL\OpenGL Milkshape Loader Animation\character2.ms3d
19:01:34: Model file assigned OK.
19:01:34: Model file read into buffer OK.
19:01:34: Model file header is MS3D000000.
19:01:34: Number Vertices: 1302.
19:01:34: Number Triangles: 1863.
19:01:34: Number Groups / Meshes: 5.
19:01:34: Number Materials: 4.
19:01:34: fAnimationFPS: 1103626240.
19:01:34: fCurrentTime: 1065353216.
19:01:34: Total Frames: 60.
19:01:34: Number Joints: 21.
19:01:34: Joint 0 name: Hip.
19:01:34: Joint 1 name: Abdomen.
19:01:34: Joint 2 name: Chest.
19:01:34: Joint 3 name: neckDummy.
19:01:34: Joint 4 name: Neck.
19:01:34: Joint 5 name: Head.
19:01:34: Joint 6 name: hair.
19:01:34: Joint 7 name: Left Collar.
19:01:34: Joint 8 name: Left Shoulder.
19:01:34: Joint 9 name: Left Forearm.
19:01:34: Joint 10 name: Left Hand.
19:01:34: Joint 11 name: Right Collar.
19:01:34: Joint 12 name: Right Shoulder.
19:01:34: Joint 13 name: Right Forearm.
19:01:35: Joint 14 name: Right Hand.
19:01:35: Joint 15 name: Left Thigh.
19:01:35: Joint 16 name: Left Shin.
19:01:35: Joint 17 name: Left Foot.
19:01:35: Joint 18 name: Right Thigh.
19:01:35: Joint 19 name: Right Shin.
19:01:35: Joint 20 name: Right Foot.

This does not mean that my question does not still stand though - I would much prefer to dump this digging around into MS3D files and to just get hold of a Delphi utility library that I can use to load these Milkshape models and the skeletal animation stuff and then render and animate them. It would make all of this worthwhile to be honest.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Mai 20, 2007 21:16 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Why use the binary format?

PS gl3ds is already capeable of using/playing/rendering skeletal animation, but you have to use the milkshape ascii format.

PS2 if you can already load the binary format you should try map those to the TSkeleton / TBone structure for gl3ds. Try taking a look into gl3ds how the milkshape ascii (tskeleton) is loaded to the objects. You should be capeable to achieve the same with your values loaded from the binary format.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Thank you for your response!
BeitragVerfasst: So Mai 20, 2007 21:39 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
OK, my thanks to you for that response.

I have no idea why I'm using the binary file format to be honest, other than the fact that I started there. I'm perfectly open to using the ASCII file format, with or without gl3ds, if that is more suitable.

Can I ask you, is there a nice simple Delphi program available that demonstrate use of gl3ds loading and rendering a static model and also loading and playing animations from a skeletal animation model? A sandbox kind of environment, if you like? Provision of this would allow me to get up and running pretty fast I guess.

Of course, I'm not asking for freebies here - as I've already spent days working to the point I am now at with the binary format. I think I've put enough effort in to this and if I'm going to change to using gl3ds then I'd want it to be as simple as it possible could be.

Is the gl3ds API like... LoadModel (ModelToLoad); then, later, PlayAnimation (Animation);? Perfect world if so. I don't mind asking dumb questions... are you able to choose amongst which animation you want to render in the model?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Mai 20, 2007 22:36 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Download: http://www.noeska.com/downloads/vclgl3ds_5b.zip from http://www.noeska.com/dogl/gl3ds.aspx. And you should see a walking animal.

Loading mesh:
mesh1:=TAll3DSMesh.Create(nil);
mesh1.TexturePath:='textures\';
mesh1.LoadFromFile('models\hog2.txt');

Progres animation:
if mesh1.NumSkeletons >= 1 then
mesh1.Skeleton[0].AdvanceAnimation();

And Render
glpushmatrix();
gltranslatef(0.0,0.0,-10.0);
glscalef(0.01,0.01,0.01);
glrotatef(45,0.0,1.0,0.0);
mesh1.Render;
glpopmatrix();

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Had a look...
BeitragVerfasst: Mo Mai 21, 2007 00:03 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Got it. Thanks very much. Yes, I do see a walking (is that running?) boar of some kind... I say 'running' 'cos it's moving really fast though, up to 572fps according to the text in the window - its little legs are a blur! My computer isn't that fast, but I thought the idea was that the animations would run normal speed anyway... am I missing a code setting or something?

To check it out... I passed in another model (an .ms3d file that I had exported to Milkshape ASCII format) and its textures and I altered the glscalef (0.01,0.01,0.01); line to glscalef(0.1,0.1,0.1); and I saw the model (good!) and it was doing its animation (great!) but also really, really, really fast. When I went to full screen it was slightly better, but I was still getting 240fps and my model's animation was just too fast to observe properly. Thinking about it... not sure the FPS has anything to do with the animation speed anyway... but it's fast anyway. This happened with the bend.txt model you provided in the .zip too.

I guess I'm missing something obvious... and, as you will know much better than I, I thought I'd just ask you... is there a speed setting or something hidden that I can't find?

P.S. The animation obviously slows down to reasonable speeds if I put the ApplicationEventsIdle code into a TTimer with an appropriate Interval but, as I say, I think that I'm missing something obvious as I'm pretty sure that's not the way it's supposed to work.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Hmmm... curiouser and curiouser...
BeitragVerfasst: Mo Mai 21, 2007 01:11 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
One final question, if I may...

I have a test model (not mine - someone else's that I downloaded and have just been using for testing) with four materials / textures... one is for the head... face.jpg. The other three are rendered fine with your test program, but the head is not, it is left white. Are there any insights as to why that might be? The model is rendered correctly in Milkshape itself. The face.jpg material is referenced in the ASCII file the same way the other textures are, and is in the same location. It is the last one of the four referenced in the file, but there is definitely Materials: 4 in the file.

I have included the ASCII model and its four materials here if you are able to take a quick look-see and tell me what my problem might actually be. Other than the animation speed issue and this small annoyance of a missing material in one of the test models, both are problems that I'm sure you'll be able to guide me towards eliminating in very short order, this gl3ds stuff looks really good... very comprehensive indeed.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 21, 2007 18:37 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
I send the material.apply i use currently to you routine to you. I migh have left something commented out what should not be. I do not know how compatible it still is as i am rewriting gl3ds currently. But i do get textures for the head.

The speed matter is that the example is set up to work as fast as possible. In your case thing get worse because you have told your video not to wait for vblanks. If you enable wait for vblanks the screen is redrawn at your curren screen refresh rate so an lcd at 60mhz would give about 60fps even if your graphics card can do faster. If your turn wait for vblank off is goes as fast as your system can handle. I believe you can turn on/off vblank from opengl also.

It is not an good idea to put ApplicationEventsIdle code into a TTimer. However you could put
Code:
  1. if mesh1.NumSkeletons >= 1 then
  2. mesh1.Skeleton[0].AdvanceAnimation();

into a TTimer. This should give an high framerate while you are able to control the animation speed through the timer.
You could also check the time in ApplicationEventsIdle and only advance the animation if x time has passed since the latest advanceanimation.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: ...not making progress.
BeitragVerfasst: Mo Mai 21, 2007 19:24 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
OK, no progress I am afraid.

The procedure "T3dsMaterial.Apply;" you sent me only looked different in comments, having "//TODO: weer aanzetten" on every "fTexture.Bind;" line. At least that's all I could see. Anyway, I replaced it completely with the new procedure and I still got the white head on the test model.

I checked the glBitmap.pas and dglOpenGL.pas file versions. The dglOpenGL.pas version is dated 06.12.2005 on both our systems and glBitmap.pas version is 1.8.10 on mine while the file on your system is version 1.4.5. Although you mention that this is not likely to be the issue.

I then overwrote the gl3ds.pas you originally sent me with the updated one; I ran into many errors to do with Logger, I removed calls to Log and, then a variety of other errors cropped-up I'm afraid. So that avenue doesn't look to be fruitful at the moment.

You also mentioned trying some light settings, but I wasn't sure how that would help. I see my other textures after all. If there is something I am missing here, I would appreciate knowing.

I have uploaded the current situation - basically the code you sent me that is just pointing at a different ASCII model - and if you tell me you see the head textured when running the .exe I'll probably go a bit nuts. When I run the .exe I see the body fully textured, but the head completely white. If you have the time, you can download it from here. I think it's worth pointing out that this same ASCII model can be loaded into Milkshape successfully and (in ms3d format of course) it can also be loaded successfully into my Milkshape model viewer - although, of course, that does not do any animations. So I'm a bit confused at the moment I must admit.

Thank you for your explanation on the speed of animations. I will admit that this was not how I expected it would actually work. I had thought that animation keyframe interpolation would ensure that the animation ran the same speed on all computers. At least I understand there's not something wrong now. As you suggest, I will have a look through the forum to see if I can find any further information on this.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 21, 2007 19:49 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Besides the error on the logger what errors do you get on working copy of gl3ds? Removing the logger related things should give an working (compiling) version.


Dateianhänge:
chars1.jpg
chars1.jpg [ 22.06 KiB | 13022-mal betrachtet ]

_________________
http://3das.noeska.com - create adventure games without programming
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 21, 2007 19:56 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
OK - not actually lots of errors... I get...

Undefined identifer, ptRed, ptGreen, ptBlue...

Code:
  1. procedure EmptyFunc(Sender : TglBitmap; const Position, Size: TglBitmapPixelPosition;
  2.   const Source, Dest: TglBitmapPixelData; const Data: Pointer);
  3. begin
  4.     Dest.ptRed^   := 255;
  5.     Dest.ptGreen^ := 255;
  6.     Dest.ptBlue^  := 255;
  7. end;
  8.  

Incompatible types and not enough actual parameters at 3883 and again at 3929...

Code:
  1. FTexture.LoadFromFunc(x, y, EmptyFunc, False);
  2.  

So the errors refer to the EmptyFunc procedure. If I comment it out and replace it with the EmptyFunc you have commented out above, I get different errors; I didn't look into them, sorry. Something else to do with my setup?

Is that screenshot you included in the previous post from the .exe that I posted on my website and you downloaded to run on your machine, i.e. is it working perfectly on your machine but not on mine?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 33 Beiträge ]  Gehe zu Seite 1, 2, 3  Nächste
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: Bing [Bot] und 1 Gast


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.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.010s | 17 Queries | GZIP : On ]