PDA

View Full Version : OT questions about bmp file format



wildeyedboyfromfreecloud
03-18-2002, 07:58 PM
ok heres the scenario. i have this routine that i wrote that takes a bumpmap and tesselates polygons and applys the bumps to them based on texture coordinates. like a 3d bump map. so the objects geometry actually changes. anyhow how i'm getting the bump map is... i have this routine i got out of my computer graphics textbook that reads in bmp files. i haven't looked inot how the headers works. so sue me. anyhow so i take a desaturated 24bit image and then write just the first color component(red) to a txt file as binary to get a heightmap. but the problem is it works fine as long as the edges in the bitmap are sharp. but if i use an image with blured gradiated edges i don't get the same ordering in my file. so i assumed that bitmaps are uncompressed. but there must be some kind of compression going on. i've really racked my brain over this alot before noticing that its just gradiated images that don't work. if anyone can explain this i'd apreciate it.

Korval
03-18-2002, 08:14 PM
Why would you intentionally post an off-topic message? At the same time, why would you intentionally post an off-topic message about something that can easily be found via a www.google.com (http://www.google.com) search to an Advanced OpenGL coding board? Not only that, I'll bet that MSDN has the entire .bmp format somewhere in it. So, in short, why do you want us to do your work for you?

john
03-18-2002, 08:16 PM
Firstly; what do you mean by the same orderings? It seems to be that all you are doing is converting an RGB BMP image to a binary file with just the red values (although you may apply some scale to those red values).

Secondly; if you really want to know if the file you have is using compresison then 1) don't be lazy (read abtou the bmp specs!), or 2) check out the size of the file. If its big, then its unlikely to be compressed.

cheers,
JOhn

wildeyedboyfromfreecloud
03-18-2002, 08:18 PM
sorry i'm one of those take only that which is necesarry and give all that one can type. i probably won't ever post here again. why would anyone not intentially post an off topic question is beyond me. but anyhow i have a task at hand and i'm just looking for a quick answer. not a subquest if you catch my drift. i give up.

also if you already know the answer... then its not really doing work for me is it. unless you are one of those types that thinks everything comes with a price. i hear in a far off land people are into helping people you know if you are into that type of thing.

[This message has been edited by wildeyedboyfromfreecloud (edited 03-18-2002).]

wildeyedboyfromfreecloud
03-18-2002, 08:27 PM
i consider myself the least lazy person on the planet forgive my ego. i seek to achieve maximum results. so yeah i stand on the shoulders of giants whenever possible. as for ordering i mean. i have a real envolved windows bmp loader with all the bells and wistles. maybe i also looking for an alternative. i'm really not in the mood to learn all about bitmaps this week it wasn't in my agenda. anyhow you know i don't know. this is really pretty crazy. but anyhow this function reads in the rgb components and stores them in an aray of rgb vectors. then i just take that structure and write it out to a file. just the red components as binary. and everything works Aok unless i go and use an image with soft edges. then everything slips. like the data is not stored in the logical order for an uncompressed image. (1scanline after the other). well anywho if no one has any ideas. i'm looking for an easy answer for now. ahh just forget it. i won't bother again.. one of these days i'll wise up.

wildeyedboyfromfreecloud
03-18-2002, 09:00 PM
personally i'm worried i'm going insane. but here is how it works. if i draw a bitmap. say i just use circles with no softedges. i can draw as many as i like any color and everything is lovely. but if i saw perform a low pass (blur) over it then save it and run the program the bump map is all wrong. i also have the bumpmap textured onto the object so its easy to see where is should be bumping and mapping if you know what i mean. why could something crazy like this happen. i don't think the file is compressed. and i don't see why it would matter if it was. anyhow anyone have any suggestions that apply to this dilemma. i hear photoshop allows one to export a bitmap as a raw data file. i will try to get my hands on a copy i guess. if i was going to learn about image formats. i'd just make my own. i plan to do a lot of experiments in data compression. i'm just not comfortable using other peoples code or methods for some reason. well this is crazy just to let you know. hope someone got a kick outta it.

