Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Milkshape loader for JOGL  (Read 8761 times)
0 Members and 1 Guest are viewing this topic.
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Posted 2003-06-20 00:51:11 »

To the author/porter of the milkshape loader for JOGL, can you put up a link for it here? It seems that the old forums ate the code. I'm getting the joy of copying files around machines in order to use it. Sad

Java Game Console Project
Last Journal Entry: 12/17/04
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #1 - Posted 2003-06-20 08:50:55 »

No Problemo.
miklabs.com/wip/nehe31.zip

I have done a Linux test  of it and texture doesn't show.
I need more feedback for my port  on Linux...

Im working on a base code for other port and demos. So stay tuned.
I have in my folder a old code to compare speed between J3D and GL4Java, which display Quake3 map. Maybe I will work on that too.

But I don't have a lot time my Middleware project MEE, take me a lot of time:
- J2ME support for MIDP1 and MIDP2, Nokia, Moto and Siemens API using an interface wrapping.
- J2SE in the same way
- 2D multiscrolling, Isometric, Raycast.
- XML project description

And MM3D a full 3D for J2ME/J2SE thar I completly rewrite to be compatible with JOGL, and JSR184. Grin

Mik
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #2 - Posted 2003-06-20 09:10:34 »

Never understood how one can write a loader for a rendering API without having an engine!?
How does that work?


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #3 - Posted 2003-06-20 09:18:26 »

I don't understand what you want to say?

But a engine is only some extensions for an API.

To write a 3D loader you need some base classes, like Vector3f, Triangle, Matrix, Joints, ,... to describe infos in the file. This classes are a small engine in fact, specific or not to this loader. Wink
Offline kevglass

JGO Kernel


Medals: 85
Projects: 25


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2003-06-20 09:38:20 »

I guess what Herk is getting at (I was wondering the same thing myself), how you can deal with things like transparency sorting, if you don't know how the person writing scene tree for engine has dealt with them..

How can you write a generic loader, without a generic "engine/culling method/transparency sorter" in place for you to load the model into?

I mean otherwise, you're not really providing a loader, more of pointer in the right direction..

Kev

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #5 - Posted 2003-06-20 11:00:52 »

Yes. Of course you can create an object with a render()-method that displays a single object.

But this is not usefull at all.

You need a framework for material sorting, transparency sorting, texture management, object culling, animation trigger, ...... just to mention basic rendering needs.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline kevglass

JGO Kernel


Medals: 85
Projects: 25


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #6 - Posted 2003-06-20 11:16:21 »

Hey!, do you mean like, um.. Java 3D has?

Kev

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #7 - Posted 2003-06-20 11:21:27 »

Grin

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #8 - Posted 2003-06-20 11:51:07 »

To display a simple cube you don't  need so much stuff  Grin
Transparency and culling are not usefull for only drawing a simple model like Milkshape format.

The framework don't need to be very complex. See my nehe31 port.
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #9 - Posted 2003-06-20 11:53:20 »

Do you use a caterpillar to kill a ant?  Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

JGO Kernel


Medals: 85
Projects: 25


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #10 - Posted 2003-06-20 12:32:35 »

I think you missed the point. The framework doesn't have to complex, but it does need to be common between users...

So, we'd all have to pick up your system and use it across the board..

Not to mention, mostly, when you load of model you want to put it in a world of some sort?

Kev

Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #11 - Posted 2003-06-20 12:49:48 »

Ok I see what you want, a common framework. Not a new engine, but something standardized.

Not reinventing the wheel every time is a good thing. It is what I try to do in my current professionnal project MEE, by completly rewriting the 3D engine to be complaint with standard, like JOGL and JSR184 (JavaMobile3D)

If you want I will completly rewrite the nehe31 and the JOGL framework to a more java3D way... like using vecmaths, and other java3D paradigms. In fact I have already done that with my Quake3 map viewer, a cross over between Java3D and GL4Java.

No Problemo

Mik
Offline kevglass

JGO Kernel


Medals: 85
Projects: 25


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #12 - Posted 2003-06-20 13:09:43 »

No, I really don't want you to anything Wink

But that still wouldn't solve it, the point Herk was making was that to actually get proper reuse out of your loader you also have to buy into _your_ implementation of the scene tree (as its _not_ part of the platform - JOGL)

I don't think anyone is saying its complex to write an engine/scenetree to working in JOGL, just that without it being part of the platform, you can't really write a loader in an generic way.

Kev

Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #13 - Posted 2003-06-20 14:25:25 »

