Jump to content
  • Advertisement

Archived

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

Goodlife

Lightmaps & Diablo II

This topic is 6536 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

Hi all, I finally got Diablo II, and was studying the lightmapping they do in it. It looks to me like they have three kinds of graphics... the floor graphics, which get lit on a per-pixel basis... the was graphics, which are horizontal strips and get lit by the position of the bottom pixel, and ''whole'' graphics, which are lit in entirety by one point position (usually the bottom center... or, in the case of a tree, the bottom of the trunk). Looks nice. The question I have is, how are they doing it so fast? I wrote a lighting 2d tile-based engine like this about 8 months ago, and I experienced terribly slowdowns because of all the checking to see how bright each point would be (and yes, my vertical objects were in strips, like Diablo II). As far as I can tell, Diablo has two ''layers'' (possibly 3, with a Z layer). The first layer is the light layer, which would just say how bright each vertex would be. The second layer is the view layer, which just contains real pixel info. How are they rendering the two of these together so quickly? When I did it, in machine code, I never got above 20FPS, and that was with crappier lighting than Diablo II. And my other question is... does anyone know offhand if Diablo II''s graphic memory is in video memory, or system? It seems like it can''t be in video, because they are doing fancy-shmancy alpha-blending, which would be a real speed killer in vidmem... but I was wondering if anyone knew for sure. Thanks a million! (BTW... if anyone else is writing a game like Diablo II, with tons and tons of graphics... PLEASE... it is far better to wait for them to load between levels rather than load them ''real time.'' I have gotten killed about fifty times because the game started jittering as it loads new images in). -- Goodlife ----------------------------- Those whom the gods would destroy, they first drive mad. --DirectX design team official motto

Share this post


Link to post
Share on other sites
Advertisement
Diablo II uses 3D hardware acceleration for their cool lighting. If you turn off 3D lighting (or go with low quality, not sure how the options present it) you don''t get all the cool looking lighting affects. I don''t have enough 3D experience to know how they do it, but that''s what they''re using to do it fast. That''s really the only way to do it fast.

Share this post


Link to post
Share on other sites
They are not lighting things on a per-pixel basis! They only calculate the lighting on the tile corners and then interpolate them across the tile. This process is done with the hardware support and looks perfect if the lighting grid is small enough. If you reduce the detail of the lighting in the options menu, you''ll notice how the light-blotches on the floor will become coarser and coarser. This is because the sampling grid for the light becomes smaller (only 64x64 samples used, instead of 128x128). Of course the numbers are not correct. It''s just to illustrate a point.

Hope someone besides me can understand these ramblings,

MK42

Share this post


Link to post
Share on other sites
Also, in software mode Diablo 2 uses the good old 8 bit palettized mode. (I know this because my old video card was a bit ... well, old and sometimes the palette got a bit erratic [isn''t RGB 255-0-255 a nice color?] and I had to Alt-Tab in and out to get my colors back).
Well I''ve thought a bit about what they might be doing:
For the terrain you seem to need two things, regardless of being in a dungeon or not: walls & floor. I''m not sure but I guess you could make all those things with 8 colors (or at worst 16) devoted for floor and ground respectively. Like this:
Colors 0- 7: floor very dark
Colors 8-15: floor quit dark
Colors 16-23: floor normal
Colors 24-31: floor bright (for lightning spells)
Colors 32-39: floor reddened (for fire spells)
and so on.
I think you could be a bit more generous with the colors but I think you get the system. So a darker piece of floor is just:
NormalFloorColor - 8 * DarknessLevel and so on.

However I don''t know for sure how Blizzard does it. What I wrote is what I guessed.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!