Animated DDS?

Blitz3D Forums/Blitz3D Programming/Animated DDS?

Adam Novagen(Posted 2012) [#1]
Been a while eh?

So, lately I've more or less stopped using PNG textures in favour of DDS, for some rather obvious reasons including performance and mipmap quality. However, I ran into a bit of a snag recently when I saved a texture of two frames, each 64x64 (the image itself being 128x64). Whenever I try to load it via LoadAnimTexture("ring.dds",16+32,64,64,0,2), it refuses to load. LoadAnimTexture() merely returns zero, and any subsequent EntityTexture() calls do of course generate an MAV.

The texture works fine if I load it as a non-animated 128x64 texture, it's only when I attempt to load it as an animation that I get the problems. Is it a limitation of Blitz that it cannot work with DDS as animated textures, or do I perhaps need to use some different/specific formatting for the texture in question?

Last edited 2012


Adam Novagen(Posted 2012) [#2]
One and only bump, in case this thread has been missed... Anyone?


Yasha(Posted 2012) [#3]
My guess is that DDS doesn't support being loaded in this way, due to both the way Blitz3D loads anim-textures (copying rects to new buffers - a compressed texture is unlikely to handle this well), and because the glorious wiki says handling an "array of textures" is a DX10 feature (which may mean anim-texture sheets?).

So... I guess just lump several single textures in an array or bank or something.

Last edited 2012


Adam Novagen(Posted 2012) [#4]
Alright. Since the only animated textures in this whole game are only two frames, a Blitz array will do the job fine. Cheers!


K(Posted 2012) [#5]
Or if your'e determined to access it as frames, you could use CreateTexture() and CopyRect onto each frame from your loaded 128*64. I guess.


Adam Novagen(Posted 2012) [#6]
That would actually be completely counter-productive. DDS (DirectDraw Surface) is a special texture format specifically designed within the Microsoft DirectX framework. Almost all texture formats - BMP, JPG, PNG and the like - load the file into the video hardware as uncompressed ARGB pixel data. DDS textures, depending on settings, can actually be loaded into memory as compressed texture data, saving significant resources depending on the hardware in question. They are also optimized specifically for the hardware to render effectively when using DirectX.

CreateTexture() and CopyRect() would negate this entirely, as Blitz can only use them regarding raw ARGB data. The performance gains from using DDS textures would be lost.


K(Posted 2012) [#7]
Ohh... never used DDS. Cool, thanks for the info.


Adam Novagen(Posted 2012) [#8]
I'm new to it too, Yasha brought me up to speed a few months ago. It's downright handy for anything apart from animations, apparently :P


Yasha(Posted 2012) [#9]
Did I? I think the credit there goes to the great jfk EO-11110.


K(Posted 2012) [#10]
downright handy for anything apart from animations

Technically though, even on raw data textures each frame is sent to a different buffer, right? So the only disadvantage is implementation, which shouldn't be too hard. I.E...(And would probably be better with OOP)
;Template
Type DDS
Field flags%,anim[10]; or whatever no of frames
End Type
;Init
Function LoadDDS.DDS(path$,flags%=9,no_frames%=1)
D.DDS=New DDS
For k=1 To no_frames
D\anim[k-1]=LoadTexture(path$+k+".DDS",flags)
Next
Return D
end function
;Implement
EntityTexture entity,D\Anim[frame]

(For LoadDDS() you feed paths like "water" and name the files "water1.DDS",etc.)
Maybe this is actually useful. I'll definitely be looking into DDS. Thanks guys.

Last edited 2012