i’ve finally managed to export a .obj from blender and import it into jME, but because of any reason it doesn’t show any reaction to the light. (i’m using the default setup of SimpleGame … and just added the model to the scene with and without an applied material and texture … but the model has the same color on every vertex, no matter if there is light or none … (imo it should be darker on the side where no light was added… at least it works with a Box)
Is there any option i have to set so it reacts on lights ? or something ?
btw. there is a small typo in the ObjToJme converter:
} else if ("Ks".equals(parts[0])){
curGroup.m.setSpecular(new ColorRGBA(Float.parseFloat(parts[1]),Float.parseFloat(parts[2]),Float.parseFloat(parts[3]),1));
return;
} else if ("Ks".equals(parts[0])){
curGroup.m.setShininess(Float.parseFloat(parts[1]));
return;
imo the second one should be "Ns" .. (ObjToJme.java line 181)
as long as normals are set, objects will react to lights. Are you certain the normals are set up? How are you seeing the object? Is it full brightness or dimly lit from the ambient lighting?
You can press ‘L’ to turn lighting on and off in SimpleGame, although it’s on by default.
if i deactivate lighting the only change is that it gets totally white…
another strange thing is, that with lighting on the blue changes to white sometimes depending on the camera rotation/position … this looks like: http://kahless.yourhell.com/dev/tmp/SCjMEscreenshot_white.PNG (i have not changed anything on the lighting … just moved/rotated the camera)
things I can think (in general in a 3d file producing this in any software)
shininess value 0 or close to 0. (an dof course, specular set to full white)
emissive value very high: white or close.
some ambient lighting in the engine code set to maximum.
Normals can be there (of course, could be it not computing normals, but I suspect mre the above…) but with those extreme values can’t be apreciated.
Those settings, if I remeber well, are stored in the mtl file, unless the engine puts random or initializated ones when it does not find the mtl and texture in same folder.
as you mtl is also like obj an ascii file. You can write perfectly and edit the mtl file. though this is usually handled in your 3d app; sure you have a way to set the material not with those problems. If it’s averagely good, it must allow it…
but u can see the values now in the mtl, and try writting emissive to full balck, shininess to 124 or 115, as u prefer, specular to black even though that’s a bit mor edrastic.
it seams that the emissive value is not supported by the .obj format ? it is not mentioned in the .obj file which i exported from blender… and there is nothing in ObjToJme.java which could set the emissive value…
i have no idea if the normals are correctly exported into the .obj file… don’t know how i should test them … but at least there are normals in the .obj file
Honestly, I don’t really know why your obj isn’t loading, but I did compare it with the maggie.obj file and one difference I see is slight formatting differences:
maggie.obj -
usemtl MAGGIE_yellow_0
f 463//1429 332//1430 464//1431
your obj file -
usemtl Material
usemat SCshipmytest.PNG
f 1185/1/1 1812/2/2 1813/3/3
your f values contain a single ‘/’ and three values, maggie.obj contains ‘//’ and two values? Or ‘/’ and three values with the center value empty… not sure, but it might be enough of a difference that our exporter doesn’t handle the case properly.
Try taking the maggie.obj and importing it into AC3D, saving, then exporting it back out to obj, see if it still loads properly.
Sorry, can’t help any more than that, but I don’t know much about the obj exporter.
Its now possible to export a large scene with materials and UV mapping/images
And import it- keeping all the properties supported by obj. "
An uv mapped sphere, with material and texture…
newmtl Material
Ns 96.078431
Kd 0.756191 0.756191 0.756191
Ka 1.000000 1.000000 1.000000
Ks 1.000000 1.000000 1.000000
d 1.000000
illum 2
newmtl Material.001
Ns 96.078431
Kd 0.800000 0.800000 0.800000
Ka 1.000000 1.000000 1.000000
Ks 1.000000 1.000000 1.000000
d 1.000000
illum 2
hmmm…I start to understand…
ambient is too high…
1.0, while the specs advice 0.2,0.2,0.2…
Some engines and 3d softwares read ambient (Ka) = 1 as a self illuminated thing…
NS is shininess…hmm…I’d try a 124 value, instead of 96…even I’d say, 128…
Ks is the specular color…ok, is pure white but that should not affect…
If u wanna try to see if specular are wasting you a bad joke, put illum 1 , which means no speculars at all, just pure good volume shading
oops…blender skipped to export the texture file name…hmm…can add manually, though ,but… I think it’s this…
" map_Ka filename "
As i don’t know if Blender undesrtand well the obj shininess value, u could try with 0 value, too…but imho that’s indeed what would output a non shaded over illuminated mesh…I use to use 124 , 125, 128.
Also, make sure your OBJ is refering the mtl file somewhere, in that same url explains at the beguining how it must be read…
I guess is one of this problems, unless there’s some problem in the ambient lighting of objs or something in jME, whcih I doubt. Try these settings.
and the only clear difference with Milkshape obj export is that ms3d supports smooth groups (look at that "S")
.
.
g default
s 1
f 63/1/1 1/1/2 994/1/2
f 994/1/2 1/1/2 2/1/3
f 994/1/2 2/1/3 993/1/3
f 993/1/3 2/1/3 3/1/4
As you see, the double slash "//" is indeed not very frequent…
bingo…many people use 3d exploration/or newer deep exploration…I have the old shareware 3d exploration 1.5, which did not canceled after 30 days…(only a remind me later message…)
i don’t think it’s much about the material, because i tried to modify ObjToJme so it does not apply any material/texture at all … but it didn’t change anything … (except that it wasn’t blue anymore of course … but still no reaction on lights)
Something’s not letting it do normals. I didn’t have time last night to look at it, but I’ll try tonight. If you could do me a favor, convert the .jme to XML and either post the XML or link it so I could look at it. From looking at the XML I can tell what it is or isn’t loading correctly.