Giter Club home page Giter Club logo

unity-gpu-texture-resize's Introduction

Why This Script Was Created

This class allows you to resize an image on the GPU.

Speeds

Methods Speeds Source
ResizeTool.Resize(..) 00:00:40.89 This Tool [FREE]
UnityEngine.Texture2D.Resize(..) 01:08:08.55 Unity Method
ResizePro.Resize(..) 00:00:40.28 ResizePro [PAID ASSET]

progress bars of ResizeTool vs Texture2D.Resize

Here is the process:

  1. RenderTexture rt = RenderTexture.GetTemporary() create a temporary render texture with the target size
  2. RenderTexture.active set the active RenderTexture to the temporary texture so we can read from it
  3. Graphics.Blit() Copies source texture into destination render texture with a shader (on the gpu) more info
  4. texture2D.Resize() resize the texture to the target values (this sets the pixel data as undefined) more info
  5. texture2D.ReadPixels() reads the pixel values from the temporary RenderTexture onto the resized texture more info
  6. texture2D.Apply() actually upload the changed pixels to the graphics card more info

unity-gpu-texture-resize's People

Contributors

ababilinski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

unity-gpu-texture-resize's Issues

Trouble understanding the script

I don't really see why the rendertexture is used here, the data is blitted once from input Texture2d to the rendertexture it doesn't seem to be used anywhere later.
What purpose does the rt fullfill?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.