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 Catlard · Jan 28, 2013 at 02:34 AM · c#camerarendertexturebook

Rendertexture + Normalized View Rect.

I'm using render textures to make it appear as though my user is drawing on the pages of a book. Essentially, the page texture of the book comes from a render texture, so my user can draw on it in real time (though the pen marks are really just being "videotaped" on another camera and sent to the page's texture, and then when the page turns (using the megafier deformers from the asset store), the drawing deforms with the page (yay!). But that's not the important, troubling thing -- that's just context.

The PROBLEM at the moment is that I can't seem to resize the camera's normalized view rect and have it display properly. That is, currently, the objects that the render texture is viewing are stretched out to fit the viewing area of the camera. This causes everything else that isn't stretched I put in front of that camera to look squished. Here are some screenshots of what's happening/going wrong. Let me know if you need higher res.

What do you think? How can I stop my camera from pulling these weird tricks?

Cheers,

Simon

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
1
Best Answer

Answer by Catlard · Feb 17, 2013 at 03:47 PM

Figured it out. I needed to mess with the tiling and offset on the materials of the rendertextures. Silly me.

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 dchen05 · Apr 24, 2013 at 11:44 PM 0
Share

This is a good solution if you are using the render texture for display only. I've run into the same problem and can't figure out a workaround because I need the exact pixels of the cropped normalized rect, to use it with GetPixels, ReadPixels etc.

I find it weird that a render texture from a camera seems to keep the screen ratio even if you have adjusted the normalized viewport rect. Strange.

avatar image
1

Answer by Orahpajo · Feb 06, 2013 at 04:15 PM

Hi,

you are not alone with your problem. I use the RTs to make a minimap for my game. Anoing thing about that is, that my map has a longer and a smaller side so that I would like to rescale my camera. But when I do that, my RT crops the long side down to the side of the short side.

Regards

Comment
Add comment · Show 3 · 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 Catlard · Feb 07, 2013 at 11:48 PM 0
Share

Very glad to know I'm not alone! I've about given up hope of having this answered here. I'll try editing the question, and see if anything new pops up. Thanks, dude. It sounds like we're having a similar problem.

avatar image Orahpajo · Feb 08, 2013 at 08:17 AM 0
Share

Hi again,

I came up with a solution for my problem, maybe it is helping you to. I use Scale$$anonymous$$ode.ScaleAndCrop like in the follwoing line:

GUI.DrawTexture(new Rect(Screen.width-210, 10, 200, 100), mapTexture,Scale$$anonymous$$ode.ScaleAndCrop, true, 0f);

This way the texture is cropped 50px on the top and 50px on the bottom, because the crop happens centered.

Regards

avatar image Catlard · Feb 10, 2013 at 11:20 AM 0
Share

Ah! Sorry, Unfortunately, I don't think that's going to work -- because I can't use GUI.drawtexture for what I'm doing -- it has to be done through rendertextures. Thanks, though!

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

11 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

Related Questions

Unity Grabpass Feature 1 Answer

Applying post-processing effects to RenderTextures 1 Answer

Mouseclick GameObject through the view of a RenderTexture 0 Answers

Screen Points to construct a Rect (Not axis aligned) 0 Answers

What is the procedure of capturing a particular region using Render Texture 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