Lighting on .OBJ Model after import

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Lighting on .OBJ Model after import

Flows
Hi all,

I am having a little bit of trouble with a program ive implemented. It loads the desired .obj model from the users directory and displays it on a canvas. The user can then rotate around the object, adjust the color of the lighting and add or remove textures.

However, when i load the model, the lighting is screwed. The whole object is the exact same shade of light, and changes when i move the object around (the whole object for example, changes from light to dark). There is no sense of 3D. When i draw an object with glut, the lighting is perfect.

Just wondering if this is reminiscent of a popular problem? I also cant apply textures, whereas i can with glut, using the exact same procedure.

Any help would be great! I can post my obj reader if you'd like.

Reply | Threaded
Open this post in threaded view
|

Re: Lighting on .OBJ Model after import

Demoscene Passivist
Administrator
Sounds like u have forgotten to export/import normals and/or texture coordinates for ur model. Glut generates those for u automatically.

U have to explicitly export normals/texture coordinates when u export from e.g. blender. If the problem lies in ur loader u may have a look at my implementation here: WavefrontObjectLoader_DisplayList.java
Reply | Threaded
Open this post in threaded view
|

Re: Lighting on .OBJ Model after import

Flows
Thanks a lot!!!! Worked perfectly!

Now i can load objects and apply textures! Albeit a bit laggy when moving my object around.

If you have time, just 1 more question related to loading OBJ files. I can load numerous obj models, but when i try to load a specific model (its a AK47 model) i get a buffer overflow exception. I take it its because theres too much being done in memory. Is this a limitation of the loader, or of my code?

Thanks for the help, its much appreciated
Reply | Threaded
Open this post in threaded view
|

Re: Lighting on .OBJ Model after import

Demoscene Passivist
Administrator
Nope, the loader has no 'build in' limitation. Usually when u got problems with specific models it's an export problem on the 3D modeler side (e.g. with Blender or 3DSMax). Generally u have to "triangulate" the model during/before export to make it a valid wavefront mesh with multiples of 3 (or 4) as vertex count of the polygons, or otherwise u will get these 'strange buffer over-/under-flows'.
Reply | Threaded
Open this post in threaded view
|

Re: Lighting on .OBJ Model after import

Michael Bien
In reply to this post by Flows
  there are many ways to represent the same model in a obj file. Every
model exporter has a slightly different "handwriting", some of them are
even broken. Sometimes it helps to load the model in a editor and export
it again to have a clean obj file.

I remember as i learned programming I managed to write a jogl obj loader
which only worked with models exported from Wings3d*  :)

*http://www.wings3d.com/

-michael

On 04/18/2011 10:39 PM, Flows [via jogamp] wrote:

>
> Thanks a lot!!!! Worked perfectly!
>
> Now i can load objects and apply textures! Albeit a bit laggy when moving my
> object around.
>
> If you have time, just 1 more question related to loading OBJ files. I can
> load numerous obj models, but when i try to load a specific model (its a
> AK47 model) i get a buffer overflow exception. I take it its because theres
> too much being done in memory. Is this a limitation of the loader, or of my
> code?
>
> Thanks for the help, its much appreciated
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.jogamp.org/Lighting-on-OBJ-Model-after-import-tp2816340p2836152.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, visit