I posted this in the 2D forum, but after more research I’m reposting here since this is a HDRP feature only.
I am trying to design an application to navigate a 180,000px wide by 5000px ‘gigapixel’ image, that allows jumping to specific points and manually panning and zooming the image.
StoryMap is quite similar to what I’d like to do in terms of navigation and it works well. To use it, you need to generate tiles from the image by using a Zoomify export in Photoshop an upload to a web server. This created about 19,000 256px square tiles and also a few low res images of the entire image. The lowres, images show up first, and then the tiles start to load as they come off the server.
I’d like to compare the performance to Unity’s Streaming Virtual Texture (SVT). It sounds like basically SVT is doing the same tiling idea, but on the GPU and without having to manually cut up the image. I’m curious if it has less evidence of tiling (you can clearly see the 256k tiles loading as you navigate a StoryMap image).
I’m a little confused as to the advice given in the Unity reference. It suggests that it’s best to write a shadergraph that uses all of the tiles, rather than using several different instances of the shader. After I created the shader, it seems to me that the Virtual Texture layers are meant for things like normal maps, specular maps, etc. Is that correct?
In my case, I found the most efficient scheme was to create 10 8K textures, where the image is tiled vertically twice. My plan is to make 20 materials, with a tile in each offset to show only half of the image. I will then snap the quads together to make a really long image that can be panned and zoomed.
Is that a reasonable/efficient idea or am I misunderstanding how SVT’s work and could do something more efficient?
I think you almost have the idea of SVT but not quite.
See, the point of SVT, is to allow devs to use high resolution textures without getting the texture pipeline clogged up.
How SVT does it, is that it will create a separate tiled instance cache in the RAM and then send tiles that are visible to GPU. This essentially reduces total GPU texture with some CPU overhead.
Now, SVT is useful as long as the textures are not fully visible all the time. For example, if you use SVT on a flat wall, chances are you won’t be getting a lot performance boost.
But if you use it on a box, then the 3 sides that are not visible will not be streamed to GPU - essentially halving the texture sent to GPU. I simplified the things a bit, but SVT will benefit more if there are many boxes in a room all with different textures of 4k+ textures. The occluded areas (boxes covering parts of boxes, the hind etc…) are not sent to GPU.
Now, in your case, you want to navigate a google map like area (flat surface i assume), then you may rather use texture streaming rather than SVT. Not only will the performance benefits of SVT can’t be leveraged but also, you can’t really control mip maps in SVT, which means high res will still be streamed in given enough time even when you have zoomed out. SVT functions like its own species, it determines and tries its best but you can’t really control it.
I’ve been using SVT in my open world project heavily lately and noticed that SVT is not always the answer but helps smooth out many things.
Just my 2 cents. Hope this helps.
@jjejj87 Thanks for your explanation, that helps a lot. I could tell that SVT was probably meant for world building from the samples. For rocks that appear up close and also far away, I believe it loads only the resolution that’s needed from huge images.
I wasn’t sure if it would be right for this or not but I did get it up and running. It performs well especially in terms of zooming in and out. For panning, there is a blip when a new tile first appears. After that, it is smooth. I ended up using ten 8192px textures and mapped each one of those to a single plane.
I saw the texture streaming option, but wasn’t sure how that would work with SVT. I assume you are talking about Mip Map Streaming, is that right? I will build out another scene and see how it compares.
I haven’t yet looked into profiling for memory use, so it should be interesting to compare.