Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 7/2/08 20:32

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

OBJ viewer + new guns

Here is a tentative OBJ viewer for single objects.
I'm also including the guns released by 17 secs.
http://geyser.oni2.net/TEMP/obj_view.zip (2 MB)
("temp" means I don't guarantee it'll stay there)

Read the readme and run the scripts in [viewer].
You can edit the textures in [original] in real-time.
(after saving them, press SPACE in the viewer)
Left mouse button rotates the object.
Right zooms. Left+right pan the view.
Backspace resets the view to default.

NOTE: the guns in [original] are not triangulated.
So you can't import them directly with OniSplit.
I included already imported versions, though.

EDIT: triangulated guns now available in [adapted].
There are a few glitches because of non-planar "quads".
It's not anybody's fault (except perhaps the author's).
We might get around to fixing those some other time.

@ Mac dudes:
There's the source and Makefile for you (or whoever) to look at in awe.
The thing should compile on the Mac, but you'll need the freeglut library:
http://freeglut.sourceforge.net/
All the other libs I used are supposed to be standard (openGL etc).
Of course, Windows-specific libs will be replaced by some OSX stuff.

Last edited by geyser (10/2/08 21:02)


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#2 8/2/08 0:06

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

geyser: Myrd was able to compile a Mac version of your viewer, his instructions:

I've updated the code and added a Makefile that makes it compile and work on OS X (and freeglut is not required).

Grab it here: http://projectmagma.net/~myrd/obj_view.zip

You can compile the code by typing 'make' in the 'viewer' directory, and 'make clean' removes everything so you can rebuild it.

Then, you can type stuff like './obj_view  ../original/TCTF_Subcarbine.obj ../original/TCTF_subcarbine.tga' to see it in action.

(This is all from the Terminal, I hope you're familiar with the command line.)

I did a quick test and it did work. Unfortunately, I won't have time until tomorrow after work to play with it.

Last edited by EdT (8/2/08 0:51)

Offline

#3 8/2/08 9:47

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: OBJ viewer + new guns

Holy crap, what a quick turnaround on the Mac version!  Look forward to trying this over the weekend.


byproducts are fine, but where's the beef?

Offline

#4 8/2/08 12:34

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

@FreeGLUT:
I'm using it in my programs as an up-to-date substitute to GLUT, but only because MinGW (the GCC environment for Windows) doesn't include either by default (in particular not with the Dev-C++ IDE bundle).
However, FreeGLUT is compatible with virtually all of GLUT's functionality, so since GLUT seems to be there by default in Darwin's GCC, my stuff should indeed build just fine with it. I'm glad it worked so fast.
I'm also glad that Myrd was so helpful and responsive. A Mac port mere hours after my release. Wow. I'm sure he can help you develop GUIs for OniSplit and the Edition better than anyone out there.

@Iritscen:
The viewer doesn't yet handle complex objects (like characters or level parts), but then again, OniSplit only supports import/export for standalone meshes right now. So they match.
I'll try to sort out the texture loading issue because then I/we can do some serious experimentation with the characters: body set recombination, more or less complete retexturing.


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#5 8/2/08 12:41

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

geyser: Did you get a chance to look at what he changed?  He thinks his changes shouldn't affect PC users and that you may be able to merge them into your code.

Offline

#6 8/2/08 13:04

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: OBJ viewer + new guns

Ah, so if I understand what you're saying, geyser, we will be looking at only one part of a character, like, a piece of a leg, an arm, etc.  That is how things seemed to be stored back when I browsed the 3D objects with OniTools a while back.  Is that right?  Even that is satisfactory for my purposes.


byproducts are fine, but where's the beef?

Offline

#7 8/2/08 16:16

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

@ EdT:
Well, Myrd's revision is already something we can both build with our respective makefiles.
I only had to change the non-Mac glut.h back to freeglut.h (for reasons mentioned above).
Just take away the silly pony.c (which should never have been there) and edit gl.h to be:

#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#else
#include <GL/gl.h>
#include <GL/freeglut.h>
#include <GL/glext.h>
#endif

Then you get exactly what I have now (apart from the Windows/Mac EOL of course).
You build that stuff with your makefile, I build it with mine. Nothing left to "merge".
Future versions of this thing probably won't use extra units (files), so we're all set.

If this baby becomes more than just a toy (who knows?), we'll probably SVNize it.

@ Iritscen: That's right. Single meshes only, untextured or with a single texture. For the moment.
If you're OK with painting a character bone-by-bone, you're more of a hacker than I thought tongue
An issue with character painting is that the same textures are used for all the levels of detail...
So eventually I'd implement a TRBS/TRMA viewer, with real-time cycling between the LODs.
And after a while, who knows, maybe even animations... This is the start of a mini-engine smile
Actually, I already did a specialized mini-engine some time ago, for a physics simulation.
About "shot peening". Here's where you can grab it: http://perso.crans.org/~mechkov

Last edited by geyser (8/2/08 16:26)


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#8 8/2/08 19:25

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

geyser: I get the same error message when trying to view the obj files.
When I did the quick test, I didn't look at the terminal.

./obj_view  ../original/TCTF_Subcarbine.obj ../original/TCTF_subcarbine.tga
: No such file or directory
" at line 2149 material "scene_material1

./obj_view ../original/WCG_Machinegun.obj ../original/machinegun.tga
: No such file or directory
" at line 1894 material "scene_material1

All I can see is this:

subcarbine.jpg

Last edited by EdT (8/2/08 19:27)

Offline

#9 8/2/08 19:43

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

Check out the scripts in [viewer/scripts] and maybe you'll understand what's going on smile
The OBJ files specify their own "materials", which are stored as .mtl files in [original].
The .mtl are specified with relative paths, so they need to be in the current folder.

Since I'm providing the texture anyway, the only effect of missing materials is the lack of shading.
Try going to [original] and running: ../viewer/obj_view WCG_Machinegun.obj machinegun.tga
That'll give you proper shading (actually it's pretty ugly, but not much uglier than the textures).

P.S. Your subcarbine looks rather messed up, I'd say. Did you edit the OBJ or something?


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#10 8/2/08 20:35

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

OK, I did exactly as you stated:
../viewer/obj_view WCG_Machinegun.obj machinegun.tga
: No such file or directory
" at line 1894 material "scene_material1

mg.jpg

I have not changed anything.

Offline

#11 8/2/08 22:31

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

Time for another dumb question... I took the .oni files from the imported folder and put them in the level0_Final folder and then recompiled level0.  Now how do I view the new weapons in Oni?

Offline

#12 9/2/08 6:26

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

Neo's trick to quickly view the new weapons in Oni was to specify them as powerup meshes.
You can do that either by renaming a gun to M3GMpowerup_lsi.oni, or by editing the ONGS.
The guns are absolutely not ready to be used as guns ingame, so don't even ask about it smile

As for the materials - holy crap, you're right. I left the original paths to .psd files in the .mtl
However, this doesn't really explain why it complains about not finding "scene_material1"...
I'd really expect it to get at least the reflectivity amounts from the .mtl file... but it doesn't?

And of course one thing that's totally wrong is the screwed-up geometry. What the blam...
I'll release an updated version tonight, for you and also and especially Myrd to look at smile


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#13 10/2/08 21:00

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

I've updated the viewer. It should compile on a Mac with the same Makefile as before (included).
Neo and I fixed a memory corruption bug (which may have been causing Ed's weird screenshots).
We've also added proper texture loading so that now you can view characters and furniture.
(there's a new version of OniSplit that can extract ONCC and OFGA as OBJ, check it out)
The camera control is much more user-friendly now and allows you to orbit anything at all.
Personally, I think the viewer's life as a working tool starts now (I might rewrite it later).

Viewer: http://geyser.oni2.net/TEMP/obj_view.zip
OniSplit 0.8.16: http://geyser.oni2.net/TEMP/OniSplit.exe


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#14 10/2/08 23:26

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

geyser: We're getting close...

ninobj.jpg

I get the message from the command:   ../viewer/obj_view ninjabot/ONCCninjabot.obj

: No such file or directory
" at line 2850 material "NINJA_EASY_practise
" at line 2922 material "NINJA_EASY_practise
" at line 3000 material "NINJA_EASY_practise
" at line 3042 material "NINJA_EASY_practise
" at line 3108 material "NINJA_EASY_practise
" at line 3186 material "NINJA_EASY_practise
" at line 3228 material "NINJA_EASY_practise
" at line 3294 material "NINJA_EASY_practise
" at line 3372 material "NINJA_EASY_practise
" at line 3434 material "NINJA_EASY_practise
" at line 3512 material "NINJA_EASY_practise
" at line 3582 material "NINJA_EASY_practise
" at line 3678 material "NINJA_EASY_practise
" at line 3756 material "NINJA_EASY_practise
" at line 3794 material "NINJA_EASY_practise
" at line 3860 material "NINJA_EASY_practise
" at line 3956 material "NINJA_EASY_practise
" at line 4034 material "NINJA_EASY_practise
" at line 4072 material "NINJA_EASY_practise

The same for other obj, I get a white image.

EDIT: Now I tested OniSplit
mono onisplit.exe -extract:obj ONCC ../../GameDataFolder/level0_Final/ONCCninjabot.oni
Then:
../viewer/obj_view ONCC/ONCCninjabot.obj

This time the bot is all black, but no error message...

I also tried Konoko k4_G, but when I tried to view it in the obj_viewer, it crashed no message in the terminal.

Here are my files made with the latest version of OniSplit:

http://edt.oni2.net/OBj/ONCCnin.zip
http://edt.oni2.net/OBj/ONCCk4.zip

Last edited by EdT (10/2/08 23:38)

Offline

#15 11/2/08 6:27

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

The program works fine on PCs with the obj you provided, so it's something we don't know about Macs.
I updated the program so that it prints the name of the .mtl it attempts to read before it actually does.
You should get more in the Terminal than that annoyingly uninformative ": No such file or directory"...


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#16 11/2/08 9:36

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

Here is the name:

Trying to read file: ninjabot/ONCCninjabot.mtl
.mtlng to read file: ninjabot/ONCCninjabot.mtl
: No such file or directory

Offline

#17 11/2/08 10:09

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: OBJ viewer + new guns

It's very exciting to see the OBJ viewer come together so quickly.  Has the syntax changed at all for the new version of the OBJ Viewer?  Over the weekend, I wrote an app for the Mac that basically is a GUI front-end for the first version that you released last week.  I'll put it in the Mac programming thread.

I was going to make a bug report on OBJ Viewer as well.  It seems that you've already noticed that the textures and geometry are messed up (for me, the trigger area of the gun always seems to be the problem -- I could show a screenshot if you want).  You've also noticed the error (at least on the Mac) on the command line about not finding the material.  I also noticed that opening the .obj in a 3d app required linking to the .psd, which seemed weird, but I didn't realize it wasn't supposed to do that.

Other issues (probably Mac-only):
1. The obj_view window stays active in a way that blocks all open Finder windows.  You can still move the Finder windows, but you can't click in them to make them active, and you can't click on any of the icons to move or open them.  I believe that switching to other apps allows those apps to be used, but the Finder is getting messed up.  Perhaps this is something we Mac users have to tackle ourselves.

2. The all-important instant-refresh feature is broken.  It seems that obj_view is holding onto the .tga file instead of reading it and letting it go, so you can't save changes to it in a graphics app while obj_view is using that object.  The graphics app hangs while saving, but quitting obj_view immediately allows the save to finish, so that proves it's a file-already-open issue.  Not sure who should/can fix this.

Otherwise, great work!


byproducts are fine, but where's the beef?

Offline

#18 11/2/08 11:55

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

Updated. Please test. Hopefully it renders everything, at least (at last, heh): http://geyser.oni2.net/TEMP/obj_view.zip

It's very exciting to see the OBJ viewer come together so quickly.

"Don't get too excited here, Jade. If you ask me, the fat lady hasn't sung yet..."
I can't help you with the refresh issue, and that makes the viewer rather useless.

Has the syntax changed at all for the new version of the OBJ Viewer?

Well, you no longer provide a texture as the second argument, for one thing.
The OBJ is supposed to look up and load its own materials and textures now.

It seems that you've already noticed that the textures and geometry are messed up

That was a bug with compiler-dependent consequences (big-time memory corruption etc).
I fixed it already in the first update above, and the geometry of the ninjabot looks fine.
Also, Ed didn't seem to notice anything wrong with the guns except the "white image".
So probably/hopefully the screwed-up vertices will be gone with a recent version. Try.

You've also noticed the error (at least on the Mac) on the command line about not finding the material.

That's something I'm trying to fix now. It seems to come from newline conventions.
In the new version, I've changed the parsing so it handles carriage returns if any.

I also noticed that opening the .obj in a 3d app required linking to the .psd, which seemed weird, but I didn't realize it wasn't supposed to do that.

Again, the new version features non-triangulated versions with the .psd files (I may have left the original paths to the .psd, though; sorry).
There are triangulated meshes that are specified to use the TGA images. These are the ones you are supposed to feed to the OBJ viewer.

1. The obj_view window stays active in a way that blocks all open Finder windows.

This may be an issue with the GLUT library, which like I said is old and may have a few bugs when it comes to window management. Consider switching back to FreeGLUT, which should have less buggy GUI support.

2. The all-important instant-refresh feature is broken.  It seems that obj_view is holding onto the .tga file instead of reading it and letting it go

That's rather impossible, because once the loading function exits, the reading stream is closed and the viewer is then totally independent from what becomes of the TGA file.
There is absolutely no reason why a file should remain locked for the rest of the system except during the refreshing itself.
So, either yet another flaw of GLUT, or user error/carelessness.

Last edited by geyser (11/2/08 11:56)


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#19 11/2/08 15:03

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

geyser: Sorry, no joy.  The ninjabot renders as a black outline.  The guns in the adapted folder cause OBJ Viewer to crash.
This time no error message about missing files...

Howver, here is how topex and the subcarbine in the original folder renders:

topex.jpg

Offline

#20 11/2/08 19:28

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

UPDATE!  I tested the OBJ viewer on my MacBook OS X 10.5.1 and it works!

OBJk4.jpg

No crashes with the adapted guns either.

So it must be an issue with either my video card, OS X 10.4.11 or OBJ needs an Intel Mac to function!

Thank you for your work, geyser!

Offline

#21 11/2/08 20:02

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

I had to try an old file I had:

ID.jpg

I noticed that in the OBJ Viewer, the textures would flicker on and off

Offline

#22 11/2/08 20:34

geyser
Member
From: beyond the veil
Registered: 14/1/07
Website

Re: OBJ viewer + new guns

It's a shame about the OSX compatibility issues. Maybe it'll work more reliably if I rewrite the OBJ stuff with C++ classes and streams...
I'm just happy it works fine on Windows, and on the Intel Macs, as I don't feel like rewriting the whole thing right now. Other things to do.
Then again, there's always the possibility that Neo will adapt OniBrowser to use OpenGL rather than XNA, making it portable to the Mac.
As for the Iron Demon: the OBJ exported by Seventeen Seconds are usually quite messy: wrong normals, bad polygons, you name it.
In the case of the guns, for example, we had to recompute the normals, and we have yet to fix a couple of non-planar quads. Sigh...
Not sure what you mean by flickering on and off. Could be either messed-up normals or polygons culled because of bad vertex order.
Maybe upload your Iron Demon OBJ so we can fix it. Actually I have it somewhere, but I also want to have a closer look at "yours".

Last edited by geyser (11/2/08 20:36)


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#23 11/2/08 22:00

EdT
Moderator
From: Los Angeles, CA
Registered: 13/1/07
Website

Re: OBJ viewer + new guns

geyser: Here is the version I have: http://edt.oni2.net/OBj/iron_demon.zip

Not sure what you mean by flickering on and off.

For example, while the OBJ window is open the yellow and black stripes on the fuel assembly will appear and disappear.

Having the OBJ work is great, currently, there is nothing like it, in the OSX world.  I tried some 3D programs like Blender or Wings3D but it was a lot of work just to view .obj files.

Offline

#24 12/2/08 4:59

TOCS
Member
From: Denmark
Registered: 4/4/07

Re: OBJ viewer + new guns

Cool, some off the weapons were actualy in the dev oni, before it got released. That SMG elite looks like the one there was before!

Offline

#25 12/2/08 9:31

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: OBJ viewer + new guns

Okay, the obj_view is working great with the examples that are provided.  I'm on a MacBook Pro, OS X 10.4.11.  I also rewrote OBJViewer Assistant (Mac) to simply open .objs.  Technically it's just an open dialog box to make up for the lack of one in obj_view's GUI.

Now comes the part where I have to ask a stupid question: how do I get a character exported from the GDF?  I want to export TRBSes, don't I?  Does onisplit export whole characters?  I'm confused.


byproducts are fine, but where's the beef?

Offline

Board footer

Powered by FluxBB