[Release - Alpha?] CgfxViewer or something.

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by planetarian, Nov 18, 2014.

  1. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    So I made a thing. A couple things, I suppose.
    While Gericom was working on EFE I was stumbling around in something... a bit less ambitious.

    [​IMG]

    Stuff Included

    CgfxViewer is a Viewer that Views CGFX models. I made it in the Unity 5 beta, so it's big, and might crash horribly. I haven't seen it happen yet, but y'know, risks.

    At this point it's not much more than a toy.
    To open a CGFX file, just extract CgfxViewer somewhere, then drag your CGFX file (likely a .bin or something) onto the CgfxViewer exe.
    You can even select multiple files and drag them all onto the exe at once to open them together (useful for character models that store head/body/face/etc in different files).
    Associate your CGFX files' extension with the exe and you can open them by doubleclicking.
    Once you open it, just use your mouse to change the camera view.

    Also included:
    libCgfx is a C# library that other apps can use to do things with CGFXes.
    ReadCgfx and ReadCgfxGui are... well, I've just been using them as debugging/analysis tools really but I guess you can use them if you want.

    Source

    I've included the source code for libCgfx, because that's a thing people do. I don't recommend actually using it, as it's a mess that I'm going to be rewriting soonish.

    I haven't included the source for the Unity components, because there's only two or three files, and I'm sure anyone actually interested in working with Unity can probably figure out how to implement that much.

    Status

    The viewer is not that good yet. Neither is the library, really. It might get better soon. Maybe.

    I've got my sights set on improving texture support first, then fixing some odd positioning bugs and maybe tackling animation eventually.

    Currently though I only have like a couple games ripped to test it with, and I'm a lazy-ass and haven't ripped any of my other games. As such, if you try a file and it doesn't work, send it my way and I'll fix it. Probably.

    Known Issues

    Too many to count. It's a mostly featureless alpha. Here's the major ones:

    * Animations, cameras, basically anything that is beyond the model itself, its bones, and its textures, not implemented.
    * Complex bone manipulations not implemented. The occasional model has random bits dangling in odd places.
    * Any shaders beyond basic diffuse/cutout not implemented. You'll see weird texture tiling sometimes.
    * No actual lighting/shading. The games I've worked with so far have had lighting disabled (fullbright on) and shadows are baked into the textures.
    * Everything is mirrored along the Z axis. 3DS, surprisingly, uses right-handed coordinates like sane people (note: game engine developers have never exactly been known to be sane). Unity uses left-handed. I'll fix this once I have all the other physical stuff (animations, etc) done.

    Coming Soonish Or Whenever

    * More shader support
    * Animations and more complete skeleton rigging
    * Model Exporting
    * A toggle to enable basic lighting/shading/shadows
    * Other stuff
    * A title that has half an ounce of creativity

    Etc

    While I did have to basically discover a bunch of info regarding the CGFX format for myself with the somewhat sparse) existing 3dbrew.org docs as a base, Gericom helped me out a bit too. A few of the data structures used in the source code (specifically MTOB and skeleton data) were basically ported from EveryFileExplorer. Props to Gericom for being generally pretty awesome.
     


  2. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    Margen67 likes this.
  3. Asia81

    Asia81 In my Ecchi World <3

    Member
    4,953
    2,444
    Nov 15, 2014
    France
    Albi
  4. SciresM

    SciresM GBAtemp Advanced Fan

    Member
    564
    1,655
    Mar 21, 2014
    United States
    Works perfectly with the Pokemon Mystery Dungeon: Gates to Infinity models. Awesome work!

    Warning: Spoilers inside!
     
    Margen67 likes this.
  5. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    Usage is pretty simple (keep in mind, it's just a viewer for now, more functionality will be coming soon):

    [​IMG]

    Just drag the file you want to view onto the exe and it will open them automatically.
     
    yuyuyup likes this.
  6. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    So I remembered that Unity can build for multiple platforms.

    I don't have a Mac or Linux system, so I have no way of testing this, but adventurous users can try the build I just uploaded and see if it does anything more than crash horribly. =)

    Link to Mac/Linux versions added to Downloads.

    For some reason, the Linux build is several orders of magnitude larger than the others. I have no idea what it's cramming in there.
     
    Margen67 and hippy dave like this.
  7. Hiccup

    Hiccup GBAtemp Advanced Fan

    Member
    905
    271
    Nov 21, 2009
    So is this better than the EFE viewer? :P
     
  8. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    At this one very specific task? In my tests thus far, yes.

    [screenshot outdated, removed]

    It's also kinda slow and a pain to move the camera, perhaps due to the graphics framework in use.

    EFE does a heck of a lot more than just view 3d models though =P
     
  9. yuyuyup

    yuyuyup GBAtemp Psycho!

    Member
    3,336
    773
    Apr 30, 2006
    United States
    USA MTN timezone
    please make for oculus rift dk2 compatible
     
    Margen67 likes this.
  10. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    hah. I've actually thought about doing that. I have a rift DK1 myself. I'll play with it a bit tonight and see how hard that'll be.
     
    Margen67 likes this.
  11. Gericom

    Gericom GBAtemp Advanced Fan

    Member
    851
    897
    Jun 30, 2011
    Netherlands
    Could you send me that model?
     
  12. I pwned U!

    I pwned U! GBAtemp Advanced Fan

    Member
    833
    1,117
    Jun 14, 2013
    United States
    I hope that there will soon be a way to view, extract, and replace the .cgfx files in the Mario & Luigi Dream Team .dat files.
     
    Margen67 likes this.
  13. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    Certainly. Have a few I can PM you.
     
  14. Hiccup

    Hiccup GBAtemp Advanced Fan

    Member
    905
    271
    Nov 21, 2009
    planetarian

    Would you mind if Gericom used your source code for EFE's model viewer?

    (I don't know if he wants to use it though :P)
     
  15. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    His CGFX library is far more complete than mine in general (actually I learned a few things from his!), so that would be somewhat counterproductive.
    Both apps are very much in beta stages, and what doesn't work in one will be fixed in due time, no doubt.

    As for the viewers themselves, that wouldn't really work too well anyway given that mine was built in Unity, which can't really be incorporated into other apps to my knowledge. If he decides he's not happy with the viewer he's got in place now, I'm sure he could find much more streamlined alternatives than bundling a Unity package =p
     
    Hiccup likes this.
  16. Grendor

    Grendor Newbie

    Newcomer
    9
    3
    Mar 22, 2010
    United States
    I know this is a horrid necropost probably, but this really caught my interest in the fact it can actually view Mario and Luigi: Dream Team models correctly, albeit without textures. It's the only viewer I've seen that can do that. However it has no export function or way to capture the model. Is there any way we could have that feature at some point in the near future? I've been trying to grab Luigi's model for a long time now and EFE doesn't export it properly or even view it at all.
     
    I pwned U! likes this.
  17. Hiccup

    Hiccup GBAtemp Advanced Fan

    Member
    905
    271
    Nov 21, 2009
    There is software that can capture 3D from open programs. You could also try cgfx2obj if you have not. Gericom would probbably appreciate you sending him non-working models so he can work on improving the viewing.
     
  18. Gericom

    Gericom GBAtemp Advanced Fan

    Member
    851
    897
    Jun 30, 2011
    Netherlands
    Yes, I do.
     
  19. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    EFE has quite functional model exporting already, while it hasn't yet been a major priority for me, so I agree with the above -- if models aren't working in EFE, let Gericom know so he can take care of the issue.


    As a sidenote, I've been doing some work on refactoring the codebase, which is largely why this thread has been silent for a bit. Also, I've wanted to take up implementing Oculus Rift support Just Because, but apparently the latest preview build of Windows 10 that I'm running broke the Rift driver. derp!
     
    I pwned U! likes this.
  20. planetarian
    OP

    planetarian GBAtemp Regular

    Member
    133
    145
    Aug 5, 2014
    United States
    Could I get this thread moved to the Utilities subforum? Not sure how it ended up in Flashcards/Firmwares. :huh:
     
    Margen67 and Hiccup like this.