Jump to content

  • Log In with Google      Sign In   
  • Create Account

Height field bitmap and texture?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Faramir   Members   -  Reputation: 122

Like
Likes
Like

Posted 04 September 2001 - 03:06 AM

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.

Sponsor:

#2 Faramir   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2001 - 03:16 AM

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.


#3 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 07 September 2001 - 12:18 PM

no,

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

#4 Faramir   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2001 - 09:09 PM

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

#5 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 07 September 2001 - 10:37 PM

what exactlly do u want to use the depth information for?
sorry i dont really understand what youre trying to do.

#6 TerranFury   Members   -  Reputation: 142

Like
Likes
Like

Posted 08 September 2001 - 01:23 PM

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.

#7 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 September 2001 - 01:42 PM

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.

#8 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 September 2001 - 02:02 PM

actually I think I was misguided, however alpha blending should do what you want to do

#9 Faramir   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 September 2001 - 09:34 PM

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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS