4 ms·
I've been teaching myself POV-ray with an eye towards using it to render 2D sprites for indie games. Thinking about how 3D rendered scenes could be tile-ized le
by phaedrus 4y ago
I've been teaching myself POV-ray with an eye towards using it to render 2D sprites for indie games. Thinking about how 3D rendered scenes could be tile-ized lead me to an epiphany last night about a difference between Diablo 1 and later Diablo's that I could never put my finger on before what I was seeing.
When a game uses the same bitmaps for terrain tiles at the edges of the screen as at the center, it necessarily emulates an orthographic camera. Put another way, if you render a scene with the default non-orthographic 3D camera, terrain elements at different positions on screen will be seen at slightly different angles. The effect is minimized if you use a far-off camera with a narrow field of view, but it never goes away completely.
(The same effect applies to sprites, but it would be less noticeable than with architectural elements.)
Diablo 1 used true 2D graphics whose tile bitmaps don't change no matter where they fall in the field of view - therefore, orthographic. Diablo 2 was a 2D/3D hybrid that painted the visible landscape onto a single giant triangle mesh (used in a non-standard way). And Diablo 3 and later of course were simply 3D graphics.
I always felt there were things about the mood and atmosphere of Diablo 1 that were lost when another team made Diablo 2, and then further left behind with Diablo 3. I now realize it's also analogous to the difference between the 2D Zeldas and the 3D Zeldas in an almost literal way.
(The use of 3D tech in the original Diablo 2 engine was weird. I don't know if it's because the programmers misunderstood how 3D meshes are "supposed to" be used, or if it was an optimal way to do it given the hardware and APIs of the time. Most 3D engines would use a dedicated, usually unchanging, mesh object for each chunk of terrain and load/unload these chunks as needed thus loading/unloading meshes. The developers of Diablo 2 seemed to consider generation of their terrain mesh expensive (it shouldn't be) and changing their terrain mesh less expensive (not true for VBOs). What the did was generate only one mesh, one time for the entire visible playfield, and just vary the vertex height and UV map of the entire thing as you walk around the level. The algorithm is rather like draping a sheet over the ground and dragging the sheet over rocks and bumps as you walk around.
This had the side-effect that the graphics would go crazy in Diablo 2 if you used a mod to set the screen resolution higher than ~ 1440x900. The problem was that they used 16-bit indices for the triangle list, and using one giant mesh of tiny triangles overflows the available number of unique indices representable with a 16-bit int. (Investigating this problem is what led me to figure out everything in the previous paragraph. I worked all of it out from first-principles once I realized the cause of the screen resolution problem.)
- Arrath 4y agoHuh. That is a very interesting tidbit, thanks for sharing! So in essence the character just stood in the middle of a singular big mesh and the world was rendered to that viewport as you moved it around?