Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Shinyclef · Jan 19, 2015 at 10:30 AM · renderingtransparencyrender texturerenderqueue

Understanding Render Targets and Render Textures.

Hello. I'm currently trying to understand the following article to implement weighted order independent transparency. http://casual-effects.blogspot.com.au/2014/03/weighted-blended-order-independent.html

The technique described uses a shader that outputs to two render targets. I've been trying to understand how it is achieved in unity, and at what cost.

I understand unity pro has Render Textures, where a shader can essentially output to a texture which can then be used for multiple purposes. Is this the same thing as what a render target is? Can one shader output to two render textures?

The technique also mentions that using multiple passes can achieve the same results for older cards. This makes me wonder about cost. Do render textures essentially have the same cost as a shader pass?

Also, if want to use render textures/targets to achieve this order-independent transparency, can I 'prevent' the main camera from drawing transparent objects?

I'm a bit unsure how it all fits together. Any help would be appreciated.

Thanks.

Here is the relevant extract from the article:

During transparent surface rendering, shade surfaces as usual but output to two render targets. The first render target must have at least RGBA16F precision and the second must have at least R8 precision. Clear the first render target to vec4(0) and the second render target to 1 (using a pixel shader or glClearBuffer + glClear).

Then, render the surfaces in any order to these render targets, adding the following to the bottom of the pixel shader and using the specified blending modes: (code available in article)

Finally, after all surfaces have been rendered, composite the result onto the screen using a full-screen pass.

See the paper for full details and fallback paths for GPUs or APIs that do not support multiple render targets or per-render target blending functions.

Comment
Add comment · Show 1
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 ambid17 · Sep 05, 2019 at 07:21 PM 0
Share

Did you find a solution to this that worked? I am trying to do the same thing

1 Reply

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

Answer by MakeCodeNow · Jan 20, 2015 at 06:48 AM

In Unity, RenderTarget and RenderTexture are very close to the same thing. Technically, a RenderTarget can use a RenderTexture or RenderBuffer.

You can do MRT in Unity. See Graphics.SetRenderTarget and Google if you need examples.

You can put all transparent objects on a layer and then use the main camera culling mask to skip that layer.

Note that order independent transparency is often impractically expensive. I can't think of any commercial games that use it.

Comment
Add comment · Show 2 · 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 Shinyclef · Jan 20, 2015 at 07:43 AM 0
Share

Thanks for explanation.

avatar image Alejandro-Martinez-Chacin · Oct 29, 2019 at 03:10 PM 0
Share

I have tried using Camera.SetTargetBuffers(...) API before rendering (RenderPipeline OnBeginCameraRender event) and it doesn't seem to work on my side. If I use any of the RenderTargets directly on the camera.targetTexture it does write to it, just not the $$anonymous$$RT way. Is it confirmed that $$anonymous$$RTs work with cameras as is out of the box?

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

29 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 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 avatar image

Related Questions

Unity System Fog Access 0 Answers

Don't render objects behind other objects, or use transparency flags? (Like Source engine) 1 Answer

Control render order of geometry besides queues 1 Answer

Unity 3D Render Camera Bug!!! 1 Answer

Order dependent transparency, shaders (planet atmosphere rendering) 2 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