Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Object File Text Format (*.obj)

Author
Message
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 2nd Jul 2016 22:13
Hey everybody!

Been a little while. How y'all doing?

I've been fiddling around with .obj files and discovered when opened in notepad, it is not encrypted, this I could use this for useful things. Now it's readable, not completely understandable for me yet. I've tried googling on the subject but could not find a straight to the point explanation that I could understand.

What I wish to achieve? Create simple meshes in notepad (to create cube/tile based maps) with the use of an atlas texture.

It's for a retro fps dungeon crawler/shooter game! Later on I will create an editor for the engine, but first I need to understand this part.

Anyone has some resources/info on the subject? Any help is greatly appreciated. Thanks!!
Regards Sph!nx
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 3rd Jul 2016 17:26 Edited at: 3rd Jul 2016 18:24
Hey, I've made some progress. Managed to create a square of two faces, facing upwards (for use as a floor tile) (size 64x64). I currently use a single image (not atlas) and wish to UV map the image on the square, but I do not know how to get the UV coordinates from the vertexes and how to implement it. I know it is part of the "vt" lines.

Here is the "test.obj" file I'm working with:



Any help is much appreciated! Thanks

EDIT
I've figured it out! I've added comments which should explain it. Here are my findings:
Regards Sph!nx
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 4th Jul 2016 07:43
HI

I'm interested about this format too (and other format like b3D for example).
Here is an example of a cube made in blender and exported in .obj :


And the material :


Informations about .obj format here (I think it's interesting for you ) :
http://www.hodge.net.au/sam/blog/wp-content/uploads/obj_format.txt
http://paulbourke.net/dataformats/obj/
http://www.fileformat.info/format/wavefrontobj/egff.htm

https://en.wikipedia.org/wiki/Wavefront_.obj_file


I think you should find some informations about .obj in the blender documentation :
https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/Wavefront_OBJ

I hope this will help you (and continue to post your example )
AGK2 tier1 - http://www.dracaena-studio.com
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 4th Jul 2016 13:11
Thank you very much, Blendman! Much appreciated.

On the subject of materials... Correct me if I'm wrong. AppGameKit does not use the material data (besides the UV mapping). AppGameKit can only use one material (assigned through AppGameKit code) on each object. This is what I've learned so far... correct?

Thanks again!
Regards Sph!nx
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Jul 2016 13:12 Edited at: 4th Jul 2016 13:13
Quote: "GK can only use one material (assigned through AppGameKit code) on each object. "

As loaded in the object, yes.

But you can multi texture for shaders.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 4th Jul 2016 21:06 Edited at: 4th Jul 2016 21:23
I have coded 3 years ago an OBJ Loader which parse OBJ and MTL file to support multiple meshes ans multiple textures. Its was used by My AppGameKit SpeedRacer game :



I have also coded a B3D Loader which reads Binary data and recreates OBJ meshes with textures and also support lightmaps (B3D + Lightmaps exported with 3D World Studio, DeleD CE for example) with a cache system which preserves previous generated OBJ Files. I plan to adapt it with the new Memblock commands (AGK2) to create meshes with faster loading but i have actually no time for that.

Interested ? (i have to clean the code before... and the code may not be fully optimized!)
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 5th Jul 2016 00:02
ah yes... the obj format. I actually build obj files within agk code to load in 3d models. Its a very easy format to write and agk is fairly fast at coding the obj file.... saving ... and loading back in to use. My current game engine does this and makes it possible to have limited to no 3d media since its capable of creating the meshes with code.

If you got any more questions about obj... i could probably help.

as you figured out "v " is for vertex data. " vn " for normals data "vt" for uv data and "f " for index data that links the vertex and normals and texture data to form a triangle or quad.
let me know if you need anymore help with this.



blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jul 2016 03:09
MikeMax. I would luv to see that code! Awesome stuff
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 7th Jul 2016 16:31
Hey guys, thanks for all the replies! I'm still learning and experimenting stuff.

@ MikeMax, that looks awesome and would love to take a peek!

@ SMD, I know you are very much experienced with this stuff. I've seen you do cool stuff with your voxel techniques. Very impressive stuff. If I have questions I'll be sure to ask!
Regards Sph!nx

Login to post a reply

Server time is: 2024-09-29 15:15:57
Your offset time is: 2024-09-29 15:15:57