Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Faramir

Height field bitmap and texture?

This topic is 6129 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I''ve got a very basic question about OpenGL. Unfortunately I didn''t find the answer elsewhere yet (in the www.OpenGL.org manuals for example). I''m no OpenGL programmer, yet, but hopefully in the near future... Say you would like like to use OpenGL to draw bitmaps to the screen: as a bitmap texture on a polygon, where all the 3 or 4 points of the polygon have got the same depth value. Say you would have got a height field of each bitmap as big as the bitmap itself, which has been output by the 3d programm which rendered the bitmap texture. You would like to use this hight field as Z values for each pixel of the polygon. Could I use the z-buffer (called depth buffer?) of OpenGL to make each pixel of the polygons be sorted correctly? Greetings.

Share this post


Link to post
Share on other sites
Advertisement
Hello,

is my previous question too basic or does the silence mean that my described scenario isn''t doable via OpenGL?

Any hint to a source or a "yes" or "no" would be helpful. Thank you very much.

Greetings.

Share this post


Link to post
Share on other sites
no,

u can draw depthvalues to the screen though eg with glDrawpixels( .. GL_DEPTH_COMPONENT ) but this isnt what u want to do

Share this post


Link to post
Share on other sites
Hello,

ok, thank you. This was the right keyword to find some interesting FAQs like http://www.opengl.org/developers/faqs/technical/index.htm#indx0140
But indeed this would mean operations on pixel basis which I'm afraid would be too slow for my kind of program.

The autors of Tropico mentioned that they use a Z depth RLA bitmap for each of their object bitmap to calculate the correct depth of each object on screen (aside the floor I suppose).

The game runs with software (a bit slow) or hardware graphics card (much faster then). Since it also runs on NT and has got some OpenGL-Dlls in its directory, I suppose it uses OpenGL for the drawing?
How can they do a kind of z buffer than for their flat bitmap graphics?

Greetings.


quote:
Original post by zedzeek
no,

u can draw depthvalues to the screen though eg with glDrawpixels( .. GL_DEPTH_COMPONENT ) but this isnt what u want to do




Edited by - Faramir on September 8, 2001 4:19:53 AM

Share this post


Link to post
Share on other sites
what exactlly do u want to use the depth information for?
sorry i dont really understand what youre trying to do.

Share this post


Link to post
Share on other sites
The depth-buffer is view-dependent. A heightmap is view-independent. The only exception is if it is being used as map of z-values when the heightmap is being viewed top-down - in which case no part of the terrain will occlude anything on or above the terrain, or the terrain itself, and would thus eliminate the need for any z-sorting involving the terrain.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Look under alpha testing, this would provide an effect like you want. You can assign an alpha image to the polygon. Then set the alpha test mode to draw only if alpha is less than. You draw the polygon, and it does an in hardware comparison for each alpha value, and updates the values in the frame buffer. I can''t give any specifics (would take me just as much time to find them as you, and my time is more important :-P ). Look under alpha testing.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
actually I think I was misguided, however alpha blending should do what you want to do

Share this post


Link to post
Share on other sites
Thanks to all repliers.
The alpha testing stuff mentioned by "Anonmyous poster" I''ll have a close look at, many thanks.

For what do I need the depth info? Well, like in Tropico I''d like to plot 2d-bitmap rectangles to the screen in an isometric game.

Currently I''ve got an all-software solution, which is very slow.

All objects (ie floor, houses, trees, men, etc) have got an internal 3d-position. For each object I transform its 3d-position (it''s its center for example) to 2d and at this position I plot the bitmap rectangle.
I''ve got a floor with tunnels, bridges, and also many big objects on the floor which use more than a typical isometric "tile". So I''ve got the problem to depth sort all objects before plotting.

Like in Tropico all objects are modelled via a 3d application and then exported to a plain 2d bitmap for my engine. So it was possible to export a kind of "height field" (or rather "depth field" in my case) for each isometric object which I could use for the depth sort.
If I had a z-buffer via OpenGL I could tell OpenGL: please plot a bitmap rectangle (ie texture on a polyon) at position x2d, y2d with an internal z-buffer-position of z_center and further use a "depth field" bitmap for each pixel''s z-buffer-depth of that rectangle.

I''m so sorry for my lousy English. Hopefully you understand what I try to say... :-) If not, please ask and I''ll try to tell it in another way.

Thanks and greetings.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!