Quick Links: Gideros Home | Download Gideros | Developer Guide
Why non of my 3D objects are displayed?
  • Hi folks,

    I try to display some simple textured OBJ files but non of them are showing up. Why?

    I am puzzled.
    Card_Rogues.zip
    107K
  • hgy29hgy29 +1 -1
    Maintainer Accepted Answer
    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.
    objloader.lua
    3K
  • 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?

  • hgy29hgy29 +1 -1
    Maintainer
    Yes, the coordinates system is the same as in 2D, with the third (Z) axis pointing toward the viewer.
  • I know, but X seems to be up and down, while Y is left and right. Is that in 2D too?
  • hgy29hgy29 +1 -1
    Maintainer
    Ah, no sorry I misread your post. Are your orientation settings correct ?
  • Like you see in the code I posted, which is a copy of the Horse3D code.
  • hgy29hgy29 +1 -1
    Maintainer
    Yes, in the code there is
    application:setOrientation(Application.LANDSCAPE_LEFT)

    while in project settings orientation is portrait, so my question is rather did you suppose it was portrait or landscape ?
  • Dooo, now it makes sense. That was it. Thank you and sorry for taking your time for such a stupid user error.

    May I ask something for a last time? Is this implemented?

    1) Lights in 3D?
    2) Camera/View(orientation) in 3D?
  • hgy29hgy29 +1 -1 (+1 / -0 )
    Maintainer
    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.

    Likes: MikeHart

  • john26john26 +1 -1 (+1 / -0 )
    Maintainer
    It's probably too elementary for you, but have you seen my 3D gfx tutorial yet?



    Likes: simwhi

  • Thanks John, will have a look when i am back from my trip.
  • 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 :-))
    bomber.zip
    2M
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • hgy29hgy29 +1 -1 (+1 / -0 )
    Maintainer
    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.

    Likes: antix

  • @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.
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • 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.
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • Okay got it. I had not unwrapped the UV stuff in Blender. It works now, cheers. Now to see if it works on the older Gideros ;)
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • Which it doesn't :(
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • 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 :(
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • Thanks @MikeHart I will check :)
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • 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 :)
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • hgy29hgy29 +1 -1 (+1 / -0 )
    Maintainer
    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.

    Likes: antix

  • @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 :)
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • hgy29hgy29 +1 -1 (+1 / -0 )
    Maintainer
    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)

    Additionnaly I began writing an fbxloader...

    Likes: antix

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID

In this Discussion

Top Posters