Re: Compressed textures
- From: "John Withe" <a@xxxx>
- Date: Mon, 25 Feb 2008 21:04:44 +0100
If your textures are dynamic and can't be compressed ahead of time,
then load the texture into a plain surface in system memory and use
D3DXLoadSurfaceFromSurface to transfer it to a compressed surface.
The target surface can be wherever you like -- D3DX will handle the
different situations accordingly. There are other compression
libraries from NVidia that you can use in place of D3DX, but D3DX is
already there so you might as well use it.
This is only worthwhile if you infrequently load the texture data and
frequently draw it. Otherwise the overhead of compression is too
high.
I ship the application and the end user uses it to display user defined scenes with user defined movies in it, so I need the application to be able to read an arbitrary movie and use its frames as textures. The actual displaying needs to be fast, but if the conversion can be done ahead of time, thus alowing a fast load, then it is fine.
Why do you need to read out the binary data?
I do not, but if I don't then the conversion will need to happen every time the movie is loaded. I would much rather have a slowconversion and a subsequent fast loading and displaying of the graphics. Some movies might be too big to be kept in memory all at once. I see no other option than to precompress them and then runtime do a fast load and displaying of them. In essence I beleive I need to deserialize the textures (one texture per frame) quickly runtime.
Hm. Perhaps things are still unclear.
This is an application used in videobroardcasting with live shows. Artists create video data which need to be displayed runtime in a 3d scene. Depending on the situation one or another video may be displayed here or there.
Currently I do two diferent things. When a movie is small enough, I readit into system memory as a binary stream defining the texels of different frames. I then copy different frames into a texture and use thetexture as a surface for rendering the video in the scene. It is fast enough, but I would certainly like it to be faster. Whenever I need a new video frame in the texture, I lock the texture, write the bytes and unlock it.
For larger movies I runtime render a frame into system memory and do the same copying. It is also fast enough, butsomewhat slower than the version in system memory.
The real bottleneck seems to be the copying of texels each frame. If I use compressed textures, then I will transfer less data and things will be faster... or so I hope.
If the videofile needs to be preprocessed slowly so it can later load quickly then it is quite allright.
I must admit that the dx part of this system is the one where I have the problems. I am still learning that area, so I may be doing something quite silly. A nvidia quadro fx5500 can render a 720*576*ARGB video with arround 1000fps from memory and 800fps when streaming directly from disk. Using nvidia core 2 duo 2GHz
.
- Follow-Ups:
- Re: Compressed textures
- From: Richard [Microsoft Direct3D MVP]
- Re: Compressed textures
- References:
- Compressed textures
- From: John Withe
- Re: Compressed textures
- From: Richard [Microsoft Direct3D MVP]
- Compressed textures
- Prev by Date: Re: Compressed textures
- Next by Date: Re: Compressed textures
- Previous by thread: Re: Compressed textures
- Next by thread: Re: Compressed textures
- Index(es):
Relevant Pages
|