Skip to content
Myr

README.md

This file

Path

tests/caveview/README.md

85 lines · 3.4 KiB · Markdown

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than aeec66c point at it.

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 1–85why, one step back
1# FAQ
23### How to run it?45There's no GUI. Find a directory with Minecraft Anvil files (.mca).6Copy a Minecraft "terrain.png" into that directory (do a google7image search). Run from that directory.89### How accurate is this as a Minecraft viewer?1011Not very. Many Minecraft blocks are not handled correctly:1213* No redstone, rails, or other "flat" blocks14* No signs, doors, fences, carpets, or other complicated geometry15* Stairs are turned into ramps16* Upper slabs turn into lower slabs17* Wood types only for blocks, not stairs, slabs, etc18* Colored glass becomes regular glass19* Glass panes become glass blocks20* Water is opaque21* Water level is incorrect22* No biome coloration23* Cactus is not shrunk, shows holes24* Chests are not shrunk25* Double-chests draw as two chests26* Pumpkins etc. are not rotated properly27* Torches are drawn hackily, do not attach to walls28* Incorrect textures for blocks that postdate terrain.png29* Transparent textures have black fringes due to non-premultiplied-alpha30* Skylight and block light are combined in a single value31* Only blocks at y=1..255 are shown (not y=0)32* If a 32x32x256 "quad-chunk" needs more than 800K quads, isn't handled (very unlikely)3334Some of these are due to engine limitations, and some of35these are because I didn't make the effort since my36goal was to make a demo for stb_voxel_render.h, not37to make a proper Minecraft viewer.383940### Could this be turned into a proper Minecraft viewer?4142Yes and no. Yes, you could do it, but no, it wouldn't43really resemble this code that much anymore.4445You could certainly use this engine to46render the parts of Minecraft it works for, but many47of the things it doesn't handle it can't handle at all48(stairs, water, fences, carpets, etc) because it uses49low-precision coordinates to store voxel data.5051You would have to render all of the stuff it doesn't52handle through another rendering path. In a game (not53a viewer) you would need such a path for movable entities54like doors and carts anyway, so possibly handling other55things that way wouldn't be so bad.5657Rails, ladders, and redstone lines could be implemented by58using tex2 to overlay those effects, but you can't rotate59tex1 and tex2 independently, so there may be cases where60the underlying texture needs a different rotation from the61overlaid texture, which would require separate rendering.62Handling redstone's brightness being different from underlying63block's brightness would require separate rendering.6465You can use the face-color effect to do biome coloration,66but the change won't be smooth the way it is in Minecraft.676869### Why isn't building the mesh data faster?7071Partly because converting from minecraft data is expensive.7273Here is the approximate breakdown of an older version74of this executable and lib that did the building single-threaded.7576* 25% loading & parsing minecraft files (4/5ths of this is my crappy zlib)77* 18% converting from minecraft blockids & lighting to stb blockids & lighting78* 10% reordering from data[z][y]\[x] (minecraft-style) to data[y][x]\[z] (stb-style)79* 40% building mesh data80* 7% uploading mesh data to OpenGL8182I did do significant optimizations after the above, so the83final breakdown is different, but it should give you some84sense of the costs.85