pkaler
03-18-2002, 11:59 PM
I wanted to contact you personally, but you do not supply an email address. Don't take this personally, but you should really read this before posting anywhere. You will find that you will find the information that you require much more efficiently. Since this is an off-topic post, please refrain from replying on the board. My email is available through my profile. But, please, please, please, please read the linked document. But more importantly, follow the advice of the linked document. I learned these lessons the hard way. It seems that you are following a similiar road.
http://www.tuxedo.org/~esr/faqs/smart-questions.html

T2k
03-19-2002, 12:07 AM
hehe, how many times you have already posted off-topic threads ??? 90% of you total threads posted ??? but here what you are doing wrong:
1st. bmps are stored uncompressed if they have more than 4bit per pixel !!!
2nd. bmps are stored in down-top order
3rd. bmp lines are aligned to 4byte boundarys
4th. opengl only takes bitmaps if they have size of 2^n x 2^m
5th. use ijg, then you can load jpg, bmp, gif, PPM, Targa(ignores alpha), and RLE(if you want)
6th. dont save a PSD file and rename it to bmp !!!
7th. if you only take the red component (which is 100% the blue component, because bmp is stored in BGR order, except you loader swaps them) you have to pass each line like:

do
do
save r-component-which-is-in-real-b-component
skip 2colorcomponents
while lineend
skip linesize%4
while linecount

nickels
03-19-2002, 08:14 AM
Geez, you guys are a bunch of bloodthirsty sharks. I'm not impressed.

knackered
03-19-2002, 08:15 AM
Then you're not worth impressing http://www.opengl.org/discussion_boards/ubb/wink.gif
(tongue-in-cheek)

wildeyedboyfromfreecloud
03-19-2002, 09:22 AM
listen i want post here anymore. i'm very aware of how you all feel. i just don't agree with it. i think you are all rediculous. this board is 5% questions. 15% answers. and 85% moaning and complaining. i'm just curious why you care. and i won't follow this comment to its natural conclusion for concern for your emational well being. but i think you should all reconsider your priorities in life and your belief systems as well.

i'm tired of my mailbox being flooded with messages telling me i have replies that apply 0% to my question. and i thought my email would be there. but honestly i'm glad its not. like i said. crowds give me the creaps. i should follow my own advice. file this reply in the discontent furum. hmm... maybe there is a discontent bbs somewhere. where we can post all of our discontentions. and then be whined at if are discontentions are not discontent enough. honestly this is all rediculous. i think i need to reevaluate my relationship with humanity before i speak any further. and unfortunately i don't have the time because you have all wasted my time, your time, and any poor soul who happened to stumble into this thread. think about your priorities. i'm not going to get philisophical or psychological here. i can give you some links though, kidding. geez. get some fresh air boys.

michael

fin

T2k
03-19-2002, 11:38 PM
Ehy stupid jerk, read the posts other people write, they may want to help you!!!

Eric
03-19-2002, 11:48 PM
Originally posted by wildeyedboyfromfreecloud:
this board is 5% questions. 15% answers. and 85% moaning and complaining.

So there is some overlapping (5+15+85=105)... Who the hell is answering or asking while complaining ??? You guys really should focus on moaning. http://www.opengl.org/discussion_boards/ubb/wink.gif

Regards.

Eric

T2k
03-19-2002, 11:52 PM
eric 28 more posts ... and you are the winner http://www.opengl.org/discussion_boards/ubb/biggrin.gif

[This message has been edited by T2k (edited 03-20-2002).]

niko
03-19-2002, 11:58 PM
Originally posted by wildeyedboyfromfreecloud:
this board is 5% questions. 15% answers. and 85% moaning and complaining.

Then do not keep posting to this forum if it can not give answers to your advanced questions.

/Niko

T2k
03-20-2002, 12:00 AM
to your advanced questions
hehe ...

knackered
03-20-2002, 12:01 AM
wildeyedboyfromfreecloud, are you running some kind of religion, for which this is all a recruitment drive?

Anyway, I've done my guard duty for now - so no more moaning from me. Ask as many stupid questions as you like.

Eric
03-20-2002, 12:16 AM
Originally posted by T2k:
eric 28 more posts ... and you are the winner http://www.opengl.org/discussion_boards/ubb/biggrin.gif


