Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ivarhill · Apr 22, 2019 at 05:29 AM · cameraperformanceoptimizationresolutionrendertexture

Best way to render viewport at lower resolution for performance?

I'm targeting Android and iOS and am trying to figure out a good way to have the camera viewport render at a lower resolution than the game overall - mainly to boost performance but also to give the game a retro, pixelated look. I want to only reduce the resolution of the camera viewport and not the whole game, since I need the UI to remain sharp (and I would also not be able to do point resampling and it would look blurry rather than pixelated).


Currently I do this using a render texture - I deactivate the Camera component of the main camera and use a second camera to render the actual scene, which I attach this script to:

https://pastebin.com/4NQjWc0v

Visually this works reasonably well. However, it does not seem to actually have much performance impact whatsoever. On a low-end device which is struggling with framerate, I get 11 FPS when the factor is 1 (i.e. it's not downsampling at all, just drawing at native resolution), and 14FPS when the factor is 0.25 (i.e. it's supposed to render at a quarter of native res). Unless I have a huge bottleneck somewhere else this doesn't seem right, since a quarter of native res should be making an enormous performance difference.


Is it actually rendering at full res and then just downscaling? That would obviously defeat the purpose - is there a better way to do this than what I set up?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DiegoSLTS · Apr 22, 2019 at 11:18 AM 0
Share

Did you check the profiler? You can attach it to the running Android app. That'll tell you if you have a bottleneck somewhere, you shouldn't be guessing when it comes to performance.

As for how rendering to texture work, I'm not sure the exact implementation, but it probably just renders it at the desired resolution. If it where rendering at native and then downscaling you would get worse FPS (more code running to downscale), but you see an improvement.

avatar image ivarhill DiegoSLTS · Apr 22, 2019 at 02:49 PM 0
Share

I have indeed been monitoring the profiler attached to the Android app - details here: https://answers.unity.com/questions/1624567/extremely-poor-android-performance-even-in-simple.html

I have since been able to improve things somewhat by more aggressive optimization in many places but the core issue still remains.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Apr 22, 2019 at 03:04 PM

It just means the reason for your bad performance is not the fragment shader of your objects. Everything else is still the same when you render at different resolutions. Older / low end devices supported only a few draw calls (keeping it below 10 was necessary for some devices). So on most mobile devices the actual bottleneck is the bridge between CPU and GPU. The GPU itself isn't that bad.


What shader(s) do you actually use? The Standard shader isn't suited for mobile, let alone old devices.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ivarhill · Apr 22, 2019 at 03:11 PM 0
Share

Thanks for the reply!

I currently use five shaders-

  • $$anonymous$$obile / Diffuse (for realtime/moving objects)

  • $$anonymous$$obile / Vertex Lit (for the vast majority of objects, all lit by a lightmap)

  • $$anonymous$$obile / Particles Additive and $$anonymous$$obile / Particles Alpha Blend (for particles/effects)

  • Custom / Emission (for objects that should appear to emit light)

The Custom / Emission shader is built upon the Legacy / Diffuse one so it shouldn't be causing too many issues (if I disable it entirely it doesn't have a performance impact, anyway).

All this being said, while I stick to the $$anonymous$$obile shaders I do have quite a few materials - around 15 for objects that'll always be in the game, then another 15 or so that only sometimes get used.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

187 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Best way to convert particles and sprites in a single sprite at runTime 1 Answer

ReadPixels Performance 0 Answers

First Person Camera Pixelation 1 Answer

Check if mouse is over GUI element using Rendertexture? 1 Answer

Extremely poor Android performance, even in simple scenes 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges