You are an expert graphics programmer (GLSL, OpenGL, real-ti...
Prompt
You are an expert graphics programmer (GLSL, OpenGL, real-time rendering, Minecraft client development). Build ONLY a real-time, physically-inspired BLACK HOLE SIMULATION that looks like "Gargantua" from the movie Interstellar, as a reusable standalone renderer component for my custom Minecraft client. SCOPE - READ CAREFULLY - I want the SIMULATION ENGINE ONLY. I will build the main menu, buttons, text, logo, settings panel and all other UI myself. - DO NOT create: a main menu, buttons (singleplayer/multiplayer/etc.), titles, logos, taglines, "director panel", sliders, settings UI, overlays, HUD text, or any decorative UI. The output must be just the black hole filling a rectangle, nothing drawn on top of it. - DO NOT handle input inside the renderer. I will pass mouse position / scroll / time into it through simple setter methods. TARGET ENVIRONMENT - Minecraft Java Edition 26.2 (year-based versioning, unobfuscated game code), Java version: [WPISZ, np. 25], loader: [WPISZ, np. Fabric]. - Vulkan is the default backend in 26.2; my client FORCES the OpenGL 3.3 Core Profile before window creation. So write for OpenGL 3.3 core: GLSL "#version 330 core" and LWJGL 3 GL33 calls. No legacy / fixed-function API. - The renderer must be fully state-safe: save and restore bound program, VAO, VBO, FBO, active texture and bindings, viewport, blend, depth test, cull face and scissor, so Minecraft's own rendering is never broken. - HONESTY RULE: if you are not 100% sure a Minecraft-internal class/method exists in 26.2, do not invent it. Keep Minecraft-specific code to an absolute minimum and mark uncertain calls with "// VERIFY:". The renderer itself should use plain LWJGL/OpenGL only. - Must run at stable 60 FPS on a mid-range GPU and degrade gracefully on integrated GPUs. VISUAL REFERENCE (match this look) - Pitch-black spherical event horizon shadow. - Thin, tilted accretion disk (about 10-15 degrees inclination) in warm colors: white-hot inner edge fading to orange, copper and dark brown outward. - Gravitational lensing: the far side of the disk is bent over the top and under the bottom of the hole, forming the iconic halo / ring around the shadow. - Thin, bright photon ring hugging the edge of the shadow. - Relativistic Doppler beaming (approaching side brighter and whiter-blue, receding side dimmer and redder) and gravitational redshift near the horizon. - Turbulent streaky disk texture (procedural fbm / simplex noise stretched along the orbital direction) with differential rotation (inner parts rotate faster). - Dark space background with sparse, tiny, gravitationally lensed stars (arcs / Einstein-ring effect near the shadow). - Subtle post-processing: soft bloom, light vignette, very subtle film grain, ACES/filmic tonemapping. Cinematic, not oversaturated. FRAMING (important) - Default framing must show the ENTIRE black hole: the full shadow, the full disk with its lensed halo, and some empty starfield around it. The shadow should be roughly 25-30% of the render height at default zoom. Do NOT crop or zoom into a small part of it. - The render rectangle can have any aspect ratio (x, y, width, height passed by me), keep correct aspect and never stretch the picture. MOVEMENT (the black hole must feel alive) - The black hole itself MOVES on screen: it slowly drifts along a smooth Lissajous / figure-8 path across the frame (a few percent of screen size, period ~40-90 s), with gentle easing, never jerky. - The camera slowly orbits and breathes (tiny zoom in/out) and the disk inclination slowly oscillates a few degrees; the disk wobbles / precesses slightly. - Disk differential rotation is always running; add slow pulsing brightness flares moving through the disk. - Optional subtle extra: occasional distant stars/objects drifting behind the hole so the lensing is visible in motion. - All motion speeds are controlled by one "motionSpeed" multiplier and can be disabled with setMotionEnabled(false). - Smooth parallax: setMouse(nx, ny) in range -1..1 slightly shifts camera and black hole position (smoothed internally), default 0. TECHNIQUE - Single full-screen fragment shader. Per pixel, integrate the null geodesic in Schwarzschild spacetime (light bending approximation a = -1.5 * h^2 * r_vec / r^5 with h = |cross(pos, vel)|, RK2/RK4 or adaptive step). - Detect accretion disk plane crossings (inner ~2.6 Rs, outer ~12 Rs) with correct ordering so the disk can be crossed multiple times (front, lensed top, lensed bottom), accumulate emission and Doppler/redshift color shift. - Terminate on horizon crossing (black) or escape (sample lensed starfield by final ray direction). - Slight vertical thickness / falloff so the disk is not a perfectly flat sheet. - Performance: adaptive step size, early exit, configurable max steps, optional internal render at 50-100% resolution into an FBO, then bilinear upscale + bloom. Quality presets LOW / MEDIUM / HIGH via setQuality(). Optional auto-quality that lowers internal resolution when FPS drops below 60. PUBLIC API OF THE RENDERER (keep it this simple) - BlackHoleRenderer(): constructor creates GL resources. - render(int x, int y, int width, int height, float partialTick): draws the simulation into that rectangle (full window background is just the full size). - setMouse(float nx, float ny), setZoom(float), setQuality(Quality), setMotionEnabled(boolean), setMotionSpeed(float), setDiskBrightness(float), setDiskInclination(float degrees), setExposure(float), setBloom(float). - resize(int w, int h) if needed, close() to free all GL resources. DELIVERABLES (in this exact order) 1. A single-file HTML (WebGL2, no libraries) preview: just a fullscreen canvas showing the simulation with the same motion, NO UI of any kind (no text, no buttons, no panels), so I can judge the look in a browser. 2. The final GLSL 330 core shaders (vertex + fragment), cleanly commented. 3. Java code: ShaderProgram helper (compile, link, uniforms, info-log error output) and BlackHoleRenderer with the API above, plus a 5-10 line example of calling render() from a screen's render method. Nothing else. 4. A short list of tweakable constants. QUALITY REQUIREMENTS - Complete, copy-paste-ready, compiling code. No pseudo-code, no "..." placeholders. - Correct GLSL 330 core (in/out, texture(), declared output color). - Prioritize how it LOOKS: breathtaking, close to the reference, smooth in motion, while staying real-time.
Response not available