Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (117)
games submitted by our members
Games in WIP (564)
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 13891 times)
0 Members and 1 Guest are viewing this topic.
Offline aNt

Senior Member




AFK


« Reply #90 - Posted 2004-02-20 08:16:04 »

kev as a side note.. what about adding lights? just point and mybe amb lights? with animation Smiley that would rock ....
Offline kevglass

JGO Kernel


Medals: 165
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #91 - Posted 2004-02-20 08:30:33 »

Quote

i take it this problem could also be messing with the shadow casting that now seem not to work?


Unlikely, the normals problem only occurs with smoothed groups, shadow casting can go wrong with any geometry (infact even hand coded geometry)

Quote

kev as a side note.. what about adding lights? just point and mybe amb lights? with animation  that would rock ....


Added to "the list". Feel free to hack the source Smiley

Kev

Offline aNt

Senior Member




AFK


« Reply #92 - Posted 2004-02-20 09:46:16 »

ok i got it looking nice again- i move over the maya and it seems to be coming out ok. i do get a little twinkly outline around the edge of the model mind u.. but im putting this down to me seeing things for now Smiley.

so everything seems to be of. smoothing can be done in maya so i dont need it later. im not saying a normal generator is not a needed- i think it is..

but so far so good...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Bombadil

Senior Member





« Reply #93 - Posted 2004-02-20 10:03:37 »

Quote
so everything seems to be of. smoothing can be done in maya so i dont need it later. im not saying a normal generator is not a needed- i think it is..

So you tell Maya to export the generated normals, then you load the Maya export with PolyTrans and export it as .3ds file? And Kev's loader is "normal vector" aware?

(William once mentioned he tells 3d Studio to export normals for the ".ase" format and David & his ase-loader loads these normals then.)

Still, we need a generic NormalGenerator. :-)
Offline aNt

Senior Member




AFK


« Reply #94 - Posted 2004-02-20 10:20:33 »

well; make yer model in Maya- then before exporting (realy importent) delete the Mayas model history- i then use the PloyTrans-for-Maya plugin to save as 3ds.

kev i take me hat off to u for the cool transparence action! looks brilleant dude... [lights- oh go on, go on, go on, go on].

i have tryed prittly much everything in Max to get it to work- with no joy.. i understand its abit mad having to use Maya and Polytrans to export a Max 3ds models.. but hay- when where things simple.. maybe theres a way of deleteing Max's model history i dont no about?

oh kev- the model.nextframe(); will that loop the animation when it gets to the end?
Offline Bombadil

Senior Member





« Reply #95 - Posted 2004-02-20 11:34:15 »

Quote
well; make yer model in Maya- then before exporting (realy importent) delete the Mayas model history- i then use the PloyTrans-for-Maya plugin to save as 3ds.

OK thanks. Well, no Maya here, no 3d Studio, just a DeepExploration converter tool, which unfortunately doesn't export the normals to the .3ds file (or I don't know how to). If necessary, it generates them on the fly to display the model correctly, but the normals aren't in the exported 3ds or at least not being loaded with Xith.

Quote
kev i take me hat off to u for the cool transparence action! looks brilleant dude...

Yes, transparency on the material/surface works fine now and looks so cool.

Problem 1) However I can't get it to work with RGBA texture files (PNG). Kevin said it's in the code and he sees my Tube.3ds transparent, but it doesn't work for me. Would you (Ant, or Kev, or ..) like to test my bundled  Zip archive? Unpack and start the Testle.jar please. The xith.jar contains my used Xith3d/Jogl/3ds_loader version. You can move it and use your own Xith/Jogl/Loader version to see if that makes a difference.
I load the model via the InputStream constructor of Kev's loader. It shouldn't make any difference but who knows... :-)

Problem 2) I still see the loaded models' polygons being double faced. Kevins said the code removes the double surface but it doesn't work here. Could you (Ant, Kev, ..) please try to load the Tube.3ds model and move the camera inside the model to see if its polygons are single sided?

Quote
[lights- oh go on, go on, go on, go on].

With lights you mean they should be loaded from the model?
If so, should be optionally though, because usually we load many models and set an own light or such. :-)

Many thanks!
Offline aNt

