Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by ChipMan · Mar 06, 2015 at 11:58 AM · gameresolutionscreen resolution

Is it possible to make unity's camera render in chunky pixels?

Hi there all! This is my first question so I hope it won't suck but here it goes...

I was wondering if there is a way to instead of down-sampling, can you in fact, Up-sample the game? it would be very helpful indeed, because I'm making a game where it needs to look like a old 1990s game.

Thanks for taking the time to reply! I love it! :D

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Cherno · Mar 06, 2015 at 01:43 PM

Thanks to tanoshimi's answer I created my own pixelizer, pretty easy.

Create a new RenderTexture and set it's width and height to 256x256 or whatever you want (has to be Power of Two, though!)

Drag this texture to your camera's target texture field.

Add this script to the camera:

 using UnityEngine;
 using System.Collections;
 
 public class Pixelation : MonoBehaviour {
 
     public RenderTexture renderTexture;
 
     void Start() {
         int realRatio = Mathf.RoundToInt(Screen.width / Screen.height);
         renderTexture.width = NearestSuperiorPowerOf2(Mathf.RoundToInt(renderTexture.width * realRatio));
         Debug.Log("(Pixelation)(Start)renderTexture.width: " + renderTexture.width);
     }
 
     void OnGUI() {
         GUI.depth = 20;
         GUI.DrawTexture(new Rect(0,0, Screen.width, Screen.height), renderTexture);
     }
 
     int NearestSuperiorPowerOf2( int n ) {
         return (int) Mathf.Pow( 2, Mathf.Ceil( Mathf.Log( n ) / Mathf.Log( 2 ) ) );
     } 
 }
 

Drag the Render Texture to the script's renderTexture field.

Hit play and watch in amazement ;)

Note that if you update the renderTexture's width and height every frame, you performance takes a big hit, so I oly do it once in Start().

Comment
Add comment · Show 4 · 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 ChipMan · Mar 06, 2015 at 09:24 PM 0
Share

Thanks mate ;)

avatar image Noxury · Jun 02, 2016 at 10:42 AM 0
Share

@Cherno Thank you, but now my ui elements on the canvas are invisible, but they work. Strange..

avatar image Cherno Noxury · Jun 02, 2016 at 01:34 PM 0
Share

Never tested it with the new UI system. $$anonymous$$aybe you could just render the UI elements with a second camera?

avatar image Noxury Cherno · Jun 04, 2016 at 05:03 PM 0
Share

No, I have tried all that. This is a bug: http://forum.unity3d.com/threads/render-a-canvas-to-rendertexture.272754/

avatar image
2

Answer by tanoshimi · Mar 06, 2015 at 11:59 AM

You mean like at http://shambles.notch.net/ ?

Sure - render the output of your main camera to a low-resolution RenderTexture (say, 320x240), and then scale that rendertexture up to fill the screen - that's how Notch did it.

Comment
Add comment · Show 4 · 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 meat5000 ♦ · Mar 06, 2015 at 12:16 PM 0
Share

Wow 7 days? I was impressed until I played it :P

avatar image ChipMan · Mar 06, 2015 at 09:23 PM 0
Share

Notch used unity????

avatar image tanoshimi ChipMan · Jun 02, 2016 at 05:05 PM 0
Share

Yes.

.

avatar image Triggerly tanoshimi · Jan 05, 2020 at 02:42 AM 0
Share

lol

.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Android OS message on app start. 2 Answers

How can i make my game matching all Android Mobile Screen? 2 Answers

getting udp package info inside unity (GlovePIE) 0 Answers

Who to make the game more fast and with better resolution? 1 Answer

Game window is broken 3 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