Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved smooth section lighting in shaders #251

Merged
merged 18 commits into from
Jul 15, 2024
Merged

Conversation

Jozufozu
Copy link
Member

SmoothLitVisuals may request that specific sections have their light uploaded to the GPU.

Uploaded sections are shared between all visuals/instances and available for query via a new shader API function.

Massive kudos to RogueLogix for their LUT scheme that allows for sparse storage of section light.

Jozufozu and others added 18 commits July 13, 2024 15:20
- Commit entire chunks of light at a time
- Share all light data between embeddings
- "Functional" arena based lighting for indirect
- Strip out most of the reference counting stuffs for embeddings
- Naively re-buffer all tracked light sections every frame
- Do embedded lighting in the fragment shader
- Fix light coord being saturated
- Use naive trilinear interpolation when fetching embedded light
- Avoid adding all sections every frame
- Remove sections when they are no longer needed
- Rebuild the lut when sections are removed
- Properly detect missing sections by writing 1-based indices to the lut
- Fix light being fetched from a section adjacent to the block a
  fragment actually resides in
- Fix light always being missing
- Pass light updates to LightStorage so that we don't have to re-upload
  every tracked section every frame
- Slightly optimize light section writing, still room for improvement
- Remove dead code in LightStorage
- Sideport light lut stuffs to instancing engine
- Move actual lookup logic to light_lut.glsl, and have backend mains
  provide functions to index the backing storages for sanity's sake
- Standardize naming of lut and sections
- Pull in pepper's loom fix, so I can build :lwe:
- Allow specifying the internal format of texture buffers so light can
  be a simple uint array
- Expose light in the shader api
  - flw_light - for builtin smooth lighting, faster than can be
    implemented by materials alone
  - flw_lightFetch - for materials that want to go crazy, access to raw
    data
- Trim out dead light code from *EmbeddedEnvironment
- Fix indirect never deleting empty culling groups
- Fix embedded transforms not being applied
- Implement RogueLogix's normal-dependent smooth lighting function
- Uses a lot of fetches, so I imagine occupancy is kinda bad
- Not attached to the name
- Add SmoothLitVisual opt in interface, allowing any visuals to
  contribute light sections to the arena
- Remove lightChunks from VisualEmbedding, it has been usurped
- Pass total collected light sections from BEs, Es, and effects to the
  engine interface. It seemed the most proper way to hand off
  information from the impl to the backend
- Add SmoothLitVisualStorage to maintain the set of collected sections,
  though at the moment it is very naive and simply unions everything
  upon request, which is also naively done every frame
- Only push light sections to the engine when the set of sections
  requested by visuals changes
- Clean up light storage plan and comment code
- Remove LIGHT_VOLUME debug mode as it's no longer used
- Optimize collecting light section edges
- Kinda an absurd amount of code, but I'm not sure how to parameterize
  by an axis without having capturing lambdas
- Around 3-4x faster
- Unused in flywheel and not a productive utility for others with the
  new features
- Deduplicate section tracking logic between Lit and SmoothLit
- Now there is one SectionPropertyImpl which the 2 storages add
  listeners to
- Rename the light visuals to have distinct names
- Rename SectionProperty -> SectionCollector because it isn't really a
  property
- Ensure section set returned by SectionTracker is Unmodifiable to avoid copy in LightUpdatedVisualStorage
- Do not recompute section set in ShaderLightVisualStorage if not dirty
- Fix BlockEntityStorage not clearing posLookup on recreation or invalidation
- Fix Storage.invalidate not clearing everything
- Inline TopLevelEmbeddedEnvironment and NestedEmbeddedEnvironment into AbstractEmbeddedEnvironment and rename to EmbeddedEnvironment
- Move some classes between packages
- Remove unused fields in EmbeddingUniforms
- Remove suffix on field names in BufferBindings
- Rename enqueueLightUpdateSection methods to onLightUpdate
- Rename SectionCollectorImpl to SectionTracker
- Rename classes, methods, fields, and parameters and edit javadoc and comments to match previously done renames, new renames, and other existing classes
@Jozufozu Jozufozu merged commit fe0eaca into 1.20/dev Jul 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants