简体   繁体   中英

OpenGL Texture Speed up - View Dependent Textures

I have an object type which renders (correctly) a texture onto a 2D mesh depending on rotation (simulates 3D). However it is quite slow loading/binding a new texture image for each view. Disabling the view-dependent texture loading results in very quick performance.

Buffering all views/textures of the object may not be a good option, it could contain on the order of 720 views (separate images) each of which may be 600x1000 pixels. There is no guarantees of end-user system specs either, and this is a peripheral application.

Are there any good intermediate OpenGL suggestions between loading textures on demand and buffering all view textures at once?

This is where it would be useful to have a Texture Cache and you load all the lowest resolution MIP levels of the 720 different images. This would be your 1x1, 2x2 or so on resolution images.

As you are detecting changes in the view you are updating the texture cache, prioritizing the textures that last were used so that the one currently in view will have a high priority and the ones that weren't used for a long time will have the lowest priority.

As textures increase in priority you would bring in the higher detail MIP levels of the textures and you can rebind the textures when they finish loading, the texture cache would load them asynchronously in a separate thread and then notify your main thread when they can be prepared as that needs to happen in the same thread as the GL Context.

There are some other ways of doing this with new extensions like Partially Resident Textures from AMD but the extension has some limitations that makes it a bit cumbersome to use.

If the rotation is smooth and slow, you can stream the data from disk depending on the view and prefetch data for the surrounding views.

If you can afford a lossy compression, you can put lots of data in RAM with an aggressive compression then move some of it to VRAM (with DXT/BC compression if possible).

You should check these articles:

JMP Van Waveren. Real-time texture streaming & decompression. Intel Software Network, 2006.

JMP Van Waveren. Geospatial texture streaming from slow storage devices. Intel Software Network, 2008.

JP van Waveren. id tech 5 challenges:from texture virtualization to massive parallelization. SIGGRAPH Talk, 2009.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM