TehAwesomestKitteh / LightPainter

screen space point lights using MC's exposed transparency shaders.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Light Painter [1.18]

Image3

Overview

NOT COMPATIBLE WITH PREVIOUS VERSION!!! DO NOT LOAD OLD LIGHTS WITH THE NEW LIGHT PAINTER!!! This is a dev build so things might and will be broken. Screen space point lights using MC's exposed transparency shaders. Requires "Fabulous" graphics setting.

What it does:

  • dynamic placable lights of any hue and any brightness
  • fair performance hit (for what it does)
  • datapack includes custom spawners for placing and deleting lights
  • correctly blends with transparency
  • lighting translucent blocks
  • fade out at long ranges
  • render occluded lights (most of the time)

What it does not do:

  • render out of frame lights
  • does not factor in diffuse lighting equation (cos theta)
  • shadows / occlusion checking

What is achievable:

Image1 base world Image2 light markers added Image3 final result

Feature differences:

Version Range Tranlucent Shading Close Ups Long Range FPS w/ 50 Lights (GTX 1070)
Experimental 128 Yes Yes Yes N/A
Lite 40 No Yes No N/A
Standard 48 Yes Yes No N/A
Extended 128 Yes Ok... Yes N/A
Baseline N/A N/A N/A N/A N/A

Design and Performance

This shader is composed of multiple passes in three main stages: finding light centers, constructing search tree, and computing final lighting per pixel. Performance is achieved through use of shading passes to store point light information in a designated strip on the screen. This allows for vastly reduced texture accesses during the final rendering pass, resulting in performance that scales linarly with number of lights. This is by no means scientific, but the performance hit is around 50% with 50 lights. Real world performance scaling, however, is not linear. Expect best performance with Lite and worst with Extended.

Usage

See License.md for license info. This utility is a resourcepack + datapack combo. Installation of the datapack is not strictly required, but it is useful for ease of use. To get lights (datapack):

/function lights:give/....

To access lights to move or modify them (datapack):

/execute as @e[tag=light,sort=nearest,limit=1] ....

Shading Passes and Descriptions

rendertype_item_entity_translucent_cull

  • Transform custom model to billboard. Find approximate center pixel of marker and discard rest.

filter

  • Filter itemEntity target for light markers.

blur_custom

  • Blur using pseudo random samples for better perf at same blur level.

centers

  • Find centers of each light marker by discarding adjacent pixels.

aggregate_1, aggregate_2, aggregate_3, aggregate_4, aggregate_5

  • Compute layers in search tree.

aggregate_6

  • Traverses search tree to store light screen coordinates into bottom two pixel rows.

light, light_t

  • Computes lighting color at each screen pixel. This pass is run on diffuse and transparency targets respectively.

light_apply, light_apply_t

  • Apply lighting to designated target.

transparency

  • Custom transparency pass that hides light markers and uses blend results of light_apply and light_apply_t for composite.

Credits

  • example screenshots are from the map "Cyberpunk Project" by Elysium Fire

About

screen space point lights using MC's exposed transparency shaders.

License:MIT License


Languages

Language:GLSL 82.0%Language:mcfunction 18.0%