# Virtual Textures

**URL:** <https://discourse.threejs.org/t/virtual-textures/53353>\
**Category:** Showcase\
**Tags:** virtual, shaders, textures\
**Created:** [June 29, 2023, 10:26am UTC](https://discourse.threejs.org/t/virtual-textures/53353 "2023-06-29T10:26:14Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![Usnul](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/usnul/32/2355_2.png) [@Usnul](https://discourse.threejs.org/u/Usnul)\
**Post date:** [October 30, 2023, 6:01pm UTC](https://discourse.threejs.org/t/virtual-textures/53353/26 "2023-10-30T18:01:20Z")

</div>

I put together a [demo](https://company-named.com/dev/prototypes/2023/10/virtual-texture/) using some real assets

[![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/c/7/c7c415f510e56e1b377b89ff6b1e383df4e19ad8.jpeg)](https://company-named.com/dev/prototypes/2023/10/virtual-texture/)

[![](https://img.youtube.com/vi/qUmDgGpTifE/maxresdefault.jpg "Virtual Textures in the Browser.") ](https://www.youtube.com/watch?v=qUmDgGpTifE)

The asset is [“Green car wreck”](https://sketchfab.com/3d-models/green-car-wreck-a5b233dfe0024ff0b9d33f5469b10dc8) by [matousekfoto](https://sketchfab.com/matousekfoto)

I chose this asset because it’s visually interesting, and has a total of 16k worth of textures. It’s also close to worst-case usage in terms of UVs, the asset has a ton of tiny UV island with little to no spatial continuity.

Here’s a 1k preview of the original texture, so you can see how chaotic it is:

 ![merged_1024](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/e/7ea0fbd73d3b3374b44acff979414c79fb1dc79b.jpeg)

## Quality Comparison

If you zoom far enough out - you’ll start to see UV seams, this is not a virtual-texture tech issue, but rather the bad UVs of the original texture. Here’s what the model looks like in blender:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/9/3/93ba3c90f8a2afc9816fefdd99ba0e4fdde12693.jpeg)  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/e/2/e2e5298b57b8f11593d0d325e950273c8fc18d47.jpeg)

here’s just plain three.js (using @donmccurdy 's gltf viewer):

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/8/8/880433b7181eaabb54b8ffdafccdcbb3dc6ad0d5.png)

and here’s sketchfab:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/4/5/45b032f50d0afbc8379be159ed96fa1abe5f64a0.jpeg)

Here’s virtual texture and gltf viewer side-by-side, VT on the right:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/1/217c47b77d2265771cf8b9e1f50b8875d328f062.jpeg)

## Random findings:

- Interestingly, if I try to load the non-virtual-texture version - Chrome keeps crashing half the time for me. I guess very few things are optimized to render 16k textures.

- Blender also gave up the ghost when I tried to bake this texture. So I ended up using GIMP 😃

---

_[View the full topic](https://discourse.threejs.org/t/virtual-textures/53353)._
