b723ef9828
Horizon stretched a quarter of rain.png over each whole column, up to 20 blocks tall, so streaks were about five times too long. Vanilla advances v by a quarter per block and lets the sampler repeat, so the texture repeats every 4 blocks. Port createRainColumnInstance, createSnowColumnInstance and prepareInstances exactly (seeded column speed, game-time scroll, snow drift and brightening, camera-block size table, square radius from the Weather Radius option, alpha falloff, precipitation at the camera's y), and split each quad at the texture seams so the atlas sprite repeats. tools/test_weather_render_parity.py compares the columns and quads with the shipped renderer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.8 KiB
Python
40 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Compare rain and snow column instances and quads (positions, texture coordinates, alpha, light) with 26.3."""
|
|
import random
|
|
|
|
try:
|
|
from . import lab, oracle_harness as harness
|
|
except ImportError:
|
|
import lab, oracle_harness as harness
|
|
|
|
|
|
def make_input(build):
|
|
rng = random.Random(71)
|
|
cases = []
|
|
for kind in (0, 1):
|
|
for ticks in (0, 1, 511, 512, 131071, 131072, 24000 * 37 + 5, 9_000_000_123):
|
|
for x, z in ((0, 0), (1, 0), (0, -1), (3, 7), (-10, 10), (10, -10), (-4, -9), (1_000_003, -2_000_011)):
|
|
for bottom, top in ((60, 80), (64, 65), (-64, -44), (300, 310)):
|
|
light = (rng.randrange(16) << 4) | (rng.randrange(16) << 20)
|
|
partial = rng.choice(("0.0", "0.5", "0.999", f"{rng.random():.6f}"))
|
|
cam = (x + rng.uniform(-10.5, 10.5), rng.uniform(bottom - 5, top + 5), z + rng.uniform(-10.5, 10.5))
|
|
camera = " ".join(f"{c:.9f}" for c in cam)
|
|
radius = rng.choice((3, 5, 10))
|
|
intensity = rng.choice(("1.0", "0.25", f"{rng.random():.6f}"))
|
|
cases.append(f"{kind} {ticks} {x} {bottom} {top} {z} {light} {partial} {camera} {radius} {intensity}\n")
|
|
# The camera's own column: the size table divides 0 by 0.
|
|
cases.append("0 100 5 60 80 5 240 0.0 5.5 70.0 5.5 10 1.0\n")
|
|
inputs = build / "inputs.txt"
|
|
inputs.write_text("".join(cases))
|
|
return inputs, len(cases)
|
|
|
|
|
|
def main():
|
|
harness.differential("weather-render-parity", "VanillaWeatherRenderOracle", "weather_fixture", make_input,
|
|
"Rain/snow column instances and quad vertices; not full framebuffer parity.",
|
|
sources=[lab.ROOT / "crates/horizon-client/src/weather.rs"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|