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
2
Question by x4000 · Oct 23, 2012 at 11:44 PM · 2drendertextureorthographic

How to use a non-screen-sized RenderTexture?

It is obviously quite trivial to create a non-screen-sized RenderTexture in unity pro. However, the problem that I have is that when I render to it using either Graphics.DrawTexture or Graphics.DrawMeshNow, I wind up with scaling based on the (presumably) transforms of the current camera.

For instance, if my RenderTexture is 1024px wide, but my screen is 2048px wide, then any content that I render to the RenderTexture gets smashed in width by half. Something that should have been rendering into a square of 0,0,64,64 would instead render as 0,0,32,64 assuming that the height of the texture and screen were the same.

Added details:

  • This is for 2D games, so I'm using an orthographic camera and am rendering essentially just textured quads.

  • I am able to correct for the incorrect scaling by simply scaling the object back up by screenwidth divided by texturewidth. However, that's not really ideal for anything except shadows because it causes blurring and is not remotely pixel-perfect like other draws.

It seems like this should be simple. What am I missing?

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 sockpuppet · Feb 08, 2013 at 12:09 PM 0
Share

I've got the same issue - did you find a better solution than scaling?

avatar image x4000 · Feb 08, 2013 at 12:24 PM 0
Share

Nope, never did find an answer to this one other than scaling -- which definitely leaves lots of artifacting. However, what you can do is render a screen-sized texture and then just have a lot of transparent pixels to work around the problem.

1 Reply

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

Answer by cmberryau · Sep 03, 2013 at 08:34 AM

I had a similar problem where all created rendertextures would inherit the AR of the main camera - this was fixed by changing the aspect property to 1 (our rendertextures were all square).

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 Fattie · Apr 07, 2014 at 05:03 AM 0
Share

great call on .aspect, huge timesaver

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

14 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

Related Questions

Why is part of object outside camera frustum visible? 1 Answer

Keeping two objects in frame 1 Answer

Texture alignment 0 Answers

How can I find out a ViewportToWorldPoint position with a different orthographic size? 1 Answer

Position 3d objects in 2d space (orthographic cam) 1 Answer


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