Sign in to follow this  
vicx

R32f / lockrect -> reading on cpu

Recommended Posts

Hello again!

Till now processing r32f at vertex shader wasn't a big deal, but I decided to exlude bmp/jpg heightmaps from my project and replace them with dds version in r32f format, which allows my crappy gpu to do vtf.
I spent some time trying to get proper values from this format and I'm still failing, even though I found lots of conversion methods.
The msdn says that the most important is the red channel, but I don't really get it in terms of reading from lockedrect.
I use standard method of reading data from texture - so each time I take four bytes and I don't really know how to decode it to proper black-white value.
I used to take only red byte and it seemed aaaalmost ok, but there were some glitches on the output height-image. Could someone give me a clue how to take the brightness from these four bytes properly?

Share this post


Link to post
Share on other sites
If you're also using DXT compression then the data you get back from LockRect will be the compressed version of the texture. You'll need to decompress it back to RGBA if so, and that's where you start getting into patent minefields.

Share this post


Link to post
Share on other sites
[quote name='mhagain' timestamp='1343214504' post='4962893']
and that's where you start getting into patent minefields
[/quote]I'd personally just ignore the patent issues. HTC isn't going to sue you for decompressing a texture ([i]unless your name is Apple[/i]), and even then, they'd lose:[quote]In September 2011, Intel employee Ian Romanick mentioned that the S3TC patent had been marked as invalid in patent litigation between Apple and HTC, the latter of which acquired S3 and all of their patents.[/quote]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this