Maybe I'm just daft here, but looking at the Nehe code I see no sign of sorting routines. I THINK this is because GL is figuring out the mesh for us. All we do is draw a triangle mesh and GL says "Ok, these triangles are visible, these aren't *bam*, done." Come to think of it, it's probably because GL doesn't draw backfaces. Don't know what would happen with models with multiple meshes tho. In any case, it doesn't matter. Once you have the meshes loaded, you can perform whatever type of sorting, ordering, HSR, lighting, etc. you want on them. Nothing is tying you to an existing engine.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #14 - Posted 2003-06-20 14:32:27 »

Quote
I THINK this is because GL is figuring out the mesh for us. All we do is draw a triangle mesh and GL says "Ok, these triangles are visible, these aren't *bam*, done." Come to think of it, it's probably because GL doesn't draw backfaces.


Half right - GL will, with proper depth buffer and other settings, remove hidden faces and pixels. It will not however automajically sort transparent polys and other view-dependant effects.

There is a good work-around though - Milkshape allows multiple materials per-mesh, so assuming that the mesh is defined to certain standards/conventions then the transparent and opaque sections could be rendered separatly, thus the app is free to determine its own sorting etc., and call the appropriate rendering methods when appropriate.

Realistically though, this isn't the difficult bit. The real difficulty is the loading and skelatanal animation routines, which are independant of the rendering order/organisation.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #15 - Posted 2003-06-20 14:46:21 »

That's right OpenGL.

For culling:
gl.glCullFace(mode); // where mode could be GL_BACK, GL_FRONT or GL_FRONT_AND_BACK
and etc.

For transparency some methods exists using extensions:
http://developer.nvidia.com/view.asp?IO=Interactive_Order_Transparency

Or as Orangy, by separate opaque and transparent faces

For the skeletal animation, J3D doesn't do that too...
Offline kevglass

JGO Kernel


Medals: 85
Projects: 25


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #16 - Posted 2003-06-20 14:52:51 »

I think we were getting at group culling as opposed to face culling really.

Yes, you could use extensions, but then you're loader has to make that assumption.

As to splitting out transparencies into seperate models, well yes, this does it make it easier, but it hardly solves the problem. You still need to sort the transparent faces within that model while integrating them into whatever transparent faces exist in the scene? Or don't you?

Kev

Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #17 - Posted 2003-06-20 15:16:03 »

Quote
I think we were getting at group culling as opposed to face culling really.


Group culling or per-object culling is entirly independant, although it would be nice to build a set of standard geometry intersection routines that could be used everywhere.

Quote
As to splitting out transparencies into seperate models, well yes, this does it make it easier, but it hardly solves the problem. You still need to sort the transparent faces within that model while integrating them into whatever transparent faces exist in the scene? Or don't you?


Depends Smiley Most games don't bother with sorting within a mesh, as a pixel perfect solution involves much work, splitting and rebuilding polys in a view dependant manner - the idea solution involves building a bsp tree every frame with the transparent polys to properly split and sort them. Obviously this is pretty costly so games tends to come up with hacks (certain blending modes are order-independant) or more complex geometry independant methods (google depth peeling for a start, but involves lots of passes and plenty of spare texture memory).

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline shawnkendall

Senior Member





« Reply #18 - Posted 2003-06-20 15:18:08 »

Hey admin ;-)
I think this thread should be moved to the JOGL group.

I totally missed in earlier...
Anyone else agree/disagree?

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #19 - Posted 2003-06-20 15:20:49 »

Yes that's right.
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #20 - Posted 2003-06-21 03:10:26 »

Quote
I have done a Linux test  of it and texture doesn't show.
I need more feedback for my port  on Linux...


I'm in front of my Solaris box right now and I think I've figured out why the textures don't show up under Linux (or any Unix for that matter). You see, the texture name is hardcoded in the data file as "data/Wood.TGA". The only problem is that when you unzip the file it comes out "data/Wood.tga". Note the caps in TGA. Under Windows, it doesn't care about the case of a file, but under Unix, case makes a big difference.

I changed "data/Wood.tga" to "data/Wood.TGA" and it worked fine on my Solaris box. You'll have to try on your Linux box and let me know if it works.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #21 - Posted 2003-06-21 09:31:47 »

Duh, I fill stupid    Embarrassed

A new version is upload it checks for uppercase and lowercase, and see if the file exist.

Thx

Mik
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #22 - Posted 2003-07-01 17:24:25 »

mik,

While I am using LWJGL and Chman's port of Brett Porter's code, it seems there are a lot of simularities between the two. I'm currently trying to get the animation working but am having trouble reading in the joint information. Have you had any luck?

Thanks

Don't send a man to do a monkey's work.
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #23 - Posted 2003-07-01 17:33:58 »

Not finished yet... Not enough time, this WeekEnd I will work on it.

Mik
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #24 - Posted 2003-07-01 18:31:35 »

