The objloader in horse demo is a bit limited and buggy. it worked just enough for the horse but not for anything else! In your case, the bug is the last (one single) object in the .obj file isn't taken into account. Here is quickly patched version.
Thanks @hgy29, it displays now. There seems to be still a bug regarding the texture coordinates as the texture is upside down. I will try to hunt this.
Question: The ccordinate system seems to be so the Y axxis is horizontal and X vertical. Is that correct?
You can ask as much as you want of course, no problem
Lighting should be handled by shaders, I am on something for my 3D game project but it doesn't behave correctly yet. For Camera/View you can use the Viewport sprite, it has special provisions for 3D perspective and camera/world placement, but there is a lot of maths and I'd like to come up with a more straightforward way.
Any idea how I can get this example code to work with my own exported obj file? It keeps throwing an error on line 78... horse/objloader.lua:78: attempt to perform arithmetic on field '?' (a nil value) stack traceback: horse/objloader.lua:78: in function 'alloc' horse/objloader.lua:90: in function 'loadObj' bomber/bomber.lua:2: in function 'buildBomber' main.lua:4: in main chunk If anyone can show me how to get this example working with my own 3D objects I would be very grateful. I have attached the object that it refuses to work with. It would be fantastic if some examples were made more user friendly, ie; work with data other than the supplied defaults
It's no problem in the end, I just won't bother with any 3D stuff in my game :-))
Hi @antix, just before I try objlader with your file, do you use a recent version it ? It was significantly improved in 2016.10 release. Anyhow .obj format is those kind of formats that seems pretty easy at first sight but end up being that permissive that each software write it diffrerently.
@hgy29 no I am still using 2016.8. I used the code that you posted above but that was back in September. Are you able to attach a newer version? I will install a newer version of Gideros on another machine, get the code from that, and report back. Thanks.
With the latest version of Gideros the object now loads but there is no texture displayed. I think I should experiment with Blender some more on the other machine. I haven't yet tried to copy the new object loading code to my old version of Gideros.
I reinstalled 2016.6 and it now loads my meshes now that the texturing is correct. However it shows as loaded in the horse demo but nothing is displayed. I think I will forgo 3D
No luck, it still doesn't work. I'll wait till the newer versions of Gideros are production ready before attempting 3D stuff. Hopefully it won;t be too long
Yes @antix, 2016.10 has improved support for 3D (Viewport with coordinate system independent of logical canvas, camera placement helpers, etc). So for a new project better start with a recent version. 2016.12.1 is ready in repo, hopefully @john26 will be able to build it by the beginning of january.
@hgy29 great. I can just make renders in Blender now and use those images as backgrounds in my new game. For my next project I think I will upgrade my Gideros version and do some 3D things
I am working on 3D addition to my lastest game (picking up 3D objets with augmented reality), and I discovered one more bug in objloader: Y texture coordinate is reversed so textures appear upside down or compltely garbled depending on your model.
Also objloader is somewhat slow, since it is written in lua, so I am refactoring it a bit to separate computation parts from actual sprite building. This will allow to convert .obj files in some format more suited to gideros, which will loader faster (~100x faster from my experiments)
Comments
Question: The ccordinate system seems to be so the Y axxis is horizontal and X vertical. Is that correct?
May I ask something for a last time? Is this implemented?
1) Lights in 3D?
2) Camera/View(orientation) in 3D?
Lighting should be handled by shaders, I am on something for my 3D game project but it doesn't behave correctly yet.
For Camera/View you can use the Viewport sprite, it has special provisions for 3D perspective and camera/world placement, but there is a lot of maths and I'd like to come up with a more straightforward way.
Likes: MikeHart
Likes: simwhi
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
horse/objloader.lua:78: attempt to perform arithmetic on field '?' (a nil value)
stack traceback:
horse/objloader.lua:78: in function 'alloc'
horse/objloader.lua:90: in function 'loadObj'
bomber/bomber.lua:2: in function 'buildBomber'
main.lua:4: in main chunk
If anyone can show me how to get this example working with my own 3D objects I would be very grateful. I have attached the object that it refuses to work with. It would be fantastic if some examples were made more user friendly, ie; work with data other than the supplied defaults
It's no problem in the end, I just won't bother with any 3D stuff in my game :-))
Likes: antix
Likes: antix
Also objloader is somewhat slow, since it is written in lua, so I am refactoring it a bit to separate computation parts from actual sprite building. This will allow to convert .obj files in some format more suited to gideros, which will loader faster (~100x faster from my experiments)
Additionnaly I began writing an fbxloader...
Likes: antix, MoKaLux