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 valyard · Apr 21, 2013 at 05:25 PM · performancerendertextureeffectdraw callsblit

Does Graphics.Blit affect performance much when used in image effects?

Hi.

I've coded several image effects which modify a passed texture using Graphics.Blit with specific shader and pass it to a next effect. Forming a chain of effects. You know, like an algorithm: 1. blur, 2. threshold, 3. edge detect.

This chain has many calls to Graphics.Blit, which as I understand is a separate draw call itself.

So, is it a good approach or I'll get myself into serious performance problems pretty soon?

Comment
Add comment · Show 5
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 whydoidoit · Apr 21, 2013 at 06:09 PM 0
Share

If you can combine effects then do - but I'm guessing that many of those effects need to process the previous result - so you have little choice?

avatar image valyard · Apr 21, 2013 at 06:24 PM 0
Share

Yeah, effects need result of previous ones. I just wonder how much this will hurt performance. If I got like 100 of them combined == 100 more draw calls.

avatar image valyard · Apr 21, 2013 at 06:47 PM 0
Share

The question is are these draw calls lightweight or it doesn't matter? I'd guess that uploading a quad and initializing a texture with a shader wouldn't be such a bottleneck. Comparing to rendering huge meshes with giant shaders.

avatar image whydoidoit · Apr 21, 2013 at 07:16 PM 0
Share

100 - wow - I can't wait to see what you are making! $$anonymous$$ust be amazing!

Well if the quads cover the whole screen then you have $$anonymous$$imum 100x full screen resolution overdraw which might screw up fill rate on some devices (and clearly would never fly on mobile platforms).

avatar image whydoidoit · Apr 21, 2013 at 07:18 PM 0
Share

So no they aren't lightweight - they're pretty heavy because lets face it the vertex part of a shader is called a lot less than the fragment part - then you've got auto culling due to obscured depth normally etc etc.

1 Reply

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

Answer by ricardo_arango · Apr 21, 2013 at 05:46 PM

Having them as separate scripts gives you flexibility to add/remove/disable/enable them as needed. But for performance reasons it would be best to combine the effects into a single OnRenderImage call when possible.

So a better approach is to combine as many of your effects as you can into a single effect. Every Graphics.Blit of a fullscreen quad is of course expensive, therefore the less you do it, the more you save.

You can also render to a RenderTexture instead of to the screen, as this will read back from screen to the Texture pass to OnRenderImage.

Finally, you can also downscale your RenderTexture which will reduce the number of texels from the RenderTexture that have to be processed and improve performance.

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 valyard · Apr 21, 2013 at 05:48 PM 0
Share

I am using RenderTexture only rendering. Nothing goes to screen in this chain.

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

13 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

Related Questions

Need Help Getting RenderTexture & Graphics.Blit Working: Boosting Mobile Performance 0 Answers

Blitting a Texture once 0 Answers

Multiple Blit problem 2 Answers

Render to texture, use same texture as input in next render call 0 Answers

ReadPixels Performance 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