Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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
0
Question by Buckslice · Nov 13, 2017 at 05:32 AM · texturerendertextureblittexturecoord

Graphics.Blit with a 3D Texture?

Is it possible to get Graphics.Blit working with a 3D RenderTexture? I have tried but it seems like it only is working on the first layer. Does anyone know if this is possible? I have have made decent progress using the new CustomRenderTexture, but I can't seem to control the update timing with them as nicely as I want to. So I figured I could try to reproduce my progress with just RenderTextures but having some trouble. My textures are 64x64x64 so maybe I could just use one 512x512 texture instead? I would have to do some magic to set up the UV's in the shader probably but maybe I will try this next.

Thanks for the help :)

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

Answer by Buckslice · Nov 29, 2017 at 01:20 AM

I figured out how Graphics.Blit works and created my own version for 3D RenderTextures.

 void Blit3D(RenderTexture tex, int size, Material blitMat) {
     GL.PushMatrix();
     GL.LoadOrtho();
     for (int i = 0; i < size; ++i) {
         // make sure tex.dimension is Tex3D. I think it works with Tex2DArray too
         Graphics.SetRenderTarget(tex, 0, CubemapFace.Unknown, i);
         
         // because i was using this for noise generation, I wanted the uvs to be strictly 0 to 1
         // (i had to remap the x and y coords in the shader as well)
         // but you may want to change it to how textures normally go 
         // (something like 0.5 -> size - 0.5)
         float z = Mathf.Clamp01(i / (float)(size - 1));
 
         blitMat.SetPass(0);

         GL.Begin(GL.QUADS);
 
         GL.TexCoord3(0, 0, z);
         GL.Vertex3(0, 0, 0);
         GL.TexCoord3(1, 0, z);
         GL.Vertex3(1, 0, 0);
         GL.TexCoord3(1, 1, z);
         GL.Vertex3(1, 1, 0);
         GL.TexCoord3(0, 1, z);
         GL.Vertex3(0, 1, 0);
 
         GL.End();
     }
     GL.PopMatrix();
 }

May you code forever o7

Comment
Add comment · 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

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

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

Related Questions

How to use Graphics.Blit with custom input textures 3 Answers

Ways to blit into a texture? (iOS compatible) 2 Answers

Rendering screen on texture and grabbing part of it 0 Answers

Need help with creating dynamic textures. 1 Answer

Render material to full screen quad 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