Upscaling

SueseSuese Posts: 120Member
Does anyone know how to force an android app to render at a lower resolution?

As it stands I can't seem to get a great frame-rate out of 1080p,  I want my game to render at say a quarter the resolution while still being full-screen.

I'm not too familiar with the Android Manifest options,  so I was wondering if anyone here has a clue what I can do?


TheSuese.com - Elite Developer Backer

Comments

  • SueseSuese Posts: 120Member
    edited January 2013
    I can get the resolution to approximately half,  but it's still not what I want.

    <supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="false" android:anyDensity="false" android:largestWidthLimitDp="320"/>

    though setting android:largestWidthLimitDp = anything produced the same result.  I was hoping setting it to 160 or 80 would solve my problem to no avail.

    Ideally I want to just specify a target resolution like so:

    target_width = 480
    target_height = 270

    Now I'm using AIR,  so a Java solution is out of the question,  and a software-scaling solution produces a very slow result.   I assume the OUYA is capable of hardware up-scaling, but I just can't get it to do it except in the half size scenario mentioned above.

    Any insight would be greatly appreciated.
    Post edited by Suese on
    TheSuese.com - Elite Developer Backer
  • MagnesusMagnesus Posts: 304Member
    Are you using OpenGL?

  • SueseSuese Posts: 120Member
    Adobe AIR, Stage3D as mentioned.

    I'm on several forums looking for a solution to this seemingly simple problem:
    Away3D
    Stage3D
    Adobe AIR
    Android Manifest

    Android documents seem to be philosophically rule out the possibility of up scaling.  They all say things like "it's so wrong, you shouldn't,  it's bad for the environment,  they will kill a puppy if you ask about this, etc"
    TheSuese.com - Elite Developer Backer
  • SueseSuese Posts: 120Member
    edited January 2013
    The closest thing I could find are the manifest settings that some-how produced a sort-of half resolution effect,  but I can't reproduce the effect anymore.   Android official documentation seems to suggest upscaling is like a taboo beyond taboo.
    Post edited by Suese on
    TheSuese.com - Elite Developer Backer
  • SueseSuese Posts: 120Member
    The OpenGL method I've seen glSetFixed or something to that effect is also not a good solution even if I was using Java + GL ES because it produces a blurry effect.  
    TheSuese.com - Elite Developer Backer
  • mjoynermjoyner Posts: 168Member
    You have to set your "stage" to your desired working with size, then you set your view on the stage to zoom it. Don't know Adobe AIR, but this is what is done in libGDX:

    I am coding using 720p as my target, and all my stuff is properly scaled when outputing at 1080p:

    (CODE FRAGMENTS)

    on my game screen creation I do:

    stageSize=DisplaySize._720p.size();
    gameStage=new StageBase(stageSize.w, stageSize.h, false);

    when my game gets the reported screen size:

    @Override
        public void resize(int width, int height) {
            float scale_h;
            float scale;
            float newWidth;
            float newHeight;

            /*
             * http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=3422
             */
            scale = (float) stageSize.w / (float) width;
            scale_h = (float) stageSize.h / (float) height;

            if (scale_h > scale) {
                scale = scale_h;
            }
           
            newWidth = (float) Math.ceil(scale * width);
            newHeight = (float) Math.ceil(scale * height);

            if (isDebug()) {
                System.out.println("=============================");
                System.out.println("scale: " + scale);
                System.out.println("Width: " + newWidth + ", Height: " + newHeight);
                System.out.println("=============================");
            }
            gameStage.getCamera().viewportHeight = newHeight;
            gameStage.getCamera().viewportWidth = newWidth;
            gameStage.getCamera().position.set(stageSize.w / 2, stageSize.h / 2, 0);

        }
  • SueseSuese Posts: 120Member
    @mjoyner  ;how did you set 720p as the target??
    Is this something you can set in the Android Manifest file.

    I appreciate the code snippet,  but like I said I'm using Adobe AIR, not Java.
    TheSuese.com - Elite Developer Backer
  • mjoynermjoyner Posts: 168Member
    I set my graphics stage to be 720p sized.
    I then set my camera to scale to whatever is reported as the display size.
  • rocketbunnyrocketbunny Posts: 46Member
    It's pretty easy if you are using Starling.  Make sure you check for the resize event, then set Starlings current viewport to the new application stage width and hight.  Then set Starlings stage to the width and height that you want to render to.  Starling will then upscale from its stage size to the viewport size.

    If you aren't using Starling, you can do it with similar Stage3D properties.
    Robert Crane
    CEO, Rocket Bunny Games
  • SueseSuese Posts: 120Member
    How do you suggest I do it with Stage3D properties?
    TheSuese.com - Elite Developer Backer
  • rocketbunnyrocketbunny Posts: 46Member
    Have a look at how Starling does it.  You can download their source code from GitHub.  I found Starling's code to be very easy to read.
    Robert Crane
    CEO, Rocket Bunny Games
  • SueseSuese Posts: 120Member
    Thanks.  My PC died and so I purchased a windows PC online.  (was on Linux) 

    I'm finding all these flash libraries,  away3D, Minko, Flare3D are either too expensive or have the worlds worst support and documentation.  I'm going to give Unity a try. 

    I'm surprised how many years we've had 3D computing and how little the open source community has to offer in terms of support.   I have a lot of reservations about going the proprietary route,  but it Unity seems so well supported, the range of games and genres seems extensive, and my progress using these poorly constructed and even more poorly supported frameworks and libraries has been slow.
    TheSuese.com - Elite Developer Backer
  • Killa_MaakiKilla_Maaki Posts: 504Member
    Yep, I've tried in the past to use these 3D flash libraries, as well as using XNA, and to some extent a little bit of DirectX.
    And then I tried Unity. Been in love ever since.
    The thing about those libraries is that even if you can wrap your head around the rendering engine (which can be a challenge all by itself), you still then need to create some kind of GUI framework, particle systems, animations, level formats and editors, physics engines, audio, multiplayer, input, etc etc
    You still have to build an entire game engine on top of the rendering engine, which is not trivial and the result isn't going to be anywhere near as fully featured as engines such as Unity.
    I would highly recommend going with Unity. If you can't afford the price of Pro (for Android Pro that's a grand total of $3,000) you can start developing the core features of your game now on Unity Free, and then later you can create some kind of funding campaign (Kickstart or IndieGoGo perhaps) to purchase a Unity Pro / Android Pro license, as well as a few extra plugins (I highly suggest purchasing NGUI for your game HUD, it's far far better and more efficient than the built-in GUI), because the end result is worth every penny. It's pretty well optimized, too, and you get get some fairly badass graphics even for an OUYA game - it's got Beast lightmapping, light probes, occlusion culling, etc - a hell of a lot more than any of those flash engines offer.
    You didn't remember the plot of the Doctor Who movie because there was none; Just a bunch of plot holes strung together.
  • SueseSuese Posts: 120Member
    Yes,  Unity is great.

    I've been learning Unity.   After taking a day to learn the fundamentals of Blender and Unity,  it took me only a few hours to make a break-out clone using the unity physics engine.   I'm quite pleased with the rapid results.  

    The amount of support online is great.  Every question I could possibly have has already been answered several times.   I'm also quite surprised at how light-weight and feature rich it is.  

    I did not expect it to be so light-weight and stable.




    TheSuese.com - Elite Developer Backer
  • juakobjuakob Posts: 1Member
    Dont know if you solve the problem, but for future reference

    mStarling = new Starling(Simulation, stage);
    mStarling.stage.stageWidth  = 720;
    mStarling.stage.stageHeight = 480;
    mStarling.viewPort.width = 1920;
    mStarling.viewPort.height = 1080;

    You cant tell air to upscale the content, because stage3d layer cant be scale, you have to tell stage3d the area you want to use. You then can render to a 720x480 texture and then upscale that to fill the 1920x1080. If you are using starling just use that code.


Sign In or Register to comment.