Polyviewer, a model viewer for android

13
Keg
polycounter lvl 12
Offline / Send Message
Keg polycounter lvl 12
After playing around with some live wallpaper stuff, I decided to re-use the code I have in a fashion that's potentially usable to polycounters and other artists out there. So with that in mind I've put together a model viewing application for displaying real-time models on your android phone or tablet.

The current features are as listed:
  • Blinn-phong specular model with fresnel
  • Up to 3 lights supported (needs to be updated to save presets)
  • Emissive and Transparency support
  • Diffuse, Specular, Normal and Emissive png or jpg's supported
  • Toggle enabled texturesd
  • Wireframe display mode
  • Fullbright display of a single texture
  • Multiple models
  • Live wallpaper mode with various viewing options
Future plans include:
  • faster model loading
  • light and camera presets
  • free/paid versions on the marketplace
  • gallery mode (basically swipe left/right to view different models)
Preview Image: (click for an imgur album)

YuFVq.png

Beta Version 11 Release

Installation Instructions: place the polyviewer folder within your data directory on your android phone or in the root directory on your microSD. Installing the apk requires browsing to it where you have placed it and installing it from your phone (you may have to allow for installation of unknown sources).

Models must be in obj format. Textures have to use the naming convention of the obj model name and contain diffuse, specular, normal or emissive in the name. To use alpha channels, you have to save the textures out as pre-multiplied alphas (limitation of android) if you wish to use transparency.

The diffuse map alpha is used for transparency and the specular alpha is used as the roughness value for the specular (between 0 and 255 currently).

Multiple models can be placed into a folder and will be loaded and displayed as a single scene. each model and it's textures should be unique.

This has been tested and runs smoothly on my galaxy s2. I DO NOT GUARANTEE this will run smoothly if at all. This is a test release so I can hopefully get more feedback on performance and other issues. Feel free to leave any feedback or comments. I am also looking for perhaps a couple test environments to build some more stuff into the live wallpaper.

Edit: updated the to the 11th revision.

