Comments (1)
This is an example of how an implementation might look, from a mapper's perspective:
KVs
Only _ewt_embedlightmap
, _ewt_embedlightmap_resolution
, and _ewt_embedlightmap_writeext
are probably integral, but I figured I'd list some other KVs that have features which could be useful.
KV | Type | Explanation |
---|---|---|
_ewt_embedlightmap |
bool | Enable "embedded" lightmaps (equivalent to zhlt_embedlightmap ) |
_ewt_embedlightmap_resolution |
uint | Luxel density; defaults to same density as regular lightmaps (ex: 16:1 texels to luxels) |
_ewt_embedlightmap_subdivsize |
uint | Max texture resolution to use before subdividing. 256 should be a safe default (being the max res supported by GoldSrc's software renderer, as well as the Voodoo 1). |
_ewt_embedlightmap_intensity |
float | Scale the obviousness of the lightmap; default 1.0. Useful for creating stuff that will be turned into static prop models, which will be vertex-lit by the engine. |
_ewt_embedlightmap_writeext |
bool | Write external textures; always enabled for Q2BSP |
_ewt_embedlightmap_extformats |
csv | List of formats to write external textures as; default is TGA (formats: BMP, PCX, PNG, TGA, WAL). |
_ewt_embedlightmap_compressext |
bool | Enable (additional) compression for supported formats (formats: 24-bit PNG - 256-color paletted, 24-bit TGA - RLE compression, 32-but PNG - 255-color paletted with 1-bit alpha if extbinaryalpha is enabled). |
_ewt_embedlightmap_extbinaryalpha |
bool | Allow binary alpha for supported formats (just PNG atm, being the 255-color paletted with 1-bit alpha, if compressext if enabled), as not all engines support such |
Output location
External textures are written to the following folders, depending upon output BSP format:
Q1BSP: <moddir>\textures\
Q2BSP: <moddir>\textures\<mapname>
HLBSP: <moddir>\materials\<mapname>
Naming
Textures are automatically named to avoid conflicts, and to avoid breaking functionality. A 10-character hash is generated for the name; if two generated textures are identical, then both faces will use the same texture. The first three characters of the original texture name are retained, which ensures that most special prefixes still work ({
, !
, #
, *
, +x
, -x
, ~
, @
, etc.), with the exception of HLBSP scrolling textures (as those wouldn't look nice with embedded lightmaps anyway). To keep the embedded lightmaps from intermingling with regular textures when using Q1BSP external textures in the mapper's filesystem, the string l_
is be placed between the three prefix characters and the hash.
So a texture name might look like this: +0~l_e2cfc89fae
Bloat
When embedded lightmaps are used with an animated, toggled, or randomly tiled texture set, baked versions of all possible textures are created. Naturally, that will exponentially increase file size, but such a use-case is unlikely to be common.
Additional notes
- BMP and PCX are always written as 8-bit.
- 32-bit TGAs are left uncompressed regardless of
_ewt_embedlightmap_compressext
, because the vanilla engines and many derivatives don't read RLE-compressed 32-bit TGAs correctly. 24-bit TGAs can be RLE-compressed with no issues. - Bit depth notes:
- With the exception of WAL files and embedded Q1BSP miptex, generated 8-bit paletted textures use their own autogenerated palette.
-
- When it comes to open-source palettization algorithms, Wadmaker's results in much more accurate results than GIMPs.
-
- Alphatest textures probably should treat the alpha index as #ff00ff regardless of palette, in order to avoid issues with dithering.
-
- Q1BSP miptex should assume a no-fulbright palette, but this might need to be a disableable function for Hexen 2 support.
- Other external formats could be added (ex: DDS, JPG, M8, M32); I only listed the ones that would be useful for Quake I+II and GoldSrc support. The KVs above were written with expandability in mind.
-
- Example of DDS:
_ewt_embedlightmap_extbinaryalpha
would cause generated DDS textures with transparency to use DXT1 instead of DXT5 or BC7
- Example of DDS:
-
- Example of JPG:
_ewt_embedlightmap_compressext
would result in a compression level of 90 instead of 98, or maybe it would enable chroma subsampling (which I usually disable for JPEGs myself)
- Example of JPG:
- I originally didn't list BMP, but then I realized that this feature could be useful for creating static props, and HLMDL uses BMP textures.
- GoldSrc doesn't support external textures (the path above is what Xash uses), but it'd still be useful to be able to write them externally for use-cases such as the aforementioned brush-styled MDLs.
- VHLT's
zhlt_embedlightmapresolution
apparently results in downscaling the texture (to save file size, allegedly). I don't think it makes sense to implement an equivalent; users can downscale the texture beforehand.
from ericw-tools.
Related Issues (20)
- The LMSHIFT lump is not generated in 2.0.0-alpha4 HOT 1
- -bouncedebug doesn't work. Result all black
- -tex_saturation_boost changes texture overall brightness.
- Textures issues with the new compiler HOT 11
- Phong does not seem to be working right. HOT 4
- _surface_radiosity missing from docs
- relative lip requirements HOT 2
- Special texture for decompiled output? HOT 3
- Translucency support HOT 2
- Describe light-specific BSPX lumps in docs
- -bouncedebug broken
- Origin brush into a func_door_rotating cause a leak when using region+ on a map HOT 2
- [Feature] _illusionary on any entity to disable collision (like ZHLT's zhlt_noclip) HOT 3
- Q2RE PMove(in a Q2RTX fork) and CONTENTS_LADDER. HOT 4
- Region brush doesn't cull brush entities
- _bouncecolorscale seems to have no effect HOT 3
- [idea] speed up lightgrid calculation HOT 2
- 2.0.0-alpha8 fails to build with embree4
- Compilation on Windows is too complicated. HOT 2
- Allow retention of texture names and coordinates for non-Quake games HOT 2
Recommend 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.
from ericw-tools.