36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import numpy as np
|
|
import imageio.v3 as iio
|
|
|
|
# --- Parameters ---
|
|
WIDTH, HEIGHT = 1024, 1024
|
|
CENTER_X, CENTER_Y = WIDTH // 2, HEIGHT // 2
|
|
RADIUS = 150
|
|
BACKGROUND_COLOR = 0.0 # Pure black
|
|
# This is the key change: A "super-white" HDR value for the circle.
|
|
# A value of 5.0 simulates a very bright light source.
|
|
CIRCLE_BRIGHTNESS = 5.0
|
|
OUTPUT_FILENAME = "halation_test_hdr.tiff"
|
|
|
|
# --- Generate the image ---
|
|
# Create coordinate grids
|
|
y, x = np.mgrid[:HEIGHT, :WIDTH]
|
|
|
|
# Calculate distance from the center
|
|
distance = np.sqrt((x - CENTER_X)**2 + (y - CENTER_Y)**2)
|
|
|
|
# Create a circular mask
|
|
mask = distance <= RADIUS
|
|
|
|
# Create a 3-channel float image
|
|
# Use float32, as it's a standard for HDR images
|
|
image_hdr = np.full((HEIGHT, WIDTH, 3), BACKGROUND_COLOR, dtype=np.float32)
|
|
|
|
# Set the circle area to the super-white value
|
|
image_hdr[mask] = [CIRCLE_BRIGHTNESS, CIRCLE_BRIGHTNESS, CIRCLE_BRIGHTNESS]
|
|
|
|
# --- Save the image ---
|
|
# Save as a 32-bit float TIFF to preserve the HDR values
|
|
iio.imwrite(OUTPUT_FILENAME, image_hdr)
|
|
|
|
print(f"✅ Saved HDR test image to '{OUTPUT_FILENAME}'")
|
|
print(f" Use this file as the input for your film simulation script.") |