Great, I'm going to continue working on it as well. So we can compare notes if you'd like. I basically, have a bunch of code working, that is, unfortunately, returning bad results. For instance, my number of keyframes is in the tens of thousands as are my joints. Seem to reading the wrong bytes somewhere.

Don't send a man to do a monkey's work.
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #25 - Posted 2003-07-01 19:16:24 »

Have you read the spec file contained in the SDK? That should help you solve any issues you're having.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #26 - Posted 2003-07-01 19:38:08 »

Yeah, I'm looking at both the spec and rsn.gamedev.net. I *think* I'm reading in the correct order, but apparently not.

Don't send a man to do a monkey's work.
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #27 - Posted 2003-07-01 19:50:16 »

have you a link where I could see and test your code?
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #28 - Posted 2003-07-01 20:13:33 »

Well, I don't have it posted anywhere at the moment. I can post the part of the method where the loading is occurring here though. If you need any more than this, I'll have to e-mail it to you or something. This code chunk occurs with in the data loader at the end.


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
'
   
   float animFPS = Conversion.byte2float(byteBuffer, dataPointer);
   dataPointer += 8;
   
   int totalFrames = Conversion.byte2int(byteBuffer, dataPointer);
   dataPointer +=4;
   
   totalTime = totalFrames * 1000.0f/animFPS;
   
   numJoints = Conversion.byte2short(byteBuffer, dataPointer);
   dataPointer += 2;
   
   joints = new Joint[numJoints];
   
   int tempPointer = dataPointer;
   
   JointNameListRec[] nameList = new JointNameListRec[numJoints];
   for(int i = 0; i < numJoints; i++) {
  MS3DJoint joint = new MS3DJoint(byteBuffer, tempPointer);
  tempPointer += joint.sizeof();
  tempPointer += 16 * (joint.numRotationKeyframes +  
     joint.numTranslationKeyframes);
  nameList[i] = new JointNameListRec();
  nameList[i].jointIndex = i;
  nameList[i].name = Conversion.byte2String(joint.name);
   }
   
   for(int i = 0; i < numJoints; i++) {
  MS3DJoint joint = new MS3DJoint(byteBuffer, dataPointer);
  dataPointer += joint.sizeof();
   
  int j, parentIndex = -1;
  if(joint.parentName.length > 0) {
      for(j = 0; j < numJoints; j++) {
     if(nameList[j].name.equalsIgnoreCase(new String(joint.parentName))) {
    parentIndex = nameList[j].jointIndex;
    break;
     }
      }
       
      if(parentIndex == -1) {
     //no parent joint.
      }
  }
   
  joints[i] = new Joint();
  joints[i].localRotation = joint.rotation;
  joints[i].localTranslation = joint.translation;
  joints[i].parent = parentIndex;
  joints[i].numRotationKeyframes = joint.numRotationKeyframes;
  joints[i].numTranslationKeyframes = joint.numTranslationKeyframes;
  joints[i].translationKeyframes = new Keyframe[joint.numTranslationKeyframes];
   
  for(j = 0; j < joint.numRotationKeyframes; j++) {
      MS3DKeyframe keyframe = new MS3DKeyframe(byteBuffer, dataPointer);
      dataPointer += keyframe.sizeof();
      setJointKeyframe(i,j,keyframe.time*1000.0f,keyframe.parameter,true);
  }
   
  for(j = 0; j < joint.numRotationKeyframes; j++) {
      MS3DKeyframe keyframe = new MS3DKeyframe(byteBuffer, dataPointer);
      dataPointer += keyframe.sizeof();
      setJointKeyframe(i,j,keyframe.time*1000.0f,keyframe.parameter,false);
  }
   }
   
   setupJoints();
   
 }


All values, totalFrames, numJoints etc are very high, ie 30,000.

Let me know if there is any thing else you'd like to see.

Don't send a man to do a monkey's work.
Offline mik

Senior Newbie




Java games rock everywhere!


« Reply #29 - Posted 2003-07-01 20:21:11 »

A float is only 4 bytes long  Wink :
dataPointer += 4; // second line  
Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (62 views)
2014-04-15 18:08:23

BurntPizza (60 views)
2014-04-15 03:46:01

UprightPath (73 views)
2014-04-14 17:39:50

UprightPath (56 views)
2014-04-14 17:35:47

Porlus (73 views)
2014-04-14 15:48:38

tom_mai78101 (99 views)
2014-04-10 04:04:31

BurntPizza (159 views)
2014-04-08 23:06:04

tom_mai78101 (254 views)
2014-04-05 13:34:39

trollwarrior1 (208 views)
2014-04-04 12:06:45

CJLetsGame (215 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!