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
0
Question by DaJuice · Jan 29, 2013 at 02:16 PM · camerarenderingshadowoutput

Two outputs, one camera?

Hello, I'm having a hard time figuring this one out, mainly because I have no knowledge on cameras.

I'd like my camera to have an output on the screen (normal camera) as well as on a texture, this is important that I use only one camera for both outputs for optimization reasons: rendering the whole scene twice is not what I'd call best practice for iPhone ;P

From the inspector and as far as I know, there is no way to make the camera output on both a texture and the screen, I could double output on a texture, but the image quality is kind of sloppy...

Comment
Add comment · Show 4
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 Adam-Buckner ♦♦ · Jan 29, 2013 at 03:00 PM 0
Share

Can you explain either or both: why you want to out put the same content to the camera and screen and/or what the final effect is that you are trying to achieve by this?

avatar image DaJuice · Jan 29, 2013 at 03:06 PM 0
Share

I've found a hack here, to do the trick, I hope it won't render twice though... Link to answer

what I'm wanting to do is make everything cast a linear shadow on the background. just like in this game: alt text

shadow.png (338.0 kB)
avatar image save · Jan 29, 2013 at 03:12 PM 0
Share

You would much more likely want to use shadows volumes or by other means try to fake it. Have a look at this toolkit: http://forum.unity3d.com/threads/102079-Dynamic-shadows-in-Unity-Free-Pro-possibly-$$anonymous$$obile

avatar image DaJuice · Jan 29, 2013 at 04:39 PM 0
Share

I'll see if there's something to do with this, but from what I've read so far, the toolkit won't render well transparent textures and is rather resource hungry.

1 Reply

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

Answer by save · Jan 29, 2013 at 03:01 PM

This is the only way I can think of using one camera, there might be something more fancy on a more clever level. This renders the camera twice but you can restrict it to certain frames.

 var renderTexture : RenderTexture; //Create a RenderTexture in Project view and assign through Inspector
 var updateFrameEvery : int = 1; //Update every # frame
 private var cam : Camera;
 
 function Start () {
     cam = Camera.main;
     RenderToTexture();
 }
 
 function RenderToTexture () {
     var frameCount : int = 0;
     while (true) {
         if (Time.renderedFrameCount>frameCount+updateFrameEvery) {
             renderTexture.active = renderTexture;
             cam.targetTexture = renderTexture;
             cam.Render();
             renderTexture.active = null;
             cam.targetTexture = null;
             frameCount = Time.renderedFrameCount;
         }
         yield;
     }
 }
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 DaJuice · Jan 29, 2013 at 03:10 PM 0
Share

Thanks alot, I found a similar hack, and I was about to test if it was actually rendering the thing twice (which is why I don't want to have two cameras...), atleast you confirmed this ;)

avatar image save · Feb 05, 2013 at 01:39 PM 0
Share

Did you try this out?

I'm thinking this should be able to go actually as you can go with 30 fps and render twice directly onto a second layer behind non-culled objects. 60 fps is quite a lot and the difference is noticeable but isn't $$anonymous$$d-blowing between 30 and 60 on a handheld device. Running 30 fps is also good thinking of battery consumption. There should be enough juice in a phone to be able to do this in 30 fps on OpenGL ES 2.0.

You should be able to use a camera's "clear flags" when capturing for the render texture and a shader that multiplies on top of your background. It's an interesting problem, please get back to us with your findings!

avatar image DaJuice · Feb 05, 2013 at 01:46 PM 0
Share

$$anonymous$$y philosophy on ga$$anonymous$$g is all about the feel good, I couldn't sacrifice the s$$anonymous$$dy 60FPS for anything in the world, because it is one of the most important things for the game to feel good and half the quality of the gameplay comes from the "feel good factor"

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

Shadow flicker 0 Answers

Capturing the real-time output of multiple cameras in a scene 1 Answer

Flip The Entire Output in App 0 Answers

How to use two cameras in VR to display 3D object on top of UI panel? 0 Answers

Camera.render weird issue? 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