Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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] 3 4 5
  ignore  |  Print  
  kev 3ds loaders setBounds  (Read 14222 times)
0 Members and 1 Guest are viewing this topic.
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #30 - Posted 2004-02-13 14:24:46 »

I've just tried it against the latest stuff pulled out of CVS, seems to work fine..

Are you perchance using the xith3d.jar out of CVS which appears to be completely out of date?

Kev

Offline aNt

Senior Duke




AFK


« Reply #31 - Posted 2004-02-13 14:50:36 »

gurrrr- indeed i am- would have thought it would be the the jar with the build (dont no why) Smiley.

bugger- ok me build the new cvs version and give it a wing.
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #32 - Posted 2004-02-13 15:24:47 »

Well, hopefully this will make JCD happy.. the bad news is, I'm not sure the normal calcualtion is right anymore.. however, I'm told the C++ version takes about 2 seconds to load the angel model, now the java version takes about 0.2 seconds on my laptop to load the model. Wahay! Smiley

New version of the xith-3ds.jar is on the website, hopefully the normal generation is still correct.. let me know if people start seeing oddities..

Now, my ipod is calling me... "come play with me..."

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Java Cool Dude

Senior Duke




Java forever


« Reply #33 - Posted 2004-02-13 17:03:01 »

Damn man just when I created the JCD format that basically converts a 3Ds model into an idexed vertex, normal, texcoord3f, tangent, binormal indices form....
The angel model took a little less than 1 sec to load in my format.
Lemmie check your new loader...
Offline Java Cool Dude

Senior Duke




Java forever


« Reply #34 - Posted 2004-02-13 17:21:05 »

Dude the speed issue is completely solved, two thumbs up Smiley
The normals on the other hand....hmmm I think they might be screwed up a bit, let me dig into that a little more
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #35 - Posted 2004-02-13 17:23:29 »

Cheers, I couldn't quite decide if they were right or not.. hard to tell with visual inspection.. let me know what you find out..

Cheers for spending time on this,

Kev

Offline Java Cool Dude

Senior Duke




Java forever


« Reply #36 - Posted 2004-02-13 18:59:01 »

Check out how fast the JCD is loaded
Reading file angel took 0.078 S  Shocked
Simple question before I go and check your code again: Are you using NIO buffers by any chance?
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #37 - Posted 2004-02-13 19:12:18 »

Nope, no NIO for me.. didn't even get round to buffering it actually, didn't realise performance was that critical to you.. probably best you stick to your own format if you need that much performance..

Kev

Offline Java Cool Dude

Senior Duke




Java forever


« Reply #38 - Posted 2004-02-13 19:28:05 »

No no man maybe I should have expressed myself a bit better;
What I'm trying to say here is using NIO buffers will seriously speed up your loader.
As a matter of fact, your 3DS loader is a critical part in creating a model with my format specifications.
A better thing would be explaining how I create the JCD format:
First of all I load a 3DS model using your loader, which is a magnificent piece of code.
Second I retrieve the IndexedGeometry as well as the normals, textureCoordinates, indices and the number of unique vertices.
After that, I generate the TBN matricies which require over 5 normalizations per vertex, and yet is done at a litte over 0.01 s for a > 5000 vertex model.
Finally I save the newly created model using the following function:
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  
  public static void saveJCDModel(Tuple3f[] ve  , Tuple3f[] no,
                                  Tuple3f[] ta  , Tuple3f[] bi,
                                  Tuple3f[] te  , int[]     indices ,
                                  int validVertexCount, String    name){
    ByteBuffer modelInfo = ByteBuffer.allocateDirect(ve.length*60       +
                                                     indices.length *4  + 8);

    modelInfo.putInt(indices.length).putInt(validVertexCount);

    for(int i = 0; i < validVertexCount; i++){
      modelInfo.putFloat(ve[i].x).putFloat(ve[i].y).putFloat(ve[i].z);
      modelInfo.putFloat(no[i].x).putFloat(no[i].y).putFloat(no[i].z);
      modelInfo.putFloat(ta[i].x).putFloat(ta[i].y).putFloat(ta[i].z);
      modelInfo.putFloat(bi[i].x).putFloat(bi[i].y).putFloat(bi[i].z);
      modelInfo.putFloat(te[i].x).putFloat(te[i].y).putFloat(te[i].z);
    }

    int size = indices.length/3;

    for(int i = 0; i < size; i++)
      modelInfo.putInt(indices[i*3 + 0]).
                putInt(indices[i*3 + 1]).
                putInt(indices[i*3 + 2]);
      modelInfo.flip();

    try{
      new FileOutputStream(name + "JCD.jcd").getChannel().write(modelInfo);
    }
    catch(Exception e){}
  }

All those steps take a little over 1 s with the new version of your loader.
Now if you were to load your meshes with an NIO buffer, the speed of all the mentioned operations will definitely fall below 1 s, I'm positive.

PS: Here's how I load my format, it might help you out tweaking your loader
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  
  public static GeometryArray readJCDModel(String name){

    FileInputStream fileStream     = null;
    ByteBuffer      modelInfo      = null;
    byte            fileContents[] = null;

    try{
      fileStream = new FileInputStream(name + "JCD.jcd");
      fileContents = new byte[fileStream.available()];
      fileStream.read(fileContents);
      modelInfo = ByteBuffer.wrap(fileContents);
    }
    catch(Exception e){}

    int[]        indices     = new int       [modelInfo.getInt()];
    Point3f[]    vertices    = new Point3f   [modelInfo.getInt()];
    Vector3f[]   normals     = new Vector3f  [vertices.length  ];
    TexCoord3f[] tangents    = new TexCoord3f[vertices.length  ],
                 binormals   = new TexCoord3f[vertices.length  ],
                 texcoords3f = new TexCoord3f[vertices.length  ];

   for(int i = 0; i< vertices.length; i++){
      vertices   [i]= new Point3f   (modelInfo.getFloat(),
                                     modelInfo.getFloat(),
                                     modelInfo.getFloat());
      normals    [i]= new Vector3f  (modelInfo.getFloat(),
                                     modelInfo.getFloat(),
                                     modelInfo.getFloat());
      tangents   [i]= new TexCoord3f(modelInfo.getFloat(),
                                     modelInfo.getFloat(),
                                     modelInfo.getFloat());
      binormals  [i]= new TexCoord3f(modelInfo.getFloat(),
                                     modelInfo.getFloat(),
                                     modelInfo.getFloat());
      texcoords3f[i]= new TexCoord3f(modelInfo.getFloat(),
                                     modelInfo.getFloat(),
                                     modelInfo.getFloat());
    }
    for(int i = 0; i< indices.length; i++)
      indices[i] = modelInfo.getInt();

    TriangleArray newGeometry = new TriangleArray(indices.length,
                                                  GeometryArray.TEXTURE_COORDINATE_3 |
                                                  GeometryArray.COORDINATES          |
                                                  GeometryArray.NORMALS,
                                                  3,
                                                  new int[]{0,1,2});

    for(int i=0; i<indices.length; i++){
      newGeometry.setNormal           (  i, normals    [indices[i]]);
      newGeometry.setCoordinate       (  i, vertices   [indices[i]]);
      newGeometry.setTextureCoordinate(0,i, texcoords3f[indices[i]]);
      newGeometry.setTextureCoordinate(1,i, tangents   [indices[i]]);
      newGeometry.setTextureCoordinate(2,i, binormals  [indices[i]]);
    }
    return newGeometry;
  }


PS2: I convert IndexedGeometry into non-Indexed because of a bug in the shadow generation. I will try to look into that and maybe fix it.
Thanks again for the help ^_^
Offline aNt

Senior Duke




AFK


« Reply #39 - Posted 2004-02-13 21:14:01 »

happy happy fellas Smiley all it tops. it works here- seems the shadows are atad buggered mind Sad.

nice speedy here by the way- but more is always good no? if the shadows are abit strange is that to do with normals?

i going to do some model tests to see the best way to make a model for the loader. mine seem not to work. maybe i need to group um.. will keep u posted Smiley- top work the both of u. its has become a tip top loader!

normals anyone Wink shadows?

hehhehe- *push push*.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Java Cool Dude

Senior Duke




Java forever


« Reply #40 - Posted 2004-02-13 21:17:52 »

If you're using IndexedGeometry well then the shadows are f*cked.
I'm looking into it though
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #41 - Posted 2004-02-14 05:15:42 »

I've reported in the past that shadows don't work on normal geometry in certain cases. I think its to do with the way the shadow algorithm works, at least in one shadow volume algo each vertex can only be part of up to 2 faces at a time (at least I think thats right). So, its easily possible to build geometry geometry that breaks shadows.. I've built a box room in the past that doesn't work properly.

However, the loader probably could try and do some stuff to rationalise the geometry to work with shadows, but it does seem kinda out of the scope of loader. Should probably happen somewhere in Xith.

I might get a chance to look at adding NIO today.

Kev

Offline Java Cool Dude

Senior Duke




Java forever


« Reply #42 - Posted 2004-02-14 05:57:40 »

Could you very please check the normals generation again? I get this very strong feeling that they're partially screwed

Look at how the specular lighting on the Jewls is facing away from the light.
I'm positive my TBN generation algorithm that produces the perpixel lighting effect is perfect.
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #43 - Posted 2004-02-14 06:01:33 »

Sure, I can try.. could you send me that model to help with testing? I take it the gems are meant to be outset not inset like they appear now?

EDIT: Have you tried lighting it without per-pixel lighting btw?

Kev

Offline Java Cool Dude

Senior Duke




Java forever


« Reply #44 - Posted 2004-02-14 06:02:58 »

true dat Smiley
Check your email
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #45 - Posted 2004-02-14 06:35:47 »

New version uploaded, with the normals inverted. Might just have been that simple. However, I didn't get the colours/textures for the chalice so I can test it here.

Kev

Offline aNt

Senior Duke




AFK


« Reply #46 - Posted 2004-02-14 11:58:36 »

heres a set of transparent objects.

http://www.topresultmate.com/xith3d/model_set.zip

now the ones with _max are exported out of 3dsmax direct. the _tri means i get the mesh to triangles. the _pt is exported using Polytrans.

can u give a try.. dont seem to work here. the cube is 50% transparent. - check the bounds?

- using 3dsMax5
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #47 - Posted 2004-02-14 14:21:06 »

Okie dokie, up goes another version..

Now the transparency seems to work (but Xith doesn't seem to want to work with lighting and transparency at the same time). Note, with the cube model you created you'll get some oddity with transparency since the loader will create the whole cube as one shape which means the sides won't get sorted..

The bounds thing should work also, at least I think so Wink

Kev

Offline aNt

Senior Duke




AFK


« Reply #48 - Posted 2004-02-14 15:11:58 »

top top top result Smiley nice one dude... works cool....

any tips on how the loader would like the cube? i can split it up into separate sides, if that would help?

and i take it shadows are another xith area..
all seems to be working tip top. thats for your time dude.. jcd and kev rock Smiley
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #49 - Posted 2004-02-14 15:18:25 »

Seperating it out into seperate sides should do the trick.

Shadows, yes.. another whole bizarre ball park.

Kev

Offline Java Cool Dude

Senior Duke




Java forever


« Reply #50 - Posted 2004-02-14 17:28:09 »

I f**** sorry kev for giving you the impression that your normals were reverse whereas it was my f***** TBN generator that was screwing the binormals, and hence the glitch in the above screenshot.
I reversed my binormals and everything went just fine.
Sorry again :sad kitten:
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #51 - Posted 2004-02-14 17:31:38 »

Na, don't worry, these things happen and everything.. I'll flip um back in the code.. everything will be groovy..

Kev

Offline Java Cool Dude

Senior Duke




Java forever


« Reply #52 - Posted 2004-02-14 20:22:03 »

Ok now can we have the obj loader returing an indexed shape3D Tongue
Offline Java Cool Dude

Senior Duke




Java forever


« Reply #53 - Posted 2004-02-14 21:32:11 »

Actually it wasn't my TBNGenerator that was screwing things around, but the sobel filter that I apply to the heightmap to generate normal maps necessary for the perpixel lighting effects.
I put together what I shall call the JCD utilities Grin which serve to convert/save/load files in jcd format (vertex, normal, tangent, binormal, texcoord3f), and also to generate TBN matricies efficently
JCD3DSFactory
Normal map generator
TBNGenerator
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #54 - Posted 2004-02-15 04:35:58 »

Quote

Ok now can we have the obj loader returing an indexed shape3D  


Arggggh! Soon(ish). Unfortunately I'm in work this morning, so it might be a few days.

Kev

Offline aNt

Senior Duke




AFK


« Reply #55 - Posted 2004-02-15 10:55:08 »

simple example jcd? Smiley
Offline Java Cool Dude

Senior Duke




Java forever


« Reply #56 - Posted 2004-02-15 20:10:42 »

Quote
simple example jcd? Smiley

PerPixel Lighting (with primitive distance attenuation  :-/ ):


Keys: space to stop the light, T to cycle through the textures, L for lightmap, N for normal map, B for base map, D for default, A for distance attenuation, V for TBN components display.
Mouse: left for rotations.
Source
Offline aNt

Senior Duke




AFK


« Reply #57 - Posted 2004-02-16 15:12:15 »

shadow volumes on my objects seem to be having alot of hassles it must be said.. but we think its more of an xith problem?
Offline Bombadil

Senior Duke





« Reply #58 - Posted 2004-02-17 08:22:27 »

I got some 3d models which have been converted from .lwo and .md3 format to .3ds with DeepExploration. Now I try to load them with Kev's importer. Some models work fine. Some others fail however.

It's been necessary to disable the option "save hiarchical info" in DeepExplorer's export dialog or I see "Null Pointer exception" at the 3ds Java loader. :-)

Does anybody know more about the quality of DeepExploration's 3ds exports when it comes to importing the converted models to Xith3d with Kevs loader?
Does anybody got experiences with complexer 3ds models and the importer in general?
Offline aNt

Senior Duke




AFK


« Reply #59 - Posted 2004-02-17 09:29:48 »

well im using polytrans - seems to not come out to good with the shadows mind. same problem with exporting max anyways.
Pages: 1 [2] 3 4 5
  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.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (42 views)
2014-10-16 15:22:06

Norakomi (32 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (59 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!