http://www.opengl.org/discussion_boards/ubb/wink.gif

Actually, some people have already blown the 1000 limit (Matt for example). If you count my posts on the old forums (before UBB), I must have reached something like 1500 already....

Anyway, I'll have a pint after my 1000th post ! http://www.opengl.org/discussion_boards/ubb/wink.gif http://www.opengl.org/discussion_boards/ubb/wink.gif http://www.opengl.org/discussion_boards/ubb/wink.gif

Regards.

Eric

P.S.: to be honest, probably only 10-20% of those posts were useful to someone !

nickels
03-20-2002, 06:40 AM
This site needs to can the advanced forum anyway. It just leads to elitism and snobbery and serves no purpose since everyone posts in both and everyone reads both.

It is enjoyable watching how persnipitty people get about their 'precious' advanced form, but overall the impact is negative and it is irritating.

Olumide
03-20-2002, 10:26 AM
Perhaps y'll shouldnt be too hard on wildeyedboyfromfreecloud. It is likely that he does'nt have a lot of OpenGL experts about him so his only option is to go online. I have that problem too. Besides, how many user groups are solely dedicated to discussing the BMP format? ... My guess: not many. My experience is that an OpenGL programmer is probably the best person to talk to about BMP file access ...

Pat
03-20-2002, 11:13 AM
Maybe you should use the RGB colors based on luminosity instead of simplu sing the red channel only.

Use the following equation:

int iLum = (int)(.299 * (double)*pRed + .587 * (double)*pGrn + .114 * (double)*pBlu);

Hope this helps...

Korval
03-20-2002, 12:02 PM
Besides, how many user groups are solely dedicated to discussing the BMP format?

Does it matter? He asked a question whose answer is quickly and easily found via an Internet search. This question shouldn't be asked at any bboard or newsgroup. The .bmp format is not hiding somewhere. Microsoft isn't interested in keeping this format a secret. It is freely and easily avaliable on the Internet. I found it (a year or so ago) in less than 5 minutes, which is less time than it takes for someone to answer a bboard post.

Olumide
03-20-2002, 12:39 PM
Originally posted by Korval:
This question shouldn't be asked at any bboard or newsgroup ... I found it (a year or so ago) in less than 5 minutes, which is less time than it takes for someone to answer a bboard post.

Well, what's obvious to you might not be obvious to others. Incidentally, I had a similar problem sometime ago. I was actually trying to duplicate an example in the OpenGl Super Bible and it was not working. Thanks to the guys on the this bboard (dslater to be precise) I found the problem.

To see what I'm talking about check out the posting: http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/005385.html


But you're right he should have searched (harder) ... Anyway, I think "we" should be patient with the newbies ..

[This message has been edited by Olumide (edited 03-20-2002).]

painterb
03-20-2002, 12:50 PM
I agree with the sentiments of nickels and Olumide. This board has turned very negative lately.



Originally posted by Korval:
Does it matter? He asked a ... <snip> ... for someone to answer a bboard post.

Sure, that's all true ... though if someone wants to waste their 5 minutes posting a question that's their problem. However if you decide to use 5 minutes of your precious time answering it, that's *your* problem alone. No one else is at fault. If you wish to preserve your 5 minutes ... just push the "Back" button. It's probably at the top of your browser window.


[This message has been edited by painterb (edited 03-20-2002).]

Eric
03-21-2002, 12:46 AM
Originally posted by painterb:
Sure, that's all true ... though if someone wants to waste their 5 minutes posting a question that's their problem. However if you decide to use 5 minutes of your precious time answering it, that's *your* problem alone. No one else is at fault. If you wish to preserve your 5 minutes ... just push the "Back" button. It's probably at the top of your browser window.


The problem is that if someone decides to spend 5mn helping people with real questions, he probably doesn't want to spend 80% of this time FINDING those questions...

Anyway, the "elitism" thingy is probably true in some way.

Regards.

Eric

nickels
03-21-2002, 12:46 PM
I can't believe I said something that people are sort of agreeing with!
How bizarre.

http://www.opengl.org/discussion_boards/ubb/smile.gif