Skip to main content

Module noise

Module noise 

Source
Expand description

Port of MD2’s procedural noise textures (plugin.cpp AddNoiseTex / AddNoiseVol, fCubicInterpolate, dwCubicInterpolate).

MD2 seeds its generator from QueryPerformanceCounter; here every texture is generated from the renderer’s seeded Rng, so the algorithm (value range, 8-bit packing quirks, cubic smoothing lattice) is MD2’s and the content is deterministic per seed. To match the reference render bit-for-bit, inject its dumped noise with Renderer::inject_noise (feature diagnostics).

Sizes (plugin.cpp Init): noise_lq 256/zoom 1, noise_lq_lite 32/1, noise_mq 256/4, noise_hq 256/8, noisevol_lq 32/1, noisevol_hq 32/4.

Constants§

ALL_NOISE
All six textures in NoiseTex::index() order.

Functions§

builtin_image_noise
The built-in 2D textures projectM’s TextureManager has registered before it scans any directory (TextureManager::Preload): a shape’s image= of exactly one of these names samples it and never reaches the file lookup. (idlem / idleheadphones are embedded PNGs; the 3D noisevol_* volumes bound to a 2D sampler are undefined behaviour upstream.) name is compared as is: projectM’s lookup is case-sensitive.
gen_noise_tex
AddNoiseTex: sizexsize RGBA8, row 0 first.
gen_noise_vol
AddNoiseVol: size^3 RGBA8, slice (z) major, then row, then x.
generate
Generate one of the six built-in textures as RGBA8 (2D: row 0 first; 3D: z-major slices).
noise_spec
(size, zoom_factor, is_volume) for each built-in noise texture.