Hi,
It looks like vertex colors are silently ignored in the ASE loader. The scene looks flat and without shadows. All textures are way too bright.
Is there another format that support that?
Hi,
It looks like vertex colors are silently ignored in the ASE loader. The scene looks flat and without shadows. All textures are way too bright.
Is there another format that support that?
ASE doesn’t contain Materials. You’ll have to do something like that after loading the model:
BranchGroup g = AseFile.load("your model");
setMaterial(g);
/** sets the Material of the given Shape */
private void setMaterial(Shape3D s) {
Material m = new Material(true);
m.setAmbientColor(0.2f,0.2f,0.2f);
m.setDiffuseColor(1,1,1);
m.setSpecularColor(0.4f,0.4f,0.4f);
if(s.getAppearance().getTextureUnitCount() == 0) m.setColorTarget(m.AMBIENT_AND_DIFFUSE);
else m.setColorTarget(m.NONE);
s.getAppearance().setMaterial(m);
}
/** This Function performs a DFS through all the Nodes contained in g */
private void setMaterial(Group g) {
for(int i = 0; i < g.numChildren(); i++) {
Node n = g.getChild(i);
if(n instanceof Group) {
setMaterial((Group) n);
}
else if(n instanceof Shape3D) {
setMaterial((Shape3D) n);
}
}
}
[quote]All textures are way too bright.
[/quote]
Maybe you have too many lights in your Xith3D scene, or they are very bright, or maybe you have none at all? Or maybe your textures are just bright to begin with 
Will.
The textures are bright initially, but that’s why I added vertex colors to the scene in 3DS Max.
I added a pole and a bright globe to the scene but everything with enhanced lightning is invisible.
Is there a format 3DS Max can export which is better supported?
There’s also a 3DS loader.
Will.
The 3DS loader indeed is better as it does not suppress the globe and the pole. The pixel coloring is not there.
What I use now is XithLoader3DS.jar i.e. com/kinostudios/loader3ds/Loader3DS dated in Dec. 2004.
Is that the one you would recommend?
And btw. maybe someone ran into this problem before and can give me a hint on what I’m doing wrong here.
I added a spotlight to the scene and since then I get the following error:
javax.vecmath.SingularMatrixException: cannot invert matrix
at javax.vecmath.Matrix4f.invertGeneral(Matrix4f.java:1735)
at javax.vecmath.Matrix4f.invert(Matrix4f.java:1689)
at com.xith3d.scenegraph.Transform3D.lookAt(Transform3D.java:589)
at com.kinostudios.loader3ds.chunks.SpotLightChunk.loadData(Unknown Source)
at com.kinostudios.loader3ds.ChunkChopper.loadSubChunks(Unknown Source)
at com.kinostudios.loader3ds.ChunkChopper.loadSubChunks(Unknown Source)
at com.kinostudios.loader3ds.ChunkChopper.loadSubChunks(Unknown Source)
at com.kinostudios.loader3ds.ChunkChopper.loadSubChunks(Unknown Source)
at com.kinostudios.loader3ds.ChunkChopper.loadSceneBase(Unknown Source)
at com.kinostudios.loader3ds.Loader3DS.parseChunks(Unknown Source)
at com.kinostudios.loader3ds.Loader3DS.load(Unknown Source)
The view.getTransform.lookAt() is called before the load().
Sorry I didn’t answer you question. Have you solved your problem?
I always advise people to use code from the toolkit project (the ones prefixed with org.xith3d, located in the xith-tk.jar file in your Xith3D distribution), as these are generally better supported. That said, if the code you are using works - go for it!
Will.