www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: Thomas. on June 13, 2012, 06:55:25 pm
-
Egon, please, could you add support for load normals from OBJ file? For compatibility you can add "Config.loadNormalsFromOBJ = false;" ... Thanks, in return I offer model for your game :) ... and it would be nice if you also add possibility for object without normals, maybe method "Object3D.build(boolean containsNormals);"
-
Deal! Albeit i personally think that this normals-topic is highly overrated... ;) However, it will take some days to find the time to finish this. Can you provide me with a simple model that contains proper normals? A sphere might be useful for this.
-
Perfect :) here you have sphere with normals...
http://dl.dropbox.com/u/26148874/sphere.zip (http://dl.dropbox.com/u/26148874/sphere.zip)
-
I'm not sure, that help me loaded normals. It seems to be saved normals per face, not per vertex. What I want is well lighting box. But object without normals is still important for me...
In screenshots below is problem, which I have. I'm using per-pixel lighting. Any idea, how fix bad lighting polygons?
(http://dl.dropbox.com/u/26148874/device-2012-06-14-115914.png)
(http://dl.dropbox.com/u/26148874/device-2012-06-14-115942.png)
(http://dl.dropbox.com/u/26148874/device-2012-06-14-120005.png)
(http://dl.dropbox.com/u/26148874/device-2012-06-14-120119.png)
-
This doesn't really look like per-pixel to me... ???
-
It's should be per-pixel... Have you any per-pixel shader, which you can share? All objects have same shader...
(http://2i.cz/2i/t/4aeb85af7c.jpg) (http://2i.cz/4aeb85af7c)
-
Try this one: http://www.jpct.net/forum2/index.php/topic,2723.msg20330.html#msg20330 (http://www.jpct.net/forum2/index.php/topic,2723.msg20330.html#msg20330)
-
I removed specular color, but problem is still same...
(http://dl.dropbox.com/u/26148874/device-2012-06-14-213639.png)
-
I see...the polygons are pretty large and because the normals on sharp edges are much different from those on flatter surfaces, it'll look this way despite of per pixel lighting. Increasing the geometries tessellation level should help, but it'll slow down the whole thing and uses more memory, so maybe that's not an option. I doubt that loading the normals from the file will help much, but we'll see. However, i still think that this is totally acceptable once you apply textures to the surfaces...but then again, i somehow like this vertex lit look of things like others like pixel art... :)
-
Whole problem is in normals in vertices. I need same normal in vertex and same in face... I also tried divide one polygon to many small, but every small polygon is visible and result is not much better...
-
If your vertex normals are equal to your face normals, you'll get flat shading. Or did i misunderstood that part?
-
Yes, flat shading, but just in some part of object... I think, that this is called smooth groups and OBJ has support for this...
(http://www.kxcad.net/autodesk/3ds_max/autodesk_3ds_max_9_reference/graphics/il_smoothing_groups.jpg)
I don't know how engine working, but GenericVertexControler is working with for ex. 8 vertices in box, so I can't affect all 32 vertices, that are sent to GPU, so I expect that normal is saved per one together vertex and is impossible to implement something else...
-
I don't get that picture...if the highlighted part is supposed to illustrate a smoothing group, it's simple the opposite of vertex-normals=face-normals and if you feed such a model in your game, you should get smooth lighting. If you don't, you don't have per pixel lighting enabled for whatever reason....anyway, we'll see what we'll get when reading the normals from the file.
The engine shares normals just like it shares vertices. You can disable this behaviour at load time if you tell the Loader so and the model is build that way, but depending on the mesh, this will largely increase vertex count.
-
Can I somehow get the lighting similar to medial bucket? I think, that this will need smoothing group and two way to calculate normals, because now engine every calculate normals like smooth...
edit: but it's not so hard, next boolean array to triangles (enable by parameter in constructor), if is smooth or flat. And calculate normal by old method, or just copy flat normal to vertex :)
-
Sorry, I had confusion in smoothing groups, they are probably unnecessary. I did a little test with normals. Whatever are saved normals to OBJ file or not, results are same when I open the model in Deep Exploration, so it seem, that this program is using some more complicated calculation of normals...
(http://dl.dropbox.com/u/26148874/object.png)
this file contains normals and for testing will be probably better than sphere
http://dl.dropbox.com/u/26148874/obejct.zip
-
Any news about normals?
-
No, not yet...
-
Give it a try:
http://jpct.de/download/beta/jpct.jar (http://jpct.de/download/beta/jpct.jar)
http://jpct.de/download/beta/jpct_ae.jar (http://jpct.de/download/beta/jpct_ae.jar)
Both have a new switch in Config (Config.useNormalsFromOBJ). Setting this to true will make jPCT load the normals from the file and don't calculate new ones during build(). At least that's what's supposed to happen.... ;)
-
I created test project, so you can see how it works (back button for load/calculate normals, menu button for switch between many objects). Any idea why is lighting bad??
http://dl.dropbox.com/u/26148874/TestProject.zip (http://dl.dropbox.com/u/26148874/TestProject.zip)
edit: in 3ds max and deep exploration seems these models correctly...
-
Can't run that ATM. Any screen shots?
-
Here are screenshots
http://dl.dropbox.com/u/26148874/screenshots.zip (http://dl.dropbox.com/u/26148874/screenshots.zip)
-
I found the problem. Whoever invented the OBJ-format has to suffer endlessly...i'll try to fix it, but it will require some internal changes to the object compiler as well...
-
I've uploaded new versions that might work better. However, this comes at the cost of additional compile time (might not be significant, i haven't benchmarked this) and slightly higher memory usage of objects with "file normals".
-
YES, nice, everything seems fine :)
-
Whoever invented the OBJ-format has to suffer endlessly
Well the closest names responsible I could come up with is the founders of Wavefront. :P
It was founded in 1984, in Santa Barbara, California, by Bill Kovacs, Larry Barels, Mark Sylvester.
http://en.wikipedia.org/wiki/Wavefront_Technologies