Replies

  • metalliandy
    Offline / Send Message
    metalliandy greentooth
    Wow, nice work, man! I would love to test, but I'm on an iPhone. Great work though!
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Wow, nice work, man! I would love to test, but I'm on an iPhone. Great work though!

    Thanks, I hope to have access to some apple hardware at some point so I can port the app over to iOS.
  • Xenobond
    Offline / Send Message
    Xenobond polycounter lvl 13
    doh! I get to the front screen (Model/Help/Options).
    Selecting any of them gives me a force close.
    HTC Evo 3D
  • Swizzle
    Offline / Send Message
    Swizzle polycounter lvl 11
    Awesome! I'll check this out when I get home and report back.
  • BenHenry
    Offline / Send Message
    BenHenry polycounter lvl 7
    I also have an iPhone, would love to see a iPad version too.
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Xeno - Damn, I'm going to release an updated version before too long that includes some logging so I can get some useful debugging info. Feeling sorta stupid for not thinking of that before releasing.

    BenHenry - An iOS version would be nice. It's a matter of being unemployed and the cost barrier for development for apple products is slightly excessive at the moment.
  • iWeReZ
    Brilliant idea! ive spent ages looking for a simple app like this. i hope you keep up with it :D right now it doesnt work for me, Also an S2 user and i get a force close at the main menu :(
  • LoTekK
    Offline / Send Message
    LoTekK polycounter lvl 12
    Ah, I'm force closing as well; same deal as Xeno, tapping any of the buttons on the frontend crashes the thing.
    Running Gingerbread on an HTC Desire HD
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Updated with a new beta version. If there's an exception it should attempt to save a file with the details to the android/data/com.fusedresistance.polyviewer sub directory of your device.

    I can't say 100% certain this works as I am having trouble making the app crash on my phone. Either way, I suspect it was due to how I am doing a search of the directories for available models. Hopefully the options and help pages will show up properly without crashing.

    Any log details and such can be emailed to polyviewer at gmail dot com and I'll try to respond within a timely manner.
  • LoTekK
    Offline / Send Message
    LoTekK polycounter lvl 12
    I was able to get the Help and Options screens up, but tapping on Model does nothing... No crash, though, so I don't have any log file to send in.
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Lotekk, did you check the folder? I tossed a try/catch statement around what I think is the problem area so the file may be there. And because of the try/catch it won't crash the app but will return before it attempts to do anything.
  • skankerzero
    I want to try this!

    galaxy nexus here!
  • innisfree
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Ignore the bit about the log file, that stuff isn't working at all. Been somewhat out of it most of the day thanks to a bad shoulder so I'm not thinking straight on all things.

    The release is bugged, which I am glad I am finding out now before I putting it on google play. I'm going to work on things tomorrow and hopefully figure out the problem when it comes to searching for the correct directories as that's where the crash seems to currently be occurring for everyone.
  • Mio
    Offline / Send Message
    Mio polycounter lvl 13
    LoTekK wrote: »
    I was able to get the Help and Options screens up, but tapping on Model does nothing... No crash, though, so I don't have any log file to send in.



    same here :(


    Moto Defy, android 2.3
  • LoTekK
    Offline / Send Message
    LoTekK polycounter lvl 12
    Ignore the bit about the log file, that stuff isn't working at all
    I thought I was going blind for a while there, as I hunted for the folder :D Hope the shoulder gets better, and looking forward to the update ^^
  • Pampers
    Looking forward for an update, got the same problem a few other have had, not being able to tap the Model button :)
  • Crash
  • mystichobo
    Offline / Send Message
    mystichobo polycounter lvl 8
    Pampers wrote: »
    Looking forward for an update, got the same problem a few other have had, not being able to tap the Model button :)

    Same, tried putting it on both my primary and external sdcard

    to confirm, it's looking for the folder in /sdcard/polyviewer right?

    EDIT: does anyone have the old apk?
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Feeling like a bit of an idiot, was checking to see if write access to external storage was available as well as read access and that requires additional permissions.

    I have hopefully fixed things and have uploaded a new version here
  • mystichobo
    Offline / Send Message
    mystichobo polycounter lvl 8
    Well this one actually let's you hit the button!

    Both on my nexus and iconia tablet it fails to find the files though. Again, which directory is it searching for? I couldn't really see anything in the logcat I grabbed.

    I'm happy to do any testing if you want, have a couple of meshes set up, both a gnex and a tablet and a half decent understanding of android on a system level.

    Edit: I just want to say thanks for this too, I'm looking for work at the moment and IMO it would be great to be able to show models on my tablet, instead of just screenshots from marmoset or whatever.
  • hellbender
    I Actually tried this too and indeed it fails to find models and textures. I have Galaxy Note with a custom ICS rom. I put the folder both in the internal SD and the external one, no luck. It could help to be able to set up the lookup path inside the options tab.
  • tobehfaic
    Offline / Send Message
    tobehfaic polycounter lvl 7
    Just tested this (beta 3) out on a HTC One S with ICS (Android 4.0) and still has issues finding the files.

    The polyviewer folder is in /sdcard as required. Here's hoping you crack the problem.
  • Fingus
    Offline / Send Message
    Fingus polycounter lvl 9
    Tried to install it on an HTC Desire S, running v2.3.5 (Gingerbread).

    Same problem that others seem to have. Upon clicking the Model button I get a "Failed to find files." error, and when I click on the error message it seems to try to load models and textures but then crashes. I installed it on my SDcard.
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Fingus, yea. that was some early morning not awake coding.

    For the external sd card, I'm probably going to need some info since right now it's searching for the polyviewer folder within either the "external_sd" or the "data" directory from the base directory when using a file explorer. Not sure if some folks have their external sd card folder named as something like "sdcard".

    Edit: to be clear, within the drive format the program currently searches for mnt/sdcard/data/polyviewer or mnt/sdcard/external_sd/polyviewer
  • hellbender
    Tried the mnt/sdcard/data/polyviewer path by creating a data folder inside my sdcard root and copying polyviewer folder into it. Still no luck.
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    hmmm, well I've uploaded a small update that produces a toast message for errors regarding searching for directories.

    Beta version 4 Release

    Nothing changed other than a toast message stating if the program cannot find either directory or unable to read from external storage.
  • Fingus
    Offline / Send Message
    Fingus polycounter lvl 9
    Now it just crashes without any error message. :/

    Does the location of the APK matter at all?
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Fingus, not good. I'll try and get things working. location of the apk doesn't matter since it's installed by andoid to it's own place.

    Couple questions:
    • When plugged into a computer, what drives appear for access?
    • If browsing the android file structure from your phone is there an external_sd, sdcard, microsd or a directory that would represent a removable micro sd card? (file browsers are easy to find on the marketplace if needed)
    This is turning out to be something to be more of a headache than I originally thought. Turns out manufacturers and google can't settle on ways to keep a consistent naming structure and layout for things.


    I'm going to hold off on more releases here until I've sorted out this bug some more. If you'd like to get updated versions, feel free to send an email to polyviewer at gmail dot com preferably with your forum name as well and I'll send out emails with new test builds.
  • Fingus
    Offline / Send Message
    Fingus polycounter lvl 9
    When I plug in my phone I get access to only the sdcard. If it's any help I have to go into the settings and change the connection type from Charge Only to Disk Drive. I don
  • Pampers
    Downloaded the latest version, and this is what I get now:
    GxDkk.png
    this is the toast message you mentioned?

    I'm on a galaxy s2 :)
  • Khiro
    I´m on a Sony Xperia S and I get this error:

    "Unable to access: local storage external storage"
  • Andrew Mackie
    This is a concept that I have been looking forward to for a long time. I have 'ModelView' currently on my phone and it's okay, but it doesn't support lights, normals, or any maps for that matter. I'll be testing this out as soon as I can and give CC when I can.
    Thanks for creating this man!
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Pampers, that's not a toast message, that's more it never found any models or directories. A toast message is a little notification that pops up at the bottom of the screen and disappears on it's own after a short time.

    Khiro, Yea I'm working on fixing things. the current version is broken and being worked on.

    I'm going to be doing some testing and coding today. I am hoping to get a release out tonight that hopefully works for people.
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Beta 6 Release Version with an additional model (credit goes to Crash for the model) that demonstrates the available render features better.

    Changes:
    • searches mnt/sdcard/polyviewer, mnt/sdcard/data/polyviewer and mnt/sdcard/external_sd/polyviewer (external_sd = micro sd card slot and it seemingly varies from manufacturer so if you have a micro sd, please inform me of it's location within internal android memory)
    • on first load of a new model, each is saved in a binary format for faster re-loads so that initial load may be slower. (needs some proper testing to verify the integrity of this working.
    • Fixes so the shaders compile on tegra 2 devices. Can't test on other devices.
    That's mostly what I've been up to when I've had the time to work on the code. There remains a bug with the live wallpaper option that requires fixing. Basically it crashes when first created, but runs fine after that.

    I have a bunch of features I plan on adding down the road which include:
    • Object Selection as a button overlay
    • Replace the colour picker with an rgb slider setup (perhaps with HSL as an option)
    • Free and Paid versions on the app store.
    • Environment maps
    • Cloud drive support (dropbox, google drive, etc)
    • Light and Camera presets
    • Slight layout redesign (move options, help etc to a side bar menu setup ala google+)
    • Lower quality shader support for those in need of some performance
    I've not decided fully yet on how I plan on splitting the paid and free versions. My current plans are to include a gallery mode, and limit emissive and reflective to the paid versions among a couple other features. I'm wanting to make sure even the free versions is more than adequate for users to show their portfolio work.

    *PS yes, there is a live wallpaper option and that will get some tweaks and improvements as well.
  • LoTekK
    Offline / Send Message
    LoTekK polycounter lvl 12
    Right, so far it's somewhat working on my Desire HD (w/Gingerbread). Got the example models loaded, but there's no apparent lighting (I've checked that the brightness settings in options are ok; at default of 100). Also, framerate is pretty much unusable; I get a frame update maybe every 2-5 seconds.

    Not sure if it's a hardware compatibility issue, but as ballpark reference, Reckless Racing runs just about flawlessly.
  • hellbender
    Keg, did you wrote the shaders for Tegra 2 Only ?
  • Tigerfeet
    Offline / Send Message
    Tigerfeet Polycount Sponsor
    Version 6 is working for me similarly to how it's working for LoTekK. I'm on an LG Optimus Slider. When I turn off all the bells and whistles and just view the diffuse texture on full bright though everything runs smoothly. I'm going to try importing my own models tonight after work.
  • Pampers
    Works for me now, framerate is good, and the models that comes with the app works fine. However when I try to load in my own model, the textures won't work.
    zZZsq.jpg
    dunno if I'm doing anything wrong?
  • mystichobo
    Offline / Send Message
    mystichobo polycounter lvl 8
    Screenshopolyviewer.jpg

    Works fairly well for me :)

    Having a few issues with some alpha mapped planes (they aren't showing up), but I'll talk to you about that next time you're on irc.

    Looking forward to multiple lights too :)
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    I'm glad it's finding models and loading on more peoples hardware. Still plenty to fix, but I appreciate everyone taking the time to test and report back their findings.

    Lotekk, Tigerfeet - damn don't like hearing that. possible to go into the options and tell me if limiting the fps helps performance? default is render as fast as possible, which might be causing issues.

    hellbender, I have a galaxy s2. I just had to tweak the shader code to work with tegra chipsets. The shader code should work on most hardware now. I only have access to an asus transformer and my galaxy s2 phone so testing can be limited.

    Pampers, weird. not sure what could be causing that. perhaps try using jpg's to see if that works instead of the png's? you won't have alphas but that might narrow down the issue.

    Mystichobo, looking good. multiple lights are available. just somewhat clunky with selection and property values hidden in the menu. going to be replaced with an overlay system so the object selection and light options will be visible on screen and not hidden away.
  • LoTekK
    Offline / Send Message
    LoTekK polycounter lvl 12
    Limiting FPS didn't help framerate, and there's still the issue with seeing a black model (no lighting). I tried what Tigerfeet did, though, and switched to fullbright, and that restored my framerate.
  • Pampers
    Seems like there were another .obj file in the same directory causing the missing textures, the file didn't show up in explorer at first. I've had the same problem earlier with files stored on the phone not showing up in windows explorer. Anyway all working fine now, would be nice with some light setup presets or some way to store light setups :)
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Lotekk, hmmm damn. I'm going to have to do some more digging about. Have you tried just disabling specular? I have a feeling that might be the root of the issue.

    Pampers, Good to hear that it's working for you. I am currently working on overlay controls for camera/light selection as well as light controls and fps display. Here's an old preview. I've since reduced the size of the icons a bit.

    overlay_test.png
  • Tigerfeet
    Offline / Send Message
    Tigerfeet Polycount Sponsor
    Limiting FPS didn't help I'm afraid, neither did disabling any of the options. There's crushing lag with any setting other than Full Bright.

    When I try to load in my own mesh I get the following message: Sorry! The application Polyviewer (process com.fusedresistance.polyviewer) has stopped unexpectedly. Please try again.

    I noticed that in the files that came with the program there's a .pvb file along with the .obj. Is that a file I also need? I looked through google but couldn't find and/or didn't understand what kind of a file type it is.
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    The pvb files are created by the program first time a mesh is loaded. It's essentially a binary format with the name standing for polyviewer binary.

    The fps issue I'm going to have to look into. I'm working on some bugs within the overlay code and I plan on a new release before long.
  • Keg
    Offline / Send Message
    Keg polycounter lvl 12
    Beta Version 7 Release

    What's new:
    • New overlay controls for camera/light selection
    • FPS display
    • Fullscreen mode with all options hidden in the menu
    I also disabled alpha blending. I don't suspect that's part of the performance issues, but it's something I think it is work checking in helping to eliminate causes of the performance issues some folks are having. I've noticed a few discussions on the fill rate being killed with alpha blending enabled on some phones.

    I have also tossed in place holders for camera and light presets. I am going to start putting together some presets and hopefully release this update available tomorrow.
  • Khiro
    I have try de the new beta 7 with the same results as beta 6. Now with a Xperia S I can load the model, but it´s render as a black siloutte with no lights and no textures. Also the frame rate y something like 1-2 FPS :P

    Is it necesary Tegra or something like that?
  • Flynny
    Offline / Send Message
    Flynny polycounter lvl 9
    Just tried beta 7, it works on my sony xperia s!
    Just at about 0.3fps

    I can see this being a great little tool/viewer ;) keep up the good work!
  • c22dunbar
    Anyone else having problems on MotoDefy and/or CM7.2?

    I can run the application but when i pick any model from the list it says loading models and textures and instantly crashes.
13
Sign In or Register to comment.