2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to get 16it floats out of a bmap... pixel_for_vec dont work!
#384489
10/03/11 22:41
10/03/11 22:41
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Hiya all.
Im trying to use a 16bit DDS image to store heightmaps. Creating the image, and loading it as a BMAP is fine.
BUT, I cant get individual pixel data out of it using pixel_for_bmap and pixel_for_vec because (according to manual) pixel_for_vec can only manage to handle "...the pixel format: 88, 565, 888, 1555, 4444, or 8888". And it doesnt even complain when I try to force it to use pixel format "16""12"...
Any ideas on how I can extract this info (on a pixel by pixel basis) anyone?
Thanks guys...
Last edited by EvilSOB; 10/03/11 23:12. Reason: fixed typo
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: How to get 16it floats out of a bmap... pixel_for_vec dont work!
[Re: Superku]
#384492
10/03/11 23:14
10/03/11 23:14
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Sorry, but Im already doing that to get the pixel format of the image.
PS: Ive fixed a TYPO in my main post regarding the format number...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: How to get 16it floats out of a bmap... pixel_for_vec dont work!
[Re: Slin]
#384496
10/04/11 00:11
10/04/11 00:11
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
No can do. I NEED a 16bit value per pixel. And I cant get TGA to go 16bit. But Im no 'photoshop guru'...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: How to get 16it floats out of a bmap... pixel_for_vec dont work!
[Re: EvilSOB]
#384577
10/05/11 01:01
10/05/11 01:01
|
Joined: Jan 2003
Posts: 4,615 Cambridge
Joey
Expert
|
Expert
Joined: Jan 2003
Posts: 4,615
Cambridge
|
|
|
|
Re: How to get 16it floats out of a bmap... pixel_for_vec dont work!
[Re: Joey]
#384579
10/05/11 02:36
10/05/11 02:36
|
Joined: Aug 2008
Posts: 482
bart_the_13th
Senior Member
|
Senior Member
Joined: Aug 2008
Posts: 482
|
Only normal 16, 24, or 32 bit bmaps can be read from. Accessing compressed DDS bmaps, or bmaps used as render target will also cause a crash error.
Your 12 bit DDS bmap is not normal [EDIT] I assume that you must read the pixel first with pixel_for_bmap before using pixel_for_vec
Last edited by bart_the_13th; 10/05/11 02:37.
|
|
|
Re: How to get 16it floats out of a bmap... pixel_for_vec dont work!
[Re: bart_the_13th]
#384595
10/05/11 09:05
10/05/11 09:05
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Joey: No good dude. I need the actual 16bit data as saved by 'photoshop'.
Bart: Re-read my top post regarding number of bits. I am actually working with a 16bit float DDS file. The "12" in my top post is the "pixel type number" that gamestudio returns from bmap_lock. Read the manual under bmap_lock and check the type 12 entry. Thats me...
And yes I am using pixel_for_bmap first. I also tried looking at the raw 'pixel' data as stored in the var returned by pixel_for_bmp, BEFORE using it in pixel_to_vec but could make no sense of it or use for it.
I wish I knew how to get inside GS's pixel format, because I suspect the 16bit data IS being retrieved by pixel_for_bmap, its just that pixel_to_vect doesnt know how to process it...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: How to get 16it floats out of a bmap... pixel_for_vec dont work!
[Re: Slin]
#384616
10/05/11 12:22
10/05/11 12:22
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Its a 16bit float (one color channel) DDS, so I assume it to be compressed. All DDS files are I BELIEVE (noob to DDS). I only went DDS cause it was one of the few formats that could carry a single 16bit 'color'.
GS DOES load the image, as I am able to display the image with DEBUG_BMAP. It is a strange washed-out cyan color, but it is recognisably the image in question.
Its not a 'texture', its a heightmap. That I want to never 'display', but I want to read through it on a pixel-by-pixel basis and save into a custom-structure data file. This datafile is my (currently in proof-of-concept testing) way of storing the heightmap of 'the entire world'. So as you can imagine, its BIG, really BIG, you wont believe how vastly, hugely, mind-bogglingly big it is, you might think its a long way down the street to the chemist, but thats just peanuts to ....[REDUCTED]
So, with all this known, I feel IF I had some ideas how to start, I could access the texture via the bmap.finalbits or even the bmap.d3dtex pointers. But I dont where to start with 16bit floats... Floats are an unknown country to me...
I was HOPING for an easier way, but it looks like I may have no choise. This is only a TOOL anyway, so speed is not so essential...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|