MoonTex is a noise-based texture generator that creates realistic grayscale moon phase images.
Project description
MoonTex v0.2.1
MoonTex is a noise-based texture generator that creates realistic grayscale moon phase images with customizable lighting, crater intensity, and export options for use in games, apps, and procedural art.
- Powered by Python, Pillow, and Noise.
- Creates 8 lunar phases from a single API.
- No dependencies beyond core libs + 2 lightweight packages.
Example Usages
You probably already know what you're going to use MoonTex for but here are some example usages if you need ideas.
Day/Night Cycle Skybox
Here's an example of MoonTex being used in a raycasting demo made with Tkinter and CQCalendar. The player is in a walled off grassy area with a pond in the middle. Underneath the 2D minimap, you can see the current time/date/moon phase. Time passes on an hourly basis. As day turns into night an image of the moon is shown in the sky based on the current moon phase.
Dependency Installation
pip install -r requirements.txt
How to Generate a Single Moon Phase Texture
#Initialize Generator
generator = moontex.MoonTex()
#You can specify the output directory if you want. Specify a moon phase name.
generator.export_moon_phase_image(output_dir=".", phase="Full")
How to Generate All Moon Phase Textures
#Initialize Generator
generator = moontex.MoonTex()
#You can specify the output directory if you want. Specify a moon phase name.
generator.export_all_moon_phase_images(output=".")
Customization Options
MoonTex(
# --- Core image settings ---
image_size=300, # int or (width, height)
bg_color=(5, 5, 20), # background RGB (used if not transparent)
# --- Noise / surface detail ---
noise_scale=0.01, # simplex noise scale
octaves=3, # noise octaves
persistence=0.5, # noise persistence
lacunarity=3, # noise lacunarity
seed=0, # deterministic seed
intensity=0.4, # crater contrast (0–1)
invert_crater_noise=True, # invert crater depth
# --- Brightness ---
brightness=(50, 230), # grayscale min/max
# --- Rendering options ---
transparent_background=False,# RGBA output if True
padding=4, # space between moon edge and image border
edge_softness=1.5, # soft edge blend (0 disables)
# --- Shadow / dark side behavior ---
shadow_factor=0.15, # darkness strength (0–1)
shadow_mode="bg", # "bg" (blend to bg_color), "neutral" (darken toward black, skybox-safe)
dark_floor=0.0, # minimum dark-side visibility (0 = can disappear)
)
Skybox Usage (Raycasting, Overlays)
MoonTex(
transparent_background=True,
shadow_mode="neutral",
dark_floor=0.0,
)
Standalone Image Usage
MoonTex(
transparent_background=False,
shadow_mode="bg",
)
Valid Phases
- "New"
- "Waxing Crescent"
- "First Quarter"
- "Waxing Gibbous"
- "Full"
- "Waning Gibbous"
- "Last Quarter"
- "Waning Crescent"
Related Libraries
- CQCalendar: A lightweight, tick-based time and calendar system for Python games and simulations.
- TerraForge: A versatile Python toolset for procedural map generation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moontex-0.2.1.tar.gz.
File metadata
- Download URL: moontex-0.2.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98e59ee153702ea8c3e90aae87b695496f452db21411ee8a537c0ec9a42bacd2
|
|
| MD5 |
5feefe539e0e44e8cfa10c7309233f55
|
|
| BLAKE2b-256 |
56a43c02feea1c3d6cdda06f397c8d02044ea887184ac5322cd6a59697119969
|
File details
Details for the file moontex-0.2.1-py3-none-any.whl.
File metadata
- Download URL: moontex-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d584a6ac85ed600093fb2a5aa3b23662b1f6788c13181bd484ee4f14678b7c4
|
|
| MD5 |
44a636d4a9ee0704535174bbd09095b2
|
|
| BLAKE2b-256 |
511fc8c347592f183492ff8201fe5667fcc6a016e9cdff81dcdbe616322c5010
|