Repository navigation
Crate Refactoring, Scene Graph improvements, added deferred lighting, removed old preprocessor effects/shaders (added some core new ones), and more. - #90
Merged
Conversation
…standards (and improve iterative build speeds). - Grouped similarly-type engine source as crates (`joy-core`, `joy-input`, `joy-renderer`, etc.). - Updated rules, documentation, and standards. - Fixed an issue with `dist-rust` build artifacts getting checked-in (they now go to `dist` subfolders as intended). - Still in flight: - Editor and tools refactor/reorganization as-needed. - Examples as crates (potentially).
…he base source file.
… `.test.rs` rust test file as a separate binary to generate.
…ly made updates to some manually-authored files that go against rust formatting rules that have no nice overrides.
…nified vehicle physics with interpolated presentation. - Corrected sRGB output and centralized presentation timing for temporal effects. - NOTE: This requires some per-project color tuning as well as ensuring SDR/HDR output are both still being handled properly. - Unified rendering pipeline to fix transparenct render ordering and effect layering; as part of this work also: - Consolidated scene-effect attachments (various framebuffers) - Added depth prepasses and shadow culling. - Properly support gpu texture mipmaps. - Lighting refactoring and unification: - Shared light definitions across simulation and rendering. - Added ground-bounce logic to Skylights. - Exposed shadow-casting on particle lights as an option (instead of always being off, just off by default now). - Added logic to rank point lights per view instead of rejecting oversized light lists (leading to a hard crash). - Consolidated terrain into the scene renderer and migrated the terrain example and statistics away from the standalone rendering path. - Refactored vehicles as a child of the more general physics bodies struct; it was previously a discrete entity type and extra sim loops. - Added interpolated body and wheel poses for smooth presentation between fixed steps.
…den-file testing. - Added native and browser HDR presentation with display headroom tracking, SDR fallback, and consistent UI brightness. - Added adjustable scene resolution with bicubic upscaling while keeping UI and final display processing at full resolution. - Centralized golden-file comparisons and fixture updates, migrated recorded suites, and exposed test support to consuming games. - Updated the UI initialization contract for display output and removed retired TypeScript reference assumptions.
… deferred rendering and more explicit renderer typing (and less duplication). Updated post-processing effects and removed legacy ones. Also added engine profiling, g-buffer visualization, and a barebones debug console. - Separated GPU-free mesh, material, and light contracts into joy-render-types, added material slots and layered/custom shading, and migrated engine consumers. - Added deferred lighting and support for up to 1024 clustered point lights, and rebuilt shadow mapping and image-based lighting. - Rebuilt bloom, tone mapping, and scene effects with filmic and ACES 2.0 transforms, temporal antialiasing, motion blur, adaptive exposure, and volumetric fog, while retiring legacy grading and screen-space effects. - Added a development console, rendering debug views, and CPU/GPU frame profiling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This crate reorganization grew in scope a bit but refactoring the engine into crates proved to be a useful time to also revisit functionality and ensure holistic architectural changes were building towards a more coherent core.
Lighting and Sky
IndirectLighting::CapturedSky) the renderer fills it from the live sky whenever the sun, moon, skylight, wind, or sky settings change, so ambient light and reflections follow the time of day, scattering, and clouds instead of a fixed environment map.IndirectLighting::Skylightkeeps the flat two-color skylight, andIndirectLighting::Imagelights a frame with a prepared environment image.FrameInputs::indirect_lightingreplacesimage_lighting;SkyCaptureOptions(RendererOptions::sky_captureandRenderer::set_sky_capture) sets the probe size, samples, and refresh interval, andRendererDiagnostics::sky_capturescounts captures. See ambient light.ambientDiffuse,ambientSpecular, andenvironmentBrdf(inlighting-probe.wgsl) in place ofambientIrradiance,environmentDiffuse, andenvironmentSpecular; registration reports models that still use the old names.EnvironmentLightingis a named record (environment_seconds,sun,moon,key_light,skylight,wind_velocity, andsky: SkyOptions) in place of packed arrays, andSkyOptionskeeps only settings the sky renders:atmosphere(rayleigh,mie, andhorizon_warmth, formerlyozone),clouds(coverageanddensity), andsun_halo(intensityandcloud_occlusion). Removed the fog density, cloud altitude and thickness, light-shaft decay and exposure, and ambient occlusion settings, which nothing rendered; the volumetric fog scene effect is the engine's fog.ToneMapper::Aces) and its OpenColorIO notice; filmic, AgX, and none remain.r.ScreenPercentagelosing fractional values, and profiling reporting an older frame than the newest finished one.Meshes, Materials, and Animation
standardshading model (StandardSurface: base color, metallic, roughness, F0 and F90, emissive, occlusion strength, and normal scale) replaces layered shading, with base color, normal, emissive, and packed occlusion-roughness-metallic maps (StandardMaps); coat, sheen, haze, and thin film were removed until a game needs them as their own models. FORM palettes and FORM LAB use the packed map.Meshcarries optional channels: tangents with handedness, any number of texture coordinate sets (uv_sets), joint influences, and morph targets. The glTF loader reads them (normals are optional), and normal mapping uses authored tangents.joy-animationcrate (joy_engine::animation): skeletons, skins, poses, and sampled animation clips, GPU-free.Shared Code
TextureCachefor embedded images (replacingParticleTextureSetandFormTextureCache), data URL and base64 handling injoy-core, the GLB container injoy_engine::dcc::glb_container(shared by the loader and FORM LAB export), FORM documents injoy_engine::form::document(FORM LAB, Joy Editor, levels, and examples read.formlabfiles the same way),OrbitControlsfor every orbit viewport, and shared full-screen, color, texture, and sampler helpers in the renderer.geometrybuilders becameshapes(fans, circles, rings, and segments written through aShapeSink), which particles also use; single triangles, squares, polygons, and baked-lightShadedShapes moved into the games that draw them.Naming
OrbitCamera(content_radius,yaw_radians, andpitch_radians),FrameInputs::key_light,EnvironmentFrame::key_light,RendererOptions(draw_skyandprefer_deferred),RendererDiagnostics(adapter_name,visible_instances,culled_instances,point_lights_drawn,deferred_active,deferred_lighting_passes, andunregistered_model_submeshes),GpuCapabilities(supports_compute,supports_timestamps, andsupports_deferred),ShadowOptions(max_point_face_size,max_shadowed_point_lights, anddirectional_shadow_distance),PointLight::radiance,ImageLighting::rotation_radians, andVolumetricOptions::key_light_intensity.Engine Organization
tests/unit/to sit beside the module they test as<file>.test.rs(mesh.rsandmesh.test.rs), declared with a same-folder#[path], so tests sort and move with their module andtests/holds only integration tests, fixtures, and tooling tests. See the Rust coding standards.Rendering
FrameInputs::time_secondsandTriangleFrame::time_seconds. The shell sets one presentation clock withRenderer::set_presentation_time(PresentationTime, withfixed_ratefor tests and offline captures), which temporal antialiasing, exposure adaptation, film grain, and volumetric noise all read.transparent_drawssuch as particles) sorts back to front in one queue, so a particle behind glass draws behind it. Breaking: removedsort_transparent_triangles.RendererOptions::depth_prepass) fills depth, the scene pass writes the scene-effect normal, roughness, and motion attachments beside its color instead of in two extra passes, and the sky draws last on the far plane.DisplayOutput,Renderer::set_display_output, andShellOptions::high_dynamic_range, on by default). Breaking:EguiLayer::newtakes the display output.RendererOptions::render_scale,Renderer::set_render_scale, andRenderer::render_size): the scene, its effects, and bloom render below the drawing-buffer resolution and the display resolve upscales them with a bicubic filter, while antialiasing, grain, and UI stay at full resolution.Meshes and Materials
joy-render-typescrate (joy_engine::render_types) for GPU-free render data, and movedDirectionalLight,PointLight,Skylight, meshes, and materials there fromjoy-core. See meshes and materials.MeshreplacesIndexedMesh3D,MeshAssetData,PbrMesh, andMeshChannelswith typed attributes (DVec3positions,Vec3normals,Vec2UVs, andLinearColorcolors), per-triangle material slots, and namedMaterialSlots.MeshDocument(a mesh plus one material per slot) is the saved format;dcc::parse_glb_mesh,create_chunk_mesh_data, and FORM'sGeometryData::to_meshproduce meshes, and the form-building cottage was re-baked as a document.Materialnames a shading model throughShading(Layered,Lit,Unlit, orCustom), mesh assets carry each slot's defaultMaterialAsset, and instances override slots (with_materialandwith_slot_material). RemovedShading::Pbr,MeshInstance::with_shading, andMeshInstance::scene_roughness.SurfaceLayers with F0/F90 and metallic reflectance, haze, Charlie sheen, coat, and thin-film iridescence lobes, composed inSurfacetrees (coat, blend, add, and weight) that collapse to one evaluated layer.Renderer::register_shading_modelimplement one WGSL contract, and the engine composes each into the lit, depth pre-pass, and masked shadow-caster passes, so a new model needs no renderer change. Every built-in model is validated for WebGPU and WebGL 2.DebugView,Renderer::set_debug_view): base color, diffuse albedo, specular color, roughness, metallic, normals, emissive, occlusion, lighting only, shading model, shadow cascades, and texture coordinates.ShadedShape,ShadedTriangle, andadd_shaded_shapereplaceShadedMesh3D,ShadedTriangle3D, andadd_meshfor arcade geometry, andcompile_form_mesh,form_mesh_asset, andFormAssetLibrary::resolvetake aShadingModel.Profiling and Console
Renderer::set_profilingandRenderer::frame_profile): CPU recording time per frame phase, and GPU time where the device has timestamp queries (WebGPU and native;GpuCapabilities::timestamps), read back without stalling. The STATS panel shows it in place of "Not collected".ConsoleVariables) games can register,help,find,reset, andstat unit/stat gpuoverlays, history, and completion. Enginer.variables drive render scale, debug views, profiling, the sky, shadows, and each scene effect, mirroring the renderer's actual state. Breaking: backquote opens the console instead of the STATS panel, which its dock launcher still opens. See console and profiling.