Tools to work with Quake game assets in R. Useful for messing with Quake and Quake II game textures. Can read, write, create and export bitmap images in WAL file format and related texture formats. Includes tools to extract WAD and PAK files. Can read Quake and Quake II models in MDL and MD2 formats and allows for exporting to standard mesh formats.
The WAL file format is an old format for storing indexed bitmap images, used as textures in idtech1 and idtech2 games. A single WAL file contains four mipmaps of the same image. WAL format files are indexed but do not contain the palette needed to reconstruct the image. You can use your own palette, or use the Q1 or Q2 palettes that come with this package.
Note that whe WAL textures are stored inside Quake pak file archives (baseq2/pak0.pak
), so you will not see any WAL files in your Quake 2 directory unless you extracted them for mapping or modding. For Quake I, textures in a very similar format that is also supported are stored directly in the BSP level files (which are inside Id1/PAK0.PAK
), or in WAD files.
Managing WAL images:
- Reading WAL format images, including all mipmap levels. By default, the largest version is used.
- Visualization of WAL images in R, including all mipmap levels (requires a palette).
- Export of WAL images to PNG and JPEG format files (requires a palette).
- Two important palettes are included: the Q1 and Q2 palettes.
- Writing of a WAL image instance to a new file in WAL format.
- Converting other images (PNG, JPEG, whatever) to WAL instances and files, including:
- Mapping the colors of the source image to the most similar colors of the target WAL palette. This is done in LAB color space using DeltaE as the similarity measure.
- Generation of the mipmaps.
Related Formats and Features:
- Reading WAD files in the 'WAD2' archive format used by Quake I and related games. These are tar-like archive files that hold collections of Quake assets (colormaps, textures in Q1 Mipmap Texture format, console pics, ...). Note that some games like Daikatana use a similar, but not identical format and still name their archives WAD files. These other WAD-like formats are currently not supported. Please open an issue if you need support for them.
- Extracting WAD archives to a directory.
- Reading, visualizing, and exporting Q1 Mipmap format textures. These are the textures used by Quake I, and they are typically stored directly in the binary maps (BSP files) or in WAD texture archives (see above). The Q1 Mipmap Texture format is very similar to the Quake II WAL format.
- Reading and extracting 'PAK' archives.
- Reading and exporting Quake models, including Quake MDL files and Quake II MD2 files. You can visualize them directly in R with 'rgl' or export them to standard model file formats like '.obj' format to open them in standard modeling software.
I recommend to install the stable wal version from CRAN. In your R session:
install.packages("wal");
To install the development version (no complaints or bug reports, please):
install.packages("devtools");
devtools::install_github('dfsp-spirit/wal')
wal_file = "~/path/to/q2_pak0_extracted/textures/e1u2/basic1_7.wal";
wal = wal::read.wal(wal_file);
plot(wal); # S3 plot method for 'wal' instances, uses preview palette. Alternatively:
wal::plotwal.mipmap(wal, mip_level = 1L, apply_palette = wal::pal_q2()); # Plot with full control.
wal::wal.export.to.jpeg(wal, "~/mytex.jpg", palette = wal::pal_q1(), quality = 0.95);
wal::wal.export.to.png(wal, "~/mytex.png"); # palette defaults to pal_q2().
jpeg_file = "~/mytextures/bricks_256x256.jpg";
wal = img.to.wal(jpeg::readJPEG(jpeg_file));
wal::writeWAL("~/myfile.wal", wal);
For more information, read the detailed vignette that comes with the package. Examples for working with models and archives can be found in the unit tests.
Documentation on the WAL format seems sparse. I did not find any official spec so I used the Quake 2 source code to learn about the format. Relevant files are:
wal's People
Forkers
classicvaluesRecommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.