Senior Member




AFK


« Reply #96 - Posted 2004-02-20 11:59:13 »

nop just solid here dude.. not transparency on the texture Tube dude.

- lights: well its way simple to remove the globle lights from your model if u dont want any lights to be exported. just i think it would be top if u could have animating lighting working in xith just from making them in max, maya whatever Smiley.

and with the new loader on kevs site i get:
java.lang.ArrayIndexOutOfBoundsException: 64 file: model/character.3ds
Offline kevglass

JGO Kernel


Medals: 165
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #97 - Posted 2004-02-20 12:13:58 »

Wierd, I run with your xith.jar only and get:

Click to Play


Which looks transparent? Not quite sure whats going on here..

All materials are set to having CULL_BACK unless specified in the file as 2 sided.

Kev

Offline Bombadil

Senior Member





« Reply #98 - Posted 2004-02-20 12:45:39 »

That's a bit crazy: Ant and me don't see the transparency of the Tube, Kev does see it - with the very same application and xith/jogl/loader JAR ?

How can this be?

OpenGL problems? ;)
Offline aNt

Senior Member




AFK


« Reply #99 - Posted 2004-02-20 12:47:56 »

humm strange. r u working with the newset cvs build kev. u seem to have a grey background- should be black
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

JGO Kernel


Medals: 165
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #100 - Posted 2004-02-20 13:30:40 »

Seems to be the latest xith, 805,000 in size (well, just over). I thought default background colour was still grey, just you can now set a background colour using background node?

Kev

Offline Bombadil

Senior Member





« Reply #101 - Posted 2004-02-20 14:47:34 »

We found the problem causing the loss of RGBA files transparency and the double sided problem (*).

Kev's just uploaded a new version of the loader which works fine here, now... :-)

Thanks! :-)



(*) It's been because Kev has got a "." in his classpath, whereas many others, including Ant and me, don't...
Offline aNt

Senior Member




AFK


« Reply #102 - Posted 2004-02-20 16:49:41 »

oops- my code is setting it to black.. sorry.  Grin
old stuff in there that didnt work- all of a sudden now works.. lol

scrub that animation works cool- seem to flash on the loop frame here - but im sure i will find thats something im doing...

oh a note of transparent textures. should the transparent part be a different image as a mask? not an image with an aplha? same with bump mapping. this give more power for changing the textures and mixing bumps with other maps. would be better then the way we have it at present.

faces: kev are these still front and back faceing? if so it seems if you render both sides of the face- the inner facing face is white (being 3ds seems to use ambient color as its main colour). this seems to show when the object gets smaller. so i would say it would be better just the render the front facing polygon.

well heres a 3ds file with 'animation', 'transparent texture layer', 'bump-map texture', 'ambient color' with vector smoothing on the red main case area of this strange shape.

the green ends are just a 'transparent serface' with an 'ambient color; value.

also the red texture has:
 diffuse: 0.736
 specular: maxed.

nothing seems to happen when setting diffuse and specular. but this could just be me.

file: http://www.topresultmate.com/xith3d/better.zip

looking good..
Offline Bombadil

Senior Member





« Reply #103 - Posted 2004-02-21 12:56:10 »

Quote
oh a note of transparent textures. should the transparent part be a different image as a mask? not an image with an aplha? same with bump mapping. this give more power for changing the textures and mixing bumps with other maps. would be better then the way we have it at present.

Many artists prefer to have a RGB texture file (24 bpp) plus an Alpha mask file (8 bpp) instead of one RGBA (32 bpp) file.
Aside other formats the Lightwave file format does allow this for sure. I am not sure about 3ds however (which is quite old and not developed anymore, because today they user their internal .max format).
So if the 3ds file format doesn't know RGB + A in different files we're at a loss with 3ds for that point; as with Multitextures. :-(

Quote
faces: kev are these still front and back faceing? if so it seems if you render both sides of the face- the inner facing face is white (being 3ds seems to use ambient color as its main colour). this seems to show when the object gets smaller. so i would say it would be better just the render the front facing polygon.

With the newest version the single sided models should be loaded as single sided... With some test models I get correct results now, but there's always strange things out there. ;-)

Quote

This causes the loader to throw a class cast exception here...
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
...
Skipping Chunk: 1201
Frame Count: 200
Skipping Chunk: b009
Translation key frames: 1
        Translation key frame: 0 : (0.0, 0.0, 7.7078085)
Rotation key frames: 1
        Rotation key frame: 0 : (1.0, 0.0, 0.0, -0.0)
Scale key frames: 1
        Scale key frame: 0 : (1.0, 1.0, 1.0)

java.lang.ClassCastException
  at org.newdawn.xith3d.threeds.SclTrackProcessor.processs(SclTrackProcessor.java:86)
  at org.newdawn.xith3d.threeds.TDSLoader.processChunk(TDSLoader.java:1
  at org.newdawn.xith3d.threeds.TDSLoader.load(TDSLoader.java:93)
  ...

Offline Bombadil

Senior Member





« Reply #104 - Posted 2004-02-21 13:50:07 »

I'm having trouble with the 3ds loader when it comes to packing all to one big JAR.

Loading resources in general I handle with InputStreams, so my code works with the resource files being stored in the OS filesystem (next to the classes folder) as well as in a big JAR. Say the routine handling file accesses is: InputStream fetchStream(String filename)  

The file structure at dev time is:
1  
2  
3  
4  
5  
|  JustCode.jar  or  classes directory holding all the .class files
|
+-- Models
 ..... Tube.3ds
 ..... tube.png


Running the code does:
1  
2  
3  
4  
5  
String path = "Models/";
String file = "Tube.3ds";
InputStream bistream = fetchStream(path + file);
TDSLoader dsloader = new TDSLoader();
TDSModel  model    = dsloader.load(path, bistream, true);


This works fine when the resources are in the OS' filesystem. However it fails at loading textures when the code and resources is in one big JAR. The JAR structure is:
1  
2  
3  
4  
5  
6  
+--- myPackageName
| ..... mainclass.class
|
+--- Models
 ..... Tube.3ds
 ..... tube.png


How do you master this?

PS: When I load textures manually with Xith3d I don't use RegisterPath/Jar because I always give an InputStream to Xith3d, no file name strings.
Offline Java Cool Dude

Senior Member




Java forever


« Reply #105 - Posted 2004-02-21 13:52:12 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
import java.awt.image.BufferedImage;
import java.io.*;

public class ImageLoader {

  public static final BufferedImage loadImage(String textureLocation){
    BufferedImage bufferedImage = null;
    ClassLoader  fileLoader  = ImageLoader.class.getClassLoader();
    InputStream  input       = fileLoader.getResourceAsStream(textureLocation);

    try {
      if(input == null)
         input =  new FileInputStream(textureLocation);
      bufferedImage = javax.imageio.ImageIO.read(input);
    }
    catch( Exception e){
      try{
        bufferedImage = javax.imageio.ImageIO.read(new java.io.File(textureLocation));
      }catch( Exception newE){}
    }
    return bufferedImage;
  }
}


This example works in every case out there Smiley
Offline Bombadil

Senior Member





« Reply #106 - Posted 2004-02-21 14:04:19 »

Quote
This example works in every case out there :)

Yes. :-)  My mentioned method "InputStream fetchStream(String filename)" works similar. And it works, but...
The 3ds loader in my above example manages to fetch the "File.3ds" correctly (because I give an InputStream of that file to one of Kev's three loading methods) but then the 3ds loader fails when it calls Xith3d to load that PNG bitmap... :-(

When the files are on the filesystem the loader works, but when I pack all into a JAR my call to the 3ds-loader fails with an texture-loading-exception ("can't find ... blabla").

My calls to Xith3d in one JAR work fine...
Offline aNt

Senior Member




AFK


« Reply #107 - Posted 2004-02-21 17:50:45 »

i get an error also with my models with the new loader. i have no idea why- the old loader worked fine. Sad. humm.. ok will debug with kevs src..Smiley

shame about the 3ds not letting us use different file refs to the different layers on the model.
Offline aNt

Senior Member




AFK


« Reply #108 - Posted 2004-02-22 08:27:15 »

heres the stacktrace on the loading of my model:

java.lang.ClassCastException
     at org.newdawn.xith3d.threeds.SclTrackProcessor.process(SclTrackProcessor.java:86)
     at org.newdawn.xith3d.threeds.TDSLoader.processChunk(TDSLoader.java:126)
     at org.newdawn.xith3d.threeds.TDSLoader.load(TDSLoader.java:93)

hummm Sad - must be my model if yours are working Bombadil. Mind you i do get this error with the character.3ds:

java.lang.ArrayIndexOutOfBoundsException: 64
     at org.newdawn.xith3d.threeds.SmoothGroupProcessor.process(SmoothGroupProcessor.java:57)
     at org.newdawn.xith3d.threeds.TDSLoader.processChunk(T.DSLoader.java:126)
     at org.newdawn.xith3d.threeds.TDSLoader.load(TDSLoader.java:93)

java.lang.ArrayIndexOutOfBoundsException: 64

bling bling. not sure why it all worked in the last loader version. also your Tube model has transparency in the new version dude. and the jeep1 loads ok.

tops


Offline kevglass

JGO Kernel


Medals: 165
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #109 - Posted 2004-02-22 08:54:31 »

Bing! New vesion.

The reason you model only failed was because of animation. Fixed.

The reason the character.3ds model failed was because of all the hacking being done in the smoothing groups stuff.

Kev

Offline aNt

Senior Member




AFK


« Reply #110 - Posted 2004-02-22 13:34:35 »

u the man kev Smiley- works and looks great
Offline Bombadil

Senior Member





« Reply #111 - Posted 2004-02-23 09:33:38 »

*bump* :-)

Quote
I'm having trouble with the 3ds loader when it comes to packing all to one big JAR.


The JAR structure is:
1  
2  
3  
4  
5  
6  
+--- myPackageName
| ..... mainclass.class
|
+--- Models
 ..... Tube.3ds
 ..... tube.png


Would like to pack my classes plus resources into one JAR, like quoted above (so the textures don't stay in the root path of the JAR, but in sub-folders).
How do you master this?

Runing outside one big JAR (but with same sub-folders) works with the following:
1  
2  
3  
4  
5  
String path = "Models/";
String file = "Tube.3ds";
InputStream bistream = fetchStream(path + file);
TDSLoader dsloader = new TDSLoader();
TDSModel  model    = dsloader.load(path, bistream, true);


To clarify (because my English is strange, sorry): I've no problem with loading resources within one big JAR and within the filesystem, but to tell the 3ds-loader where to find the textures which the model will need (you just give the model's path + name to the constructor of the loader)...
Offline Bombadil

Senior Member





« Reply #112 - Posted 2004-02-23 17:16:21 »

Packing your application plus resources inside one big JAR work great as long as you don't put the 3dsLoader (xith-3ds.jar) into your JRE/.../Ext folder (which I did; I've got the Xith.jar in there, so I can use it happily from any project without any path adaption).

Because of this:
org/newdawn/xith3d/threeds/TexMapProcessor.java :
1  
2  
3  
4  
private Texture loadTexture(String filename) {
  URL realURL = TexMapProcessor.class.getClassLoader().getResource(filename);
  ...
}


So when:
* the org/newdawn/... classes tree is part of the application's JAR file (including the resources),
* or the Application.jar's manifest includes the xith-3ds.jar,
* or you call your application via something like: java -cp App.jar;xith-3ds.jar,
everything works fine. Because class.getClassLoader() is relative to the resource's tree then.

How do you guys out there use libs like Xith.jar, xith-3ds.jar, etc, with more than one project at development time in a handy way?
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #113 - Posted 2004-02-23 21:28:04 »

Quote
Packing all inside one big JAR works great as long as you don't put the xith-3ds.jar into your JRE/.../Ext folder (which I did; I've got the Xith.jar in there, so I can use it happily from any project without any path adaption).

Because of this:
org/newdawn/xith3d/threeds/TexMapProcessor.java :
1  
2  
3  
4  
private Texture loadTexture(String filename) {
  URL realURL = TexMapProcessor.class.getClassLoader().getResource(filename);
  ...
}


So when:
* the org/newdawn/... classes tree is part of the Application's JAR file (including the resources),
* or the Application.jar's manifest includes the xith-3ds.jar,
* or you call your App by something like java -cp App.jar;xith-3ds.jar,
everything works. Because class.getClassLoader() is relative to the resource's tree then.

How do you guys out there use libs like Xith.jar, xith-3ds.jar, etc, with more than one project at development time in a handy way?


heed my warning - don't put .jar files which are constantly updated or have anything to do with image loading in your jre/lib/ext!  I used to recommend this for xith3d.jar in the installation tute but due to wasting an hour and nearly going bald I now strongly recommend against it.  It does bad things to JWS and other things as well (and coincidentally the problems were always with image loading).

JOGL/JOAL .jar's are perfectly fine IMHO as they are pretty static (for our needs), as is vecmath, junit, log4j, etc...  Although don't forget that they are there and may need updating occasionally (jogl and joal especially).

So how do I get around the problem?  There are two good ways I know - once is have all the checked out cvs projects in the one directory and reference the libs like so: ../../xith3d/lib/xith3d.jar - or  create a lib directory in your project and symlink the nessesary libs (if you use linux).

Will.

Offline aNt

Senior Member




AFK


« Reply #114 - Posted 2004-02-25 12:52:12 »

sorry to bring this up kev Smiley but scale animation dont seem to work.. heres a model that scales over 100 frames.

http://www.topresultmate.com/xith3d/scale.3ds
Offline Bombadil

Senior Member





« Reply #115 - Posted 2004-02-25 13:44:05 »

Being at models which can cause trouble... :)

I've loaded the Jeep from Kev's archive and grouped all the wheels to the base group (with DeepExploration). When exporting the model it can't be loaded again with the 3dsloader... The following stacktrace is being printed:
Quote

java.lang.NullPointerException
 at org.newdawn.xith3d.threeds.PosTrackProcessor.process(PosTrackProcessor.java:60)
 at org.newdawn.xith3d.threeds.TDSLoader.processChunk(TDSLoader.java:126)
 at org.newdawn.xith3d.threeds.TDSLoader.load(TDSLoader.java:93)
 at myapp.blabla.....

The modified Jeep I've put in this Zip archive.

Well, maybe DeepExploration corrupts something? Or maybe it's really just a small thing at the loader... (I'm not very familiar with that code ;-)
Ant: would you mind loading my modifed Jeep with your 3dStudio/Maya please, to see if it's correct?


PS: Thanks a lot to Kev and Will for the help with the former Jre/.../Ext/  lib jar trouble.
Offline aNt

Senior Member




AFK


« Reply #116 - Posted 2004-02-25 14:15:12 »

make sure u have the new xith3d build- build the src yourself with 'ant' the xith3d.jar form cvs is out of date. build the cvs dude.. the jeep and everything works sweet here...

just scaling on animation dont work Sad so no explotion animations for me as yet.. bish bosh kev- u no u want to make the don loader of um all.. an so far i think it rocks!
Offline kevglass

JGO Kernel


Medals: 165
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


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

Moo! This url don't work...

http://www.topresultmate.com/xith3d/scale.3ds

Kev

Offline Bombadil

Senior Member





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

Quote
make sure u have the new xith3d build- build the src yourself with 'ant' the xith3d.jar form cvs is out of date. build the cvs dude..

Yes I've done so 2-3 days ago: compiled the entire Xith from CVS. :-)

Quote
the jeep and everything works sweet here...

The original Jeep.3ds from Kev's loader archive.zip works, that's right. But what about my modified one (with group hierarchy)? Please find it in this Zip archive.
Does it load at your PCs? I see the above mentioned error message then...
Offline kevglass

JGO Kernel


Medals: 165
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #119 - Posted 2004-02-25 14:28:08 »

Fixed the jeep thing (at least it loads now). Although the wheels and steering column have been moved away from the main body, is that right?

Give me dat scaling 3ds.. come on! Smiley

Kev

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.

Grunnt (20 views)
2014-09-23 14:38:19

radar3301 (14 views)
2014-09-21 23:33:17

BurntPizza (31 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (29 views)
2014-09-20 20:14:06

BurntPizza (33 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (75 views)
2014-09-10 13:57:51

TehJavaDev (107 views)
2014-09-10 06:39:09
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!