Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 fox3fire · Jul 14, 2018 at 04:25 AM · renderingrender textureinstancing

Use GPU Instancing and Render To Texture at the same time

I want to use gpu instancing to render the screen to a frame buffer in unity but the problem is the only two interface concerning gpu instancing that unity exposed involves cameras. This means if I want to use gpu instancing, it will either render to all cameras or the one that I specified. On the other hand, I want to use SetRenderTarget to make unity render to the render texture that I specified. According to my test, SetRenderTarget before DrawMeshInstanced doesn't change anything. The scene was still rendered to the cameras but not to the render texture. I think I can blit the camera's result to my render texture, but it will be slow. I tried set the camera's target texture to my render texture and call DrawMeshInstanced but it didn't work. It rendered the scene without the instanced mesh that I specified. I wonder is there any solution to this? @bgolus

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

1 Reply

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

Answer by fox3fire · Jul 14, 2018 at 09:13 AM

My method is correct. What I did wrong was I only rendered to the render texture when I press down a button and after that didn't change the camera's target texture to null. This will cause the camera overwrite the result in the texture.


However, I encountered another problem. Is there any way to set camera's target texture to a RenderTexture which has the form of a Texture2DArray. In short how can I specify a camera's target texture with a depthSlice parameter?


FINAL ANSWER: USE COMMAND BUFFER FOR EVERYTHING YOU WANT TO DO THAT STARTS WITH "GRAPHICS.". FINALLY, I CAN CALL SET RENDER TARGET AND DRAW MESH INSTANCED AT THE SAME TIME.

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 fox3fire · Jul 14, 2018 at 09:14 AM 0
Share

Because in command buffer, draw mesh instanced does not require a camera or any camera!!!

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

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

Related Questions

Pixel perfect render texture sprites moving irreguarly 0 Answers

Can unity render part of a video frame 1 Answer

Binding EGLImage to RenderTexture (or setting NativeTexturePtr) 0 Answers

How do I enable DOTS Instancing on a material/shadergraph 1 Answer

Texture not rendered on OnePlus One 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