basis_universal | Basis Universal GPU Texture Codec | Compression library
kandi X-RAY | basis_universal Summary
kandi X-RAY | basis_universal Summary
Probably the most important concept to understand about Basis Universal before using it: The system supports two very different universal texture modes: The original "ETC1S" mode is low/medium quality, but the resulting file sizes are very small because the system has built-in compression for ETC1S texture format files. This is the command line encoding tool's default mode. ETC1S textures work best on images, photos, map data, or albedo/specular/etc. textures, but don't work as well on normal maps. There's the second "UASTC" mode, which is significantly higher quality (comparable to BC7 and highest quality LDR ASTC 4x4), and is usable on all texture types including complex normal maps. UASTC mode purposely does not have built-in file compression like ETC1S mode does, so the resulting files are quite large (8-bits/texel - same as BC7) compared to ETC1S mode. The UASTC encoder has an optional Rate Distortion Optimization (RDO) encoding mode (implemented as a post-process over the encoded UASTC texture data), which conditions the output texture data in a way that results in better lossless compression when UASTC .basis files are compressed with Deflate/Zstd, etc. In UASTC mode, you must losslessly compress .basis files yourself. .KTX2 files have built-in lossless compression support using Zstandard, which is used by default on UASTC textures. Basis Universal is not an image compression codec, but a GPU texture compression codec. It can be used just like an image compression codec, but that's not the only use case. Here's a good intro to GPU texture compression. If you're looking to primarily use the system as an image compression codec on sRGB photographic content, use the default ETC1S mode, because it has built-in compression. The "-q X" option controls the output quality in ETC1S mode. The default is quality level 128. "-q 255" will increase quality quite a bit. If you want even higher quality, try "-max_selectors 16128 -max_endpoints 16128" instead of -q. -q internally tries to set the codebook sizes (or the # of quantization intervals for endpoints/selectors) for you. You need to experiment with the quality level on your content. For tangent space normal maps, you should separate X into RGB and Y into Alpha, and provide the compressor with 32-bit/pixel input images. Or use the "-separate_rg_to_color_alpha" command line option which does this for you. The internal texture format that Basis Universal uses (ETC1S) doesn't handle tangent space normal maps encoded into RGB well. You need to separate the channels and recover Z in the pixel shader using z=sqrt(1-x^2-y^2).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of basis_universal
basis_universal Key Features
basis_universal Examples and Code Snippets
Community Discussions
Trending Discussions on basis_universal
QUESTION
I'm trying to embed a 1080p video chat stream into a Unity app on Android.
I've tried using Agora.io for this purpose, but the current version of Agora for Unity runs entirely on the CPU, and copying a 1080p texture from CPU to GPU takes 20ms on my Android device - too slow to maintain a consistent 60fps framerate in my app. Ideally, I either need the copy operation to not block the render thread, or I need the copy to happen in under 10ms, or I need the decoding to happen entirely in hardware.
I've done some digging into how other video player apps achieve this, and in general they use Android MediaCodec or ExoPlayer to decode video directly to a texture in hardware. However, this doesn't seem feasible for a video chat app because the process of encoding a video stream to one of the Android-supported formats would introduce too much latency.
I'm curious as to how apps like Skype and Hangouts achieve this - but I suspect they either run at 30fps, or they limit their video resolution to 720p or lower.
I've also considered creating my own video-chat protocol using something like Basis texture compression to decompress textures on GPU rather than CPU, but there is very little information on how to compile and integrate Basis into an Android application.
So my question is, does anybody know of a video chat SDK that offers this kind of performance & fidelity without an excessive amount of development work?
...ANSWER
Answered 2020-Jun-19 at 07:56So as it turns out, my profiling was totally wrong. The texture copy was not the hold-up at all - in fact the texture decode and copy-to-GPU were taking about 3ms, my profiler was just reporting incorrect timings.
The real bottleneck was the fact that I was trying to render the image onto a 250K triangle surface. It turns out under normal circumstances, my Android device was only able to render a surface of 100K triangles using GLES. However, after switching to Vulkan, ensuring triangles had connected edges (drastically shrinking the mesh index buffer), and performing some minor mesh optimization, I was able to increase my triangle budget to 400K and achieve a steady 60fps frame rate with a 1080p 30fps Agora video chat stream.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install basis_universal
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page