Okay, I need a little help already. Here is a clip from an AC3D model file, I am trying to learn what the remaining attributes are and where to set them within jME.
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0
OBJECT world
kids 1707
OBJECT poly
name "rect"
loc 12.375 2 0
texture "data/texture/geffen/gef_field-04.png"
crease 45.000000
numvert 4
-0.125 0 -0.5
0.125 0 -0.5
0.125 0 0.5
-0.125 0 0.5
numsurf 2
SURF 0x0
mat 0
refs 3
3 0.5 0
1 0.75 1
0 0.5 1
SURF 0x0
mat 0
refs 3
1 0.75 1
3 0.5 0
2 0.75 0
kids 0
From the MATERIAL line, I am using the "rgb" values as inputs to the vertex colors when I create the mesh. The remaining attributes, I am not sure what to do with though:
amb - ambient light reflected emis - emited color of this material spec - speculative color of the material shi - shininess trans - translucancy of the material
From the OBJECT defs, I am not what to do with the "crease" attribute. I am also wanting to be able to support single sided and double sided polys (right now, they are all loaded as double sided).
Any tips on what functions I should call to support the above is appreciated.
Are there any code examples floating around on how to do those? I tried to implement the culling, but all my planes still had textures on both sides.
if (!tmpSurface.isTwoSided()) {
CullState cs = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
cs.setCullMode(CullState.CS_BACK);
tmpMesh.setRenderState(cs);
}
I have the TextureState call below this one, which I call 'setRenderState' on too. Does setRenderState add or replace when it is called multiple times?
CullState won’t remove texturing from one side of a triangle or the other, it will actually make the entire triangle disappear if viewed from the culled side.
Oops. I forgot to recompile my the loader before I ran the convert script again. That would certainly cause a problem. :// Got it compiled and the culling is working. Thanks Kev and Renanse!
If you're going to do crease angles, get ready for some heavy math. I had to do something similar with my 3ds loader and it wasn't pretty.
In other words... "forget about crease angles". ;)
Thanks Cep. I might do a little reading on them, but I'll avoid spending a lot of time on them until I'm much more familiar with 3D rendering. The loader does what I need it to do at the moment, so I'll probably only tinker with it here and there. Jeremy Booth, the Java3D/Xith3D loader author, told me he is wanting to port the loader to jME too. Maybe he'll be able to pick up where I left off when he has time.