Example project for Unity 2020.1+ texture data access APIs
Перейти к файлу
Aras Pranckevicius b9497316e5 Typo fix 2021-01-31 13:21:24 +02:00
Assets Typo fix 2021-01-31 13:21:24 +02:00
Images Add screenshot 2021-01-28 13:14:14 +02:00
Packages Project structure 2021-01-28 13:06:14 +02:00
ProjectSettings Project structure 2021-01-28 13:06:14 +02:00
.gitignore Add plasma effect example 2021-01-28 13:08:56 +02:00
LICENSE.md Update license 2021-01-28 14:27:34 +02:00
readme.md Update readme.md 2021-01-29 15:25:52 +02:00

readme.md

Unity 2020.1+ Texture Access API examples

Unity 2020.1 added Texture2D.GetPixelData and related APIs for C# Jobs/Burst compatible way of reading & writing texture pixels (see documentation).

This repository contains a small example of that. Required Unity version is 2020.1 or later.

Procedural Plasma Texture

An example where a "plasma effect" texture is updated on the CPU every frame.

Plasma

Assets/PlasmaSampleScene is the sample scene and code.

Time it takes to compute plasma and update a 512x512 texture, on 2019 MacBookPro (Core i9 2.4GHz, 8 cores / 16 threads):

  • SetPixels: 113ms,
  • SetPixel: 140ms,
  • SetPixelData w/ Burst: 17ms,
  • SetPixelData w/ Burst, parallel jobs: 1.7ms.