├── .gitignore
├── LICENSE
├── README.md
├── datapack
├── data
│ ├── lights
│ │ └── function
│ │ │ ├── give
│ │ │ ├── _all.mcfunction
│ │ │ ├── deleter.mcfunction
│ │ │ └── light
│ │ │ │ ├── azure.mcfunction
│ │ │ │ ├── blue.mcfunction
│ │ │ │ ├── cyan.mcfunction
│ │ │ │ ├── green.mcfunction
│ │ │ │ ├── lime.mcfunction
│ │ │ │ ├── magenta.mcfunction
│ │ │ │ ├── mint.mcfunction
│ │ │ │ ├── monitor.mcfunction
│ │ │ │ ├── orange.mcfunction
│ │ │ │ ├── pink.mcfunction
│ │ │ │ ├── red.mcfunction
│ │ │ │ ├── tungsten.mcfunction
│ │ │ │ ├── violet.mcfunction
│ │ │ │ ├── white.mcfunction
│ │ │ │ └── yellow.mcfunction
│ │ │ └── tick.mcfunction
│ └── minecraft
│ │ └── tags
│ │ └── function
│ │ └── tick.json
└── pack.mcmeta
├── images
├── 0.png
├── 1.png
└── 2.png
└── resourcepack
├── assets
└── minecraft
│ ├── atlases
│ └── blocks.json
│ ├── items
│ └── lime_stained_glass.json
│ ├── models
│ └── item
│ │ ├── lp.json
│ │ ├── lp_azure.json
│ │ ├── lp_blue.json
│ │ ├── lp_custom.json
│ │ ├── lp_cyan.json
│ │ ├── lp_green.json
│ │ ├── lp_lime.json
│ │ ├── lp_magenta.json
│ │ ├── lp_mint.json
│ │ ├── lp_monitor.json
│ │ ├── lp_orange.json
│ │ ├── lp_pink.json
│ │ ├── lp_red.json
│ │ ├── lp_tungsten.json
│ │ ├── lp_violet.json
│ │ ├── lp_white.json
│ │ └── lp_yellow.json
│ ├── post_effect
│ └── transparency.json
│ ├── shaders
│ ├── core
│ │ ├── rendertype_item_entity_translucent_cull.fsh
│ │ └── rendertype_item_entity_translucent_cull.vsh
│ ├── include
│ │ ├── texint.glsl
│ │ └── utils.glsl
│ └── post
│ │ ├── aggregate.vsh
│ │ ├── aggregate_1.fsh
│ │ ├── aggregate_2.fsh
│ │ ├── aggregate_3.fsh
│ │ ├── aggregate_4.fsh
│ │ ├── aggregate_5.fsh
│ │ ├── aggregate_6.fsh
│ │ ├── aggregate_6.vsh
│ │ ├── blur_custom.fsh
│ │ ├── blur_custom.vsh
│ │ ├── centers.fsh
│ │ ├── centers.vsh
│ │ ├── filter.fsh
│ │ ├── filter.vsh
│ │ ├── light_apply.fsh
│ │ ├── light_apply.vsh
│ │ ├── light_apply_i.fsh
│ │ ├── light_apply_t.fsh
│ │ ├── transparency.fsh
│ │ ├── transparency.vsh
│ │ ├── zone_calc.fsh
│ │ └── zone_calc.vsh
│ └── textures
│ └── misc
│ ├── azure.png
│ ├── black.png
│ ├── blue.png
│ ├── cyan.png
│ ├── green.png
│ ├── lime.png
│ ├── magenta.png
│ ├── mint.png
│ ├── monitor.png
│ ├── orange.png
│ ├── pink.png
│ ├── red.png
│ ├── tungsten.png
│ ├── violet.png
│ ├── white.png
│ └── yellow.png
├── pack.mcmeta
└── pack.png
/.gitignore:
--------------------------------------------------------------------------------
1 | releases/
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Bradley Qu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Light Painter [1.21.5]
2 |
3 |
4 | ## Overview
5 | **MAY CONTAIN BUGS!!!**
6 |
7 | **MAY NOT BE COMPATIBLE WITH PREVIOUS VERSION!!! DO NOT LOAD OLD LIGHTS WITH THE NEW LIGHT PAINTER!!!**
8 |
9 | Screen space point lights using MC's exposed transparency shaders. Requires "Fabulous" graphics setting.
10 |
11 | ### What it does:
12 | - dynamic placable lights of any hue and any brightness
13 | - customizable color using `custom_model_data` `colors` component
14 | - fair performance hit (for what it does)
15 | - datapack includes custom spawners for placing and deleting lights
16 | - correctly blends with transparency
17 | - lighting translucent blocks
18 | - fade out at long ranges
19 | - render occluded lights
20 |
21 | ### What it does not do:
22 | - render out of frame lights
23 | - does not factor in diffuse lighting equation (cos theta)
24 | - shadows / occlusion checking
25 |
26 | ### What is achievable:
27 |
28 |
29 |
30 |
31 | base world
32 | |
33 |
34 |
35 | light markers added
36 | |
37 |
38 |
39 | final result
40 | |
41 |
42 |
43 |
44 | ### Feature differences:
45 |
46 |
47 |
48 | Version
49 | |
50 |
51 | Range
52 | |
53 |
54 | Tranlucent Shading
55 | |
56 |
57 | Close Ups
58 | |
59 |
60 | Long Range
61 | |
62 |
63 |
64 |
65 | Universal
66 | |
67 |
68 | 128
69 | |
70 |
71 | Yes
72 | |
73 |
74 | Yes
75 | |
76 |
77 | Yes
78 | |
79 |
80 |
81 |
82 | Lite (deprecated)
83 | |
84 |
85 | 40
86 | |
87 |
88 | No
89 | |
90 |
91 | Yes
92 | |
93 |
94 | No
95 | |
96 |
97 |
98 |
99 | Standard (deprecated)
100 | |
101 |
102 | 48
103 | |
104 |
105 | Yes
106 | |
107 |
108 | Yes
109 | |
110 |
111 | No
112 | |
113 |
114 |
115 |
116 | Extended (deprecated)
117 | |
118 |
119 | 128
120 | |
121 |
122 | Yes
123 | |
124 |
125 | Ok...
126 | |
127 |
128 | Yes
129 | |
130 |
131 |
132 |
133 | ## Design and Performance
134 | This shader is composed of four main stages: finding light centers, constructing search tree, constructing spatial bins, and computing final lighting per pixel. Performance is achieved by storing point light information in a designated light texture and sorting the lights spatially for fast lookup in the shading stage. 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 100 lights. Real world performance scaling, however, may not be linear. Use **Universal** version for best results. Alternate versions are deprecated and not maintained.
135 |
136 | ## Usage
137 | 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.
138 | To get lights (datapack):
139 | ```
140 | /function lights:give/....
141 | ```
142 | To access lights to move or modify them (datapack):
143 | ```
144 | /execute as @e[tag=light,sort=nearest,limit=1] ....
145 | ```
146 |
147 | ## Shading Passes and Descriptions
148 | #### rendertype_item_entity_translucent_cull
149 | - Transform custom model to billboard. Find approximate center pixel of marker and discard rest. Compress the marker depth to [0.0, 0.025], item entities use (0.025, 1.0].
150 | #### filter
151 | - Filter `minecraft:item_entity` target for light markers.
152 | #### blur_custom
153 | - Blur using pseudo random samples for better perf at same blur level.
154 | #### centers
155 | - Find centers of each light marker by discarding adjacent pixels.
156 | #### aggregate_1, aggregate_2, aggregate_3, aggregate_4, aggregate_5
157 | - Compute layers in search tree.
158 | #### aggregate_6
159 | - Traverses search tree to store light screen coordinates into a light storage texture.
160 | #### zone_calc
161 | - Place light references in spatial bins.
162 | #### light_apply, light_apply_t, light_apply_i
163 | - Computes lighting color at each screen pixel and apply the lighting to designated target. `minecraft:main`, `minecraft:translucent`, `minecraft:item_entity`.
164 | #### transparency
165 | - Custom `transparency` pass that hides light markers and uses blend results of `light_apply` and `light_apply_t` for composite.
166 |
167 | ## Configuration
168 | #### shaders/include/utils.glsl
169 | - `LIGHTRANGE` light approximate range in blocks. Default 128.0.
170 | - `LIGHTINTENSITY` light strength on solid objects. Default 1.0.
171 | - `LIGHTINTENSITYT` light strength on translucent objects. Default 0.5.
172 | - `LIGHTR` distance in blocks where a pixel is considered out of a light's range. Default 8.0.
173 | - `SPREAD` how much a light spreads. `BOOST` may need to increase if this increases. Default 3.0.
174 | - `BOOST` how much to boost lights. Similar to `Intensity` but applies before composite and HDR mapping. Default 10.0.
175 | - `CUTOFF` at what level where light is considered 0.0. Default 0.02.
176 | - `NEAR` near clipping plane in blocks. Do not change. Default 0.05.
177 | - `FAR` approximate far clipping plane in blocks (4 * render range). Affects light position precision. Default 1024.0.
178 | - `FOV` approximate FOV. Affects light position precision. Default 70.0.
179 | - `LIGHTALPHA` marker texture alpha. Use an uncommon alpha, best if less than 0.1 and greater than `ALPHACUTOFF`. Default 24.0/255.0.
180 | - `LIGHTDEPTH` depth buffer reserved for lights. Increase this to improve light position precision at the cost of minimum item depth. Default 0.025.
181 | - `LIGHTVOLX` number of spatial bins along the x axis in camera space. May affect performance. Default 32.
182 | - `LIGHTVOLZ` number of spatial bins along the z axis in camera space. May affect performance. Default 16.
183 | - `AGGSTEP0` first level search tree downscale. May affect performance. Default 8.
184 | - `AGGSTEP1` second level search tree downscale. May affect performance. Default 8.
185 |
186 | ## Credits
187 | - example screenshots are from the map "Cyberpunk Project" by Elysium Fire
188 | - [Jatzylap](https://github.com/Jatzylap) for providing custom light colors using item tint
189 |
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/_all.mcfunction:
--------------------------------------------------------------------------------
1 | function lights:give/deleter
2 | function lights:give/light/red
3 | function lights:give/light/orange
4 | function lights:give/light/yellow
5 | function lights:give/light/lime
6 | function lights:give/light/green
7 | function lights:give/light/mint
8 | function lights:give/light/cyan
9 | function lights:give/light/azure
10 | function lights:give/light/blue
11 | function lights:give/light/violet
12 | function lights:give/light/magenta
13 | function lights:give/light/pink
14 | function lights:give/light/tungsten
15 | function lights:give/light/white
16 | function lights:give/light/monitor
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/deleter.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:enderman_spawn_egg[minecraft:item_model="minecraft:barrier",minecraft:entity_data={Tags:["deleter"],id:"minecraft:item_display"},minecraft:custom_name=[{"text":"Light Delete","italic":false}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/azure.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.0,0.5,1.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Azure Light","italic":false,"color":"#0080ff"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/blue.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.0,0.0,1.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Blue Light","italic":false,"color":"#0000ff"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/cyan.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.0,1.0,1.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Cyan Light","italic":false,"color":"#00ffff"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/green.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.0,1.0,0.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Green Light","italic":false,"color":"#00ff00"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/lime.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.5,1.0,0.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Lime Light","italic":false,"color":"#80ff00"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/magenta.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[1.0,0.0,1.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Magenta Light","italic":false,"color":"#ff00ff"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/mint.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.0,1.0,0.5]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Mint Light","italic":false,"color":"#00ff80"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/monitor.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.909,0.99,0.819]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Monitor Light","italic":false,"color":"#e8fed1"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/orange.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[1.0,0.5,0.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Orange Light","italic":false,"color":"#ff8000"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/pink.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[1.0,0.0,0.5]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Pink Light","italic":false,"color":"#ff0080"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/red.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[1.0,0.0,0.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Red Light","italic":false,"color":"#ff0000"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/tungsten.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[1.0,0.83,0.6]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Tungsten Light","italic":false,"color":"#ffd6aa"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/violet.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[0.5,0.0,1.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Violet Light","italic":false,"color":"#8000ff"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/white.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[1.0,1.0,1.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"White Light","italic":false,"color":"#ffffff"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/give/light/yellow.mcfunction:
--------------------------------------------------------------------------------
1 | give @p minecraft:polar_bear_spawn_egg[minecraft:item_model="minecraft:light",minecraft:entity_data={brightness:{sky:15,block:15},Rotation:[0.0f,0.0f],Tags:["light"],id:"minecraft:item_display",item:{components:{"minecraft:custom_model_data":{floats:[6700.0],colors:[[1.0,1.0,0.0]]}},count:1,id:"minecraft:lime_stained_glass"},item_display:"head"},minecraft:custom_name=[{"text":"Yellow Light","italic":false,"color":"#ffff00"}]]
--------------------------------------------------------------------------------
/datapack/data/lights/function/tick.mcfunction:
--------------------------------------------------------------------------------
1 | execute as @e[type=minecraft:item_display,tag=deleter] at @s run kill @e[type=minecraft:item_display,tag=light,limit=1,distance=..2,sort=nearest]
2 | execute as @e[type=minecraft:item_display,tag=deleter] at @s run kill @s
--------------------------------------------------------------------------------
/datapack/data/minecraft/tags/function/tick.json:
--------------------------------------------------------------------------------
1 | {
2 | "values": [
3 | "lights:tick"
4 | ]
5 | }
--------------------------------------------------------------------------------
/datapack/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack":{
3 | "pack_format":71,
4 | "description":"Colored Lights"
5 | }
6 | }
--------------------------------------------------------------------------------
/images/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/images/0.png
--------------------------------------------------------------------------------
/images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/images/1.png
--------------------------------------------------------------------------------
/images/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/images/2.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/atlases/blocks.json:
--------------------------------------------------------------------------------
1 | {
2 | "sources": [
3 | {
4 | "type": "directory",
5 | "source": "misc",
6 | "prefix": "misc/"
7 | }
8 | ]
9 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/items/lime_stained_glass.json:
--------------------------------------------------------------------------------
1 | {
2 | "model": {
3 | "type": "minecraft:range_dispatch",
4 | "property": "minecraft:custom_model_data",
5 | "index": 0,
6 | "entries": [
7 | {
8 | "threshold": 6700,
9 | "model": {
10 | "type": "minecraft:model",
11 | "model": "minecraft:item/lp_custom",
12 | "tints": [
13 | {
14 | "type": "minecraft:custom_model_data",
15 | "index": 0,
16 | "default": 0
17 | }
18 | ]
19 | }
20 | },
21 | {
22 | "threshold": 6701,
23 | "model": {
24 | "type": "minecraft:model",
25 | "model": "minecraft:item/lp"
26 | }
27 | },
28 | {
29 | "threshold": 6702,
30 | "model": {
31 | "type": "minecraft:model",
32 | "model": "minecraft:item/lp_tungsten"
33 | }
34 | },
35 | {
36 | "threshold": 6703,
37 | "model": {
38 | "type": "minecraft:model",
39 | "model": "minecraft:item/lp_white"
40 | }
41 | },
42 | {
43 | "threshold": 6704,
44 | "model": {
45 | "type": "minecraft:model",
46 | "model": "minecraft:item/lp_monitor"
47 | }
48 | },
49 | {
50 | "threshold": 6705,
51 | "model": {
52 | "type": "minecraft:model",
53 | "model": "minecraft:item/lp_red"
54 | }
55 | },
56 | {
57 | "threshold": 6706,
58 | "model": {
59 | "type": "minecraft:model",
60 | "model": "minecraft:item/lp_orange"
61 | }
62 | },
63 | {
64 | "threshold": 6707,
65 | "model": {
66 | "type": "minecraft:model",
67 | "model": "minecraft:item/lp_yellow"
68 | }
69 | },
70 | {
71 | "threshold": 6708,
72 | "model": {
73 | "type": "minecraft:model",
74 | "model": "minecraft:item/lp_lime"
75 | }
76 | },
77 | {
78 | "threshold": 6709,
79 | "model": {
80 | "type": "minecraft:model",
81 | "model": "minecraft:item/lp_green"
82 | }
83 | },
84 | {
85 | "threshold": 6710,
86 | "model": {
87 | "type": "minecraft:model",
88 | "model": "minecraft:item/lp_mint"
89 | }
90 | },
91 | {
92 | "threshold": 6711,
93 | "model": {
94 | "type": "minecraft:model",
95 | "model": "minecraft:item/lp_cyan"
96 | }
97 | },
98 | {
99 | "threshold": 6712,
100 | "model": {
101 | "type": "minecraft:model",
102 | "model": "minecraft:item/lp_azure"
103 | }
104 | },
105 | {
106 | "threshold": 6713,
107 | "model": {
108 | "type": "minecraft:model",
109 | "model": "minecraft:item/lp_blue"
110 | }
111 | },
112 | {
113 | "threshold": 6714,
114 | "model": {
115 | "type": "minecraft:model",
116 | "model": "minecraft:item/lp_violet"
117 | }
118 | },
119 | {
120 | "threshold": 6715,
121 | "model": {
122 | "type": "minecraft:model",
123 | "model": "minecraft:item/lp_magenta"
124 | }
125 | },
126 | {
127 | "threshold": 6716,
128 | "model": {
129 | "type": "minecraft:model",
130 | "model": "minecraft:item/lp_pink"
131 | }
132 | }
133 | ],
134 | "fallback": {
135 | "type": "minecraft:model",
136 | "model": "minecraft:block/lime_stained_glass"
137 | }
138 | }
139 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp.json:
--------------------------------------------------------------------------------
1 | {
2 | "credit": "thebradqq's light painter",
3 | "ambientocclusion": false,
4 | "textures":
5 | {
6 | "0":"misc/black",
7 | "particle":"misc/black"
8 | },
9 | "elements":
10 | [
11 | {
12 | "from": [8,8,8],
13 | "to": [8,8,8],
14 | "rotation":
15 | {
16 | "angle": 0,
17 | "axis": "y",
18 | "origin": [10,10,10]
19 | },
20 | "faces":
21 | {
22 | "up":
23 | {
24 | "uv": [0.5,0.5,0.5,0.5],
25 | "rotation": 90,
26 | "texture": "#0"
27 | }
28 | }
29 | }
30 | ],
31 | "display":
32 | {
33 | "head":
34 | {
35 | "scale":[0.0,0.0,0.0]
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_azure.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/azure","particle":"misc/azure"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_blue.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/blue","particle":"misc/blue"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_custom.json:
--------------------------------------------------------------------------------
1 | {
2 | "credit": "thebradqq's light painter",
3 | "ambientocclusion": false,
4 | "textures":
5 | {
6 | "0":"misc/white",
7 | "particle":"misc/white"
8 | },
9 | "elements":
10 | [
11 | {
12 | "from": [8,8,8],
13 | "to": [8,8,8],
14 | "rotation":
15 | {
16 | "angle": 0,
17 | "axis": "y",
18 | "origin": [10,10,10]
19 | },
20 | "faces":
21 | {
22 | "up":
23 | {
24 | "uv": [0.5,0.5,0.5,0.5],
25 | "rotation": 90,
26 | "texture": "#0",
27 | "tintindex": 0
28 | }
29 | }
30 | }
31 | ],
32 | "display":
33 | {
34 | "head":
35 | {
36 | "scale":[0.0,0.0,0.0]
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_cyan.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/cyan","particle":"misc/cyan"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_green.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/green","particle":"misc/green"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_lime.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/lime","particle":"misc/lime"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_magenta.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/magenta","particle":"misc/magenta"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_mint.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/mint","particle":"misc/mint"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_monitor.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/monitor","particle":"misc/monitor"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_orange.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/orange","particle":"misc/orange"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_pink.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/pink","particle":"misc/pink"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_red.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/red","particle":"misc/red"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_tungsten.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/tungsten","particle":"misc/tungsten"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_violet.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/violet","particle":"misc/violet"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_white.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/white","particle":"misc/white"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/models/item/lp_yellow.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "minecraft:item/lp",
3 | "textures":{"0":"misc/yellow","particle":"misc/yellow"}
4 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/post_effect/transparency.json:
--------------------------------------------------------------------------------
1 | {
2 | "targets": {
3 | "swap1": {},
4 | "swap2": {},
5 | "swap3": {},
6 | "swap4": {},
7 | "lights": {"width": 1024, "height": 4, "bilinear": false },
8 | "volume": {"width": 1024, "height": 512, "bilinear": false }
9 | },
10 | "passes": [
11 | {
12 | "vertex_shader": "minecraft:post/filter",
13 | "fragment_shader": "minecraft:post/filter",
14 | "inputs": [
15 | {
16 | "sampler_name": "ItemEntity",
17 | "target": "minecraft:item_entity"
18 | },
19 | {
20 | "sampler_name": "ItemEntityDepth",
21 | "target": "minecraft:item_entity",
22 | "use_depth_buffer": true
23 | }
24 | ],
25 | "output": "swap1"
26 | },
27 | {
28 | "vertex_shader": "minecraft:post/centers",
29 | "fragment_shader": "minecraft:post/centers",
30 | "inputs": [
31 | {
32 | "sampler_name": "ApproxCenters",
33 | "target": "swap1"
34 | }
35 | ],
36 | "output": "swap3"
37 | },
38 | {
39 | "vertex_shader": "minecraft:post/aggregate",
40 | "fragment_shader": "minecraft:post/aggregate_1",
41 | "inputs": [
42 | {
43 | "sampler_name": "SearchLayer",
44 | "target": "swap3"
45 | }
46 | ],
47 | "output": "swap1",
48 | "uniforms": [
49 | {
50 | "name":"Test",
51 | "type":"int",
52 | "values": [ 0 ]
53 | }
54 | ]
55 | },
56 | {
57 | "vertex_shader": "minecraft:post/aggregate",
58 | "fragment_shader": "minecraft:post/aggregate_2",
59 | "inputs": [
60 | {
61 | "sampler_name": "SearchLayer",
62 | "target": "swap1"
63 | }
64 | ],
65 | "output": "swap2",
66 | "uniforms": [
67 | {
68 | "name":"Test",
69 | "type":"int",
70 | "values": [ 0 ]
71 | }
72 | ]
73 | },
74 | {
75 | "vertex_shader": "minecraft:post/aggregate",
76 | "fragment_shader": "minecraft:post/aggregate_3",
77 | "inputs": [
78 | {
79 | "sampler_name": "SearchLayer",
80 | "target": "swap2"
81 | }
82 | ],
83 | "output": "swap1",
84 | "uniforms": [
85 | {
86 | "name":"Test",
87 | "type":"int",
88 | "values": [ 0 ]
89 | }
90 | ]
91 | },
92 | {
93 | "vertex_shader": "minecraft:post/aggregate",
94 | "fragment_shader": "minecraft:post/aggregate_4",
95 | "inputs": [
96 | {
97 | "sampler_name": "SearchLayer",
98 | "target": "swap1"
99 | }
100 | ],
101 | "output": "swap2",
102 | "uniforms": [
103 | {
104 | "name":"Test",
105 | "type":"int",
106 | "values": [ 0 ]
107 | }
108 | ]
109 | },
110 | {
111 | "vertex_shader": "minecraft:post/aggregate",
112 | "fragment_shader": "minecraft:post/aggregate_5",
113 | "inputs": [
114 | {
115 | "sampler_name": "SearchLayer",
116 | "target": "swap2"
117 | }
118 | ],
119 | "output": "swap1",
120 | "uniforms": [
121 | {
122 | "name":"Test",
123 | "type":"int",
124 | "values": [ 0 ]
125 | }
126 | ]
127 | },
128 | {
129 | "vertex_shader": "minecraft:post/aggregate_6",
130 | "fragment_shader": "minecraft:post/aggregate_6",
131 | "inputs": [
132 | {
133 | "sampler_name": "SearchLayer",
134 | "target": "swap1"
135 | },
136 | {
137 | "sampler_name": "ItemEntityDepth",
138 | "target": "minecraft:item_entity",
139 | "use_depth_buffer": true
140 | },
141 | {
142 | "sampler_name": "ColoredCenters",
143 | "target": "swap3"
144 | }
145 | ],
146 | "output": "lights",
147 | "uniforms": [
148 | {
149 | "name":"Test",
150 | "type":"int",
151 | "values": [ 0 ]
152 | }
153 | ]
154 | },
155 | {
156 | "vertex_shader": "minecraft:post/zone_calc",
157 | "fragment_shader": "minecraft:post/zone_calc",
158 | "inputs": [
159 | {
160 | "sampler_name": "Lights",
161 | "target": "lights"
162 | }
163 | ],
164 | "output": "volume"
165 | },
166 | {
167 | "vertex_shader": "minecraft:post/blur_custom",
168 | "fragment_shader": "minecraft:post/blur_custom",
169 | "inputs": [
170 | {
171 | "sampler_name": "In",
172 | "target": "minecraft:main"
173 | }
174 | ],
175 | "output": "swap1",
176 | "uniforms": [
177 | {
178 | "name": "Radius",
179 | "type":"float",
180 | "values": [ 0.01 ]
181 | },
182 | {
183 | "name": "Offset",
184 | "type":"float",
185 | "values": [ 0.0 ]
186 | }
187 | ]
188 | },
189 | {
190 | "vertex_shader": "minecraft:post/blur_custom",
191 | "fragment_shader": "minecraft:post/blur_custom",
192 | "inputs": [
193 | {
194 | "sampler_name": "In",
195 | "target": "swap1"
196 | }
197 | ],
198 | "output": "swap3",
199 | "uniforms": [
200 | {
201 | "name": "Radius",
202 | "type":"float",
203 | "values": [ 0.015 ]
204 | },
205 | {
206 | "name": "Offset",
207 | "type":"float",
208 | "values": [ 7.0 ]
209 | }
210 | ]
211 | },
212 | {
213 | "vertex_shader": "minecraft:post/blur_custom",
214 | "fragment_shader": "minecraft:post/blur_custom",
215 | "inputs": [
216 | {
217 | "sampler_name": "In",
218 | "target": "swap3"
219 | }
220 | ],
221 | "output": "swap1",
222 | "uniforms": [
223 | {
224 | "name": "Radius",
225 | "type":"float",
226 | "values": [ 0.02 ]
227 | },
228 | {
229 | "name": "Offset",
230 | "type":"float",
231 | "values": [ 21.0 ]
232 | }
233 | ]
234 | },
235 | {
236 | "vertex_shader": "minecraft:post/blur_custom",
237 | "fragment_shader": "minecraft:post/blur_custom",
238 | "inputs": [
239 | {
240 | "sampler_name": "In",
241 | "target": "swap1"
242 | }
243 | ],
244 | "output": "swap3",
245 | "uniforms": [
246 | {
247 | "name": "Radius",
248 | "type":"float",
249 | "values": [ 0.02 ]
250 | },
251 | {
252 | "name": "Offset",
253 | "type":"float",
254 | "values": [ 45.0 ]
255 | }
256 | ]
257 | },
258 | {
259 | "vertex_shader": "minecraft:post/light_apply",
260 | "fragment_shader": "minecraft:post/light_apply",
261 | "inputs": [
262 | {
263 | "sampler_name": "Diffuse",
264 | "target": "minecraft:main"
265 | },
266 | {
267 | "sampler_name": "DiffuseDepth",
268 | "target": "minecraft:main",
269 | "use_depth_buffer": true
270 | },
271 | {
272 | "sampler_name": "Lights",
273 | "target": "lights"
274 | },
275 | {
276 | "sampler_name": "Volume",
277 | "target": "volume"
278 | },
279 | {
280 | "sampler_name": "Blur",
281 | "target": "swap3"
282 | }
283 | ],
284 | "output": "swap1"
285 | },
286 | {
287 | "vertex_shader": "minecraft:post/light_apply",
288 | "fragment_shader": "minecraft:post/light_apply_t",
289 | "inputs": [
290 | {
291 | "sampler_name": "Diffuse",
292 | "target": "minecraft:translucent"
293 | },
294 | {
295 | "sampler_name": "DiffuseDepth",
296 | "target": "minecraft:translucent",
297 | "use_depth_buffer": true
298 | },
299 | {
300 | "sampler_name": "Lights",
301 | "target": "lights"
302 | },
303 | {
304 | "sampler_name": "Volume",
305 | "target": "volume"
306 | },
307 | {
308 | "sampler_name": "CompareDepth",
309 | "target": "minecraft:main",
310 | "use_depth_buffer": true
311 | }
312 | ],
313 | "output": "swap2"
314 | },
315 | {
316 | "vertex_shader": "minecraft:post/light_apply",
317 | "fragment_shader": "minecraft:post/light_apply_i",
318 | "inputs": [
319 | {
320 | "sampler_name": "Diffuse",
321 | "target": "minecraft:item_entity"
322 | },
323 | {
324 | "sampler_name": "DiffuseDepth",
325 | "target": "minecraft:item_entity",
326 | "use_depth_buffer": true
327 | },
328 | {
329 | "sampler_name": "Lights",
330 | "target": "lights"
331 | },
332 | {
333 | "sampler_name": "Volume",
334 | "target": "volume"
335 | },
336 | {
337 | "sampler_name": "CompareDepth",
338 | "target": "minecraft:main",
339 | "use_depth_buffer": true
340 | }
341 | ],
342 | "output": "swap3"
343 | },
344 | {
345 | "vertex_shader": "minecraft:post/transparency",
346 | "fragment_shader": "minecraft:post/transparency",
347 | "inputs": [
348 | {
349 | "sampler_name": "Main",
350 | "target": "swap1"
351 | },
352 | {
353 | "sampler_name": "MainDepth",
354 | "target": "minecraft:main",
355 | "use_depth_buffer": true
356 | },
357 | {
358 | "sampler_name": "Translucent",
359 | "target": "swap2"
360 | },
361 | {
362 | "sampler_name": "TranslucentDepth",
363 | "target": "minecraft:translucent",
364 | "use_depth_buffer": true
365 | },
366 | {
367 | "sampler_name": "ItemEntity",
368 | "target": "swap3"
369 | },
370 | {
371 | "sampler_name": "ItemEntityDepth",
372 | "target": "minecraft:item_entity",
373 | "use_depth_buffer": true
374 | },
375 | {
376 | "sampler_name": "Particles",
377 | "target": "minecraft:particles"
378 | },
379 | {
380 | "sampler_name": "ParticlesDepth",
381 | "target": "minecraft:particles",
382 | "use_depth_buffer": true
383 | },
384 | {
385 | "sampler_name": "Clouds",
386 | "target": "minecraft:clouds"
387 | },
388 | {
389 | "sampler_name": "CloudsDepth",
390 | "target": "minecraft:clouds",
391 | "use_depth_buffer": true
392 | },
393 | {
394 | "sampler_name": "Weather",
395 | "target": "minecraft:weather"
396 | },
397 | {
398 | "sampler_name": "WeatherDepth",
399 | "target": "minecraft:weather",
400 | "use_depth_buffer": true
401 | }
402 | ],
403 | "output": "swap4",
404 | "uniforms": [
405 | {
406 | "name":"Test",
407 | "type":"int",
408 | "values": [ 0 ]
409 | }
410 | ]
411 | },
412 | {
413 | "vertex_shader": "minecraft:post/blit",
414 | "fragment_shader": "minecraft:post/blit",
415 | "inputs": [
416 | {
417 | "sampler_name": "In",
418 | "target": "swap4"
419 | }
420 | ],
421 | "output": "minecraft:main",
422 | "uniforms": [
423 | {
424 | "name": "ColorModulate",
425 | "type": "vec4",
426 | "values": [ 1.0, 1.0, 1.0, 1.0 ]
427 | }
428 | ]
429 | }
430 | ]
431 | }
432 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform mat4 ProjMat;
9 |
10 | uniform vec4 ColorModulator;
11 | uniform float FogStart;
12 | uniform float FogEnd;
13 | uniform vec4 FogColor;
14 |
15 | in float vertexDistance;
16 | in vec4 vertexColor;
17 | in vec2 texCoord0;
18 | in vec2 texCoord1;
19 | in vec2 texCoord2;
20 | in vec4 normal;
21 | in vec4 glpos;
22 | in float marker;
23 | in float scale;
24 |
25 | out vec4 fragColor;
26 |
27 | void main() {
28 | bool hand = isHand(FogStart, FogEnd);
29 | bool gui = isGUI(ProjMat);
30 |
31 |
32 | if (marker < 0.5) {
33 | vec4 color = texture(Sampler0, texCoord0);
34 | if (color.a < 0.1) {
35 | discard;
36 | }
37 | color *= vertexColor * ColorModulator;
38 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
39 | fragColor.a = fragColor.a < 0.1 ? 0.1 : fragColor.a;
40 |
41 | if (!gui && gl_FragCoord.z <= LIGHTDEPTH) {
42 | gl_FragDepth = LIGHTDEPTH + 10e-7;
43 | }
44 | else {
45 | gl_FragDepth = gl_FragCoord.z;
46 | }
47 | } else {
48 | float onePixelToUV = 0.55 / (gl_FragCoord.y * 2.0 / (glpos.y / glpos.w + 1.0) * scale);
49 | if (!(abs(texCoord2.x - 0.5) <= onePixelToUV && abs(texCoord2.y - 0.5) <= onePixelToUV)) {
50 | discard;
51 | }
52 | fragColor = linear_fog(vertexColor, vertexDistance, FogStart, FogEnd, FogColor);
53 | fragColor.a = 1.0;
54 |
55 | gl_FragDepth = gl_FragCoord.z * LIGHTDEPTH;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 | #moj_import
6 |
7 | in vec3 Position;
8 | in vec4 Color;
9 | in vec2 UV0;
10 | in vec2 UV1;
11 | in ivec2 UV2;
12 | in vec3 Normal;
13 |
14 | uniform sampler2D Sampler0;
15 | uniform sampler2D Sampler2;
16 |
17 | uniform mat4 ModelViewMat;
18 | uniform mat4 ProjMat;
19 | uniform int FogShape;
20 | uniform float FogStart;
21 | uniform float FogEnd;
22 |
23 | uniform vec3 Light0_Direction;
24 | uniform vec3 Light1_Direction;
25 |
26 | uniform vec4 ColorModulator;
27 |
28 | out float vertexDistance;
29 | out vec4 vertexColor;
30 | out vec2 texCoord0;
31 | out vec2 texCoord1;
32 | out vec2 texCoord2;
33 | out vec4 normal;
34 | out vec4 glpos;
35 | out float marker;
36 | out float scale;
37 |
38 | #define HALFMARKER tmp.z / 240.0
39 |
40 | float opz(vec4 pos, float factor, float bias) {
41 | return (((pos.z / pos.w + 1.0) * 0.5 * factor + bias) * 2.0 - 1.0) * pos.w;
42 | }
43 |
44 | void main() {
45 | vertexDistance = fog_distance(Position, FogShape);
46 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0);
47 | texCoord0 = UV0;
48 | texCoord1 = UV1;
49 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
50 |
51 | vec4 tmpcol = texture(Sampler0, UV0);
52 | vec4 tmp = ModelViewMat * vec4(Position, 1.0);
53 | bool hand = isHand(FogStart, FogEnd);
54 | bool gui = isGUI(ProjMat);
55 |
56 | marker = float(!hand && !gui && (tmpcol.a == LIGHTALPHA));
57 |
58 | if (marker > 0.0) {
59 | vertexColor = vec4(tmpcol.rgb, 1.0) * Color;
60 |
61 | if (gl_VertexID % 4 == 0) {
62 | tmp.xy += vec2(-HALFMARKER, HALFMARKER);
63 | texCoord2 = vec2(0.0, 0.0);
64 | }
65 | else if (gl_VertexID % 4 == 1) {
66 | tmp.xy += vec2(-HALFMARKER, -HALFMARKER);
67 | texCoord2 = vec2(0.0, 1.0);
68 | }
69 | else if (gl_VertexID % 4 == 2) {
70 | tmp.xy += vec2(HALFMARKER, -HALFMARKER);
71 | texCoord2 = vec2(1.0, 1.0);
72 | }
73 | else {
74 | tmp.xy += vec2(HALFMARKER, HALFMARKER);
75 | texCoord2 = vec2(1.0, 0.0);
76 | }
77 |
78 | scale = abs(HALFMARKER * ProjMat[1][1] / tmp.z);
79 | }
80 |
81 | tmp = ProjMat * tmp;
82 | glpos = tmp;
83 | gl_Position = tmp;
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/include/texint.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | vec4 encodeInt(int i) {
4 | float a = 1.0;
5 | if (i < 0) {
6 | i *= -1;
7 | a = 0.5;
8 | }
9 | int r = i % 255;
10 | i = i / 255;
11 | int g = i % 255;
12 | i = i / 255;
13 | int b = i % 255;
14 | return vec4(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0, a);
15 | }
16 |
17 | int decodeInt(vec4 ivec) {
18 | ivec.rgb *= 255.0;
19 | int num = 0;
20 | num += int(ivec.r);
21 | num += int(ivec.g) * 255;
22 | num += int(ivec.b) * 255 * 255;
23 | return num * int(floor(4.0 * (ivec.a - 0.75) + 0.5));
24 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/include/utils.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define BIG 1000000
4 | #define FIXEDPOINT 1000.0
5 | #define DSCALE 10.0
6 |
7 | #define NEAR 0.05
8 | #define FAR 1024.0
9 | #define FOV 70.0
10 |
11 | #define LIGHTINTENSITY 1.0
12 | #define LIGHTINTENSITYT 0.5
13 | #define LIGHTRANGE 128.0
14 | #define LIGHTR 8.0
15 | #define SPREAD 3.0
16 | #define BOOST 10.0
17 | #define CUTOFF 0.02
18 |
19 | #define ALPHACUTOFF (21.5 / 255.0)
20 | #define LIGHTALPHA (24.0 / 255.0)
21 | #define LIGHTDEPTH 0.025
22 |
23 | #define LIGHTVOLX 32
24 | #define LIGHTVOLZ 16
25 | #define AGGSTEP0 8
26 | #define AGGSTEP1 8
27 |
28 | bool isGUI(mat4 ProjMat) {
29 | return abs(ProjMat[2][3]) <= 1.0 / BIG;
30 | }
31 |
32 | bool isHand(float fogs, float foge) { // also includes panorama
33 | return fogs >= foge;
34 | }
35 |
36 | float LinearizeDepth(float depth) {
37 | float z = depth * 2.0 - 1.0;
38 | return 2.0 * (NEAR * FAR) / (FAR + NEAR - z * (FAR - NEAR));
39 | }
40 |
41 | float luminance(vec3 rgb) {
42 | return 0.2126 * rgb.r + 0.7152 * rgb.g + 0.0722 * rgb.b;
43 | }
44 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec4 Position;
4 |
5 | uniform mat4 ProjMat;
6 | uniform vec2 OutSize;
7 |
8 | out vec2 texCoord;
9 | flat out vec2 oneTexel;
10 |
11 | void main(){
12 | vec4 outPos = ProjMat * vec4(Position.xy * OutSize, 0.0, 1.0);
13 | gl_Position = vec4(outPos.xy, 0.2, 1.0);
14 | oneTexel = 1.0 / OutSize;
15 | texCoord = Position.xy;
16 | }
17 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate_1.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D SearchLayerSampler;
6 | uniform vec2 SearchLayerSize;
7 | uniform int Test;
8 |
9 | in vec2 texCoord;
10 | flat in vec2 oneTexel;
11 |
12 | out vec4 outColor;
13 |
14 | void main() {
15 | outColor = vec4(0.0);
16 | vec2 samplepos = gl_FragCoord.xy - 0.5;
17 | samplepos = vec2(samplepos.x * float(AGGSTEP0), samplepos.y);
18 | if (samplepos.x < SearchLayerSize.x) {
19 | float tmpCounter = 0.0;
20 | for (int i = 0; i < AGGSTEP0; i += 1) {
21 | tmpCounter += float(texture(SearchLayerSampler, (vec2(samplepos.x + float(i), samplepos.y) + 0.5) * oneTexel).a == 1.0);
22 | }
23 | tmpCounter /= 255.0;
24 | outColor = vec4(vec3(tmpCounter), 1.0);
25 | if (Test == 1) {
26 | outColor.rgb /= tmpCounter == 0.0 ? 1.0 : outColor.r;
27 | outColor.rgb += vec3(0.2, 0.0, 0.0);
28 | }
29 | }
30 |
31 | if (abs(gl_FragCoord.x - 1.0) < 0.01) {
32 | outColor.rgb = vec3(0.0, 1.0, 0.0);
33 | }
34 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate_2.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D SearchLayerSampler;
6 | uniform vec2 SearchLayerSize;
7 | uniform int Test;
8 |
9 | in vec2 texCoord;
10 | flat in vec2 oneTexel;
11 |
12 | out vec4 outColor;
13 |
14 | void main() {
15 | outColor = texture(SearchLayerSampler, texCoord);
16 | float width = ceil(SearchLayerSize.x / float(AGGSTEP0));
17 | vec2 samplepos = gl_FragCoord.xy - 0.5;
18 | samplepos = vec2(samplepos.x - width, samplepos.y * float(AGGSTEP0));
19 | if (samplepos.x >= 0.0 && samplepos.x < width && samplepos.y < SearchLayerSize.y) {
20 | float tmpCounter = 0.0;
21 | for (int i = 0; i < AGGSTEP0; i += 1) {
22 | tmpCounter += float(texture(SearchLayerSampler, (vec2(samplepos.x, samplepos.y + float(i)) + 0.5) * oneTexel).b * 255.0);
23 | }
24 | tmpCounter /= 255.0;
25 | outColor = vec4(vec3(tmpCounter), 1.0);
26 | if (Test == 1) {
27 | outColor.rgb /= tmpCounter == 0.0 ? 1.0 : outColor.r;
28 | outColor.rgb += vec3(0.4, 0.0, 0.0);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate_3.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D SearchLayerSampler;
6 | uniform vec2 SearchLayerSize;
7 | uniform int Test;
8 |
9 | in vec2 texCoord;
10 | flat in vec2 oneTexel;
11 |
12 | out vec4 outColor;
13 |
14 | void main() {
15 | outColor = texture(SearchLayerSampler, texCoord);
16 | float width = ceil(SearchLayerSize.x / float(AGGSTEP0));
17 | float height = ceil(SearchLayerSize.y / float(AGGSTEP0));
18 | vec2 samplepos = gl_FragCoord.xy - 0.5;
19 | samplepos = vec2((samplepos.x - 2.0 * width) * float(AGGSTEP1) + width, samplepos.y);
20 | if (samplepos.x >= width && samplepos.x < 2.0 * width && samplepos.y < height) {
21 | float tmpCounter = 0.0;
22 | for (int i = 0; i < AGGSTEP1; i += 1) {
23 | tmpCounter += float(texture(SearchLayerSampler, (vec2(samplepos.x + float(i), samplepos.y) + 0.5) * oneTexel).b * 255.0);
24 | }
25 | tmpCounter /= 255.0;
26 | outColor = vec4(vec3(tmpCounter), 1.0);
27 | if (Test == 1) {
28 | outColor.rgb /= tmpCounter == 0.0 ? 1.0 : outColor.r;
29 | outColor.rgb += vec3(0.5, 0.0, 0.0);
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate_4.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D SearchLayerSampler;
6 | uniform vec2 SearchLayerSize;
7 | uniform int Test;
8 |
9 | in vec2 texCoord;
10 | flat in vec2 oneTexel;
11 |
12 | out vec4 outColor;
13 |
14 | void main() {
15 | outColor = texture(SearchLayerSampler, texCoord);
16 | float width = ceil(SearchLayerSize.x / float(AGGSTEP0));
17 | float width2 = ceil(width / float(AGGSTEP1));
18 | float height = ceil(SearchLayerSize.y / float(AGGSTEP0));
19 | vec2 samplepos = gl_FragCoord.xy - 0.5;
20 | samplepos = vec2(samplepos.x - width2, samplepos.y * float(AGGSTEP1));
21 | if (samplepos.x >= 2.0 * width && samplepos.x < 2.0 * width + width2 && samplepos.y < height) {
22 | float tmpCounter = 0.0;
23 | for (int i = 0; i < AGGSTEP1; i += 1) {
24 | tmpCounter += float(texture(SearchLayerSampler, (vec2(samplepos.x, samplepos.y + float(i)) + 0.5) * oneTexel).b * 255.0);
25 | }
26 | tmpCounter /= 255.0;
27 | outColor = vec4(vec3(tmpCounter), 1.0);
28 | if (Test == 1) {
29 | outColor.rgb /= tmpCounter == 0.0 ? 1.0 : outColor.r;
30 | outColor.rgb += vec3(0.6, 0.0, 0.0);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate_5.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D SearchLayerSampler;
6 | uniform vec2 SearchLayerSize;
7 | uniform int Test;
8 |
9 | in vec2 texCoord;
10 | flat in vec2 oneTexel;
11 |
12 | out vec4 outColor;
13 |
14 | void main() {
15 | outColor = texture(SearchLayerSampler, texCoord);
16 | float width = ceil(SearchLayerSize.x / float(AGGSTEP0));
17 | float width2 = ceil(width / float(AGGSTEP1));
18 | float height = ceil(SearchLayerSize.y / float(AGGSTEP0));
19 | float height2 = ceil(height / float(AGGSTEP1));
20 | vec2 samplepos = gl_FragCoord.xy - 0.5;
21 | samplepos = vec2(samplepos.x - width2, samplepos.y);
22 | if (samplepos.x >= 2.0 * width + width2 && samplepos.x < 2.0 * width + 2.0 * width2 && samplepos.y == 0.0) {
23 | float tmpCounter = 0.0;
24 | for (int i = 0; i < int(height2); i += 1) {
25 | tmpCounter += float(texture(SearchLayerSampler, (vec2(samplepos.x, samplepos.y + float(i)) + 0.5) * oneTexel).b * 255.0);
26 | }
27 | tmpCounter /= 255.0;
28 | outColor = vec4(vec3(tmpCounter), 1.0);
29 | if (Test == 1) {
30 | outColor.rgb /= tmpCounter == 0.0 ? 1.0 : outColor.r;
31 | outColor.rgb += vec3(0.7, 0.0, 0.0);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate_6.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D SearchLayerSampler;
7 | uniform sampler2D ItemEntityDepthSampler;
8 | uniform sampler2D ColoredCentersSampler;
9 | uniform vec2 SearchLayerSize;
10 | uniform int Test;
11 |
12 | in vec2 texCoord;
13 | flat in vec2 inOneTexel;
14 | flat in float inAspectRatio;
15 | flat in float conversionK;
16 |
17 | out vec4 outColor;
18 |
19 | void main() {
20 | if (Test == 1) {
21 | outColor = texture(SearchLayerSampler, texCoord);
22 | }
23 | float width = ceil(SearchLayerSize.x / float(AGGSTEP0));
24 | float width2 = ceil(width / float(AGGSTEP1));
25 | float height = ceil(SearchLayerSize.y / float(AGGSTEP0));
26 | float height2 = ceil(height / float(AGGSTEP1));
27 | vec2 pos = gl_FragCoord.xy - 0.5;
28 | float targetNum = pos.x + 1.0;
29 |
30 | vec2 samplepos = vec2(2.0 * width + 2.0 * width2, 0.0);
31 | float tmpCounter = 0.0;
32 | float status = 0.0;
33 | int px = 0;
34 | int py = 0;
35 | for (int iter = 0; iter < int(width2); iter += 1) {
36 | float l0count = texture(SearchLayerSampler, (vec2(samplepos.x + float(iter), 0.0) + 0.5) / SearchLayerSize).r * 255.0;
37 | if (tmpCounter + l0count >= targetNum) {
38 | status = 1.0;
39 | px = iter;
40 | iter = BIG;
41 | } else {
42 | tmpCounter += l0count;
43 | }
44 | }
45 |
46 | outColor = vec4(encodeInt(int(tmpCounter)).rgb, 69.0 / 255.0);
47 |
48 | if (status == 1.0) {
49 | samplepos = vec2(2.0 * width + width2 + float(px), 0.0);
50 | for (int iter = 0; iter < int(height2); iter += 1) {
51 | float l1count = texture(SearchLayerSampler, (vec2(samplepos.x, float(iter)) + 0.5) / SearchLayerSize).r * 255.0;
52 | if (tmpCounter + l1count >= targetNum) {
53 | status = 2.0;
54 | py = iter;
55 | iter = BIG;
56 | } else {
57 | tmpCounter += l1count;
58 | }
59 | }
60 | }
61 |
62 | if (status == 2.0) {
63 | py *= int(AGGSTEP1);
64 | samplepos = vec2(2.0 * width + float(px), float(py));
65 | for (int iter = 0; iter < int(AGGSTEP1); iter += 1) {
66 | float l2count = texture(SearchLayerSampler, (vec2(samplepos.x, samplepos.y + float(iter)) + 0.5) / SearchLayerSize).r * 255.0;
67 | if (tmpCounter + l2count >= targetNum) {
68 | status = 3.0;
69 | py += iter;
70 | iter = BIG;
71 | } else {
72 | tmpCounter += l2count;
73 | }
74 | }
75 | }
76 |
77 | if (status == 3.0) {
78 | px *= int(AGGSTEP1);
79 | samplepos = vec2(width + float(px), float(py));
80 | for (int iter = 0; iter < int(AGGSTEP1); iter += 1) {
81 | float l3count = texture(SearchLayerSampler, (vec2(samplepos.x + float(iter), samplepos.y) + 0.5) / SearchLayerSize).r * 255.0;
82 | if (px + iter < int(width) && tmpCounter + l3count >= targetNum) {
83 | status = 4.0;
84 | px += iter;
85 | iter = BIG;
86 | } else {
87 | tmpCounter += l3count;
88 | }
89 | }
90 | }
91 |
92 | if (status == 4.0) {
93 | py *= int(AGGSTEP0);
94 | samplepos = vec2(float(px), float(py));
95 | for (int iter = 0; iter < int(AGGSTEP0); iter += 1) {
96 | float l4count = texture(SearchLayerSampler, (vec2(samplepos.x, samplepos.y + float(iter)) + 0.5) / SearchLayerSize).r * 255.0;
97 | if (tmpCounter + l4count >= targetNum) {
98 | status = 5.0;
99 | py += iter;
100 | iter = BIG;
101 | } else {
102 | tmpCounter += l4count;
103 | }
104 | }
105 | }
106 |
107 | if (status == 5.0) {
108 | vec4 sampleColor;
109 | px *= int(AGGSTEP0);
110 | samplepos = vec2(float(px), float(py));
111 | for (int iter = 0; iter < int(AGGSTEP0); iter += 1) {
112 | sampleColor = texture(ColoredCentersSampler, (vec2(samplepos.x + float(iter), samplepos.y) + 0.5) / SearchLayerSize);
113 | float isLight = sampleColor.a;
114 | if (tmpCounter + isLight == targetNum) {
115 | px += iter;
116 | iter = BIG;
117 | } else {
118 | tmpCounter += isLight;
119 | }
120 | }
121 |
122 | samplepos = vec2(px, py);
123 | samplepos = (samplepos + 0.5) * inOneTexel;
124 | float lightDepth = LinearizeDepth(texture(ItemEntityDepthSampler, samplepos).r / LIGHTDEPTH);
125 | samplepos = (samplepos - vec2(0.5)) * vec2(inAspectRatio, 1.0);
126 | vec3 lightWorldCoord = vec3(samplepos * conversionK * lightDepth, lightDepth);
127 |
128 | if (pos.y == 0.0) {
129 | outColor = encodeInt(int(lightWorldCoord.x * FIXEDPOINT));
130 | } else if (pos.y == 1.0) {
131 | outColor = encodeInt(int(lightWorldCoord.y * FIXEDPOINT));
132 | } else if (pos.y == 2.0) {
133 | outColor = encodeInt(int(lightWorldCoord.z * FIXEDPOINT));
134 | } else {
135 | outColor = sampleColor;
136 | }
137 |
138 | if (Test == 1 && outColor.a == 0.0) {
139 | outColor += vec4(0.0, 0.2, 0.0, 1.0);
140 | }
141 | }
142 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/aggregate_6.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec4 Position;
6 |
7 | uniform mat4 ProjMat;
8 | uniform vec2 SearchLayerSize;
9 | uniform vec2 OutSize;
10 |
11 | out vec2 texCoord;
12 | flat out vec2 inOneTexel;
13 | flat out float inAspectRatio;
14 | flat out float conversionK;
15 |
16 | void main(){
17 | float x = -1.0;
18 | float y = -1.0;
19 | if (Position.x > 0.001){
20 | x = 1.0;
21 | }
22 | if (Position.y > 0.001){
23 | y = 1.0;
24 | }
25 |
26 | inAspectRatio = SearchLayerSize.x / SearchLayerSize.y;
27 | inOneTexel = 1.0 / SearchLayerSize;
28 | texCoord = Position.xy / OutSize;
29 | conversionK = tan(FOV / 360.0 * 3.14159265358979) * 2.0;
30 |
31 | gl_Position = vec4(x, y, 0.2, 1.0);
32 | }
33 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/blur_custom.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D InSampler;
4 |
5 | in vec2 texCoord;
6 | flat in float aspectRatio;
7 |
8 | uniform float Radius;
9 | uniform float Offset;
10 |
11 | out vec4 outColor;
12 |
13 | #define ITERATIONS 6
14 |
15 | void main() {
16 | vec2 poissonDisk[64];
17 | poissonDisk[0] = vec2(-0.613392, 0.617481);
18 | poissonDisk[1] = vec2(0.170019, -0.040254);
19 | poissonDisk[2] = vec2(-0.299417, 0.791925);
20 | poissonDisk[3] = vec2(0.645680, 0.493210);
21 | poissonDisk[4] = vec2(-0.651784, 0.717887);
22 | poissonDisk[5] = vec2(0.421003, 0.027070);
23 | poissonDisk[6] = vec2(-0.817194, -0.271096);
24 | poissonDisk[7] = vec2(-0.705374, -0.668203);
25 | poissonDisk[8] = vec2(0.977050, -0.108615);
26 | poissonDisk[9] = vec2(0.063326, 0.142369);
27 | poissonDisk[10] = vec2(0.203528, 0.214331);
28 | poissonDisk[11] = vec2(-0.667531, 0.326090);
29 | poissonDisk[12] = vec2(-0.098422, -0.295755);
30 | poissonDisk[13] = vec2(-0.885922, 0.215369);
31 | poissonDisk[14] = vec2(0.566637, 0.605213);
32 | poissonDisk[15] = vec2(0.039766, -0.396100);
33 | poissonDisk[16] = vec2(0.751946, 0.453352);
34 | poissonDisk[17] = vec2(0.078707, -0.715323);
35 | poissonDisk[18] = vec2(-0.075838, -0.529344);
36 | poissonDisk[19] = vec2(0.724479, -0.580798);
37 | poissonDisk[20] = vec2(0.222999, -0.215125);
38 | poissonDisk[21] = vec2(-0.467574, -0.405438);
39 | poissonDisk[22] = vec2(-0.248268, -0.814753);
40 | poissonDisk[23] = vec2(0.354411, -0.887570);
41 | poissonDisk[24] = vec2(0.175817, 0.382366);
42 | poissonDisk[25] = vec2(0.487472, -0.063082);
43 | poissonDisk[26] = vec2(-0.084078, 0.898312);
44 | poissonDisk[27] = vec2(0.488876, -0.783441);
45 | poissonDisk[28] = vec2(0.470016, 0.217933);
46 | poissonDisk[29] = vec2(-0.696890, -0.549791);
47 | poissonDisk[30] = vec2(-0.149693, 0.605762);
48 | poissonDisk[31] = vec2(0.034211, 0.979980);
49 | poissonDisk[32] = vec2(0.503098, -0.308878);
50 | poissonDisk[33] = vec2(-0.016205, -0.872921);
51 | poissonDisk[34] = vec2(0.385784, -0.393902);
52 | poissonDisk[35] = vec2(-0.146886, -0.859249);
53 | poissonDisk[36] = vec2(0.643361, 0.164098);
54 | poissonDisk[37] = vec2(0.634388, -0.049471);
55 | poissonDisk[38] = vec2(-0.688894, 0.007843);
56 | poissonDisk[39] = vec2(0.464034, -0.188818);
57 | poissonDisk[40] = vec2(-0.440840, 0.137486);
58 | poissonDisk[41] = vec2(0.364483, 0.511704);
59 | poissonDisk[42] = vec2(0.034028, 0.325968);
60 | poissonDisk[43] = vec2(0.099094, -0.308023);
61 | poissonDisk[44] = vec2(0.693960, -0.366253);
62 | poissonDisk[45] = vec2(0.678884, -0.204688);
63 | poissonDisk[46] = vec2(0.001801, 0.780328);
64 | poissonDisk[47] = vec2(0.145177, -0.898984);
65 | poissonDisk[48] = vec2(0.062655, -0.611866);
66 | poissonDisk[49] = vec2(0.315226, -0.604297);
67 | poissonDisk[50] = vec2(-0.780145, 0.486251);
68 | poissonDisk[51] = vec2(-0.371868, 0.882138);
69 | poissonDisk[52] = vec2(0.200476, 0.494430);
70 | poissonDisk[53] = vec2(-0.494552, -0.711051);
71 | poissonDisk[54] = vec2(0.612476, 0.705252);
72 | poissonDisk[55] = vec2(-0.578845, -0.768792);
73 | poissonDisk[56] = vec2(-0.772454, -0.090976);
74 | poissonDisk[57] = vec2(0.504440, 0.372295);
75 | poissonDisk[58] = vec2(0.155736, 0.065157);
76 | poissonDisk[59] = vec2(0.391522, 0.849605);
77 | poissonDisk[60] = vec2(-0.620106, -0.328104);
78 | poissonDisk[61] = vec2(0.789239, -0.419965);
79 | poissonDisk[62] = vec2(-0.545396, 0.538133);
80 | poissonDisk[63] = vec2(-0.178564, -0.596057);
81 |
82 | vec3 tmpCol = vec3(0.0);
83 |
84 | for(int i = 0; i < ITERATIONS; i += 1) {
85 | tmpCol += texture(InSampler, texCoord + poissonDisk[i + int(Offset)] * vec2(1.0 / aspectRatio, 1.0) * Radius).rgb;
86 | }
87 | outColor = vec4(tmpCol / ITERATIONS, 1.0);
88 | }
89 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/blur_custom.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec4 Position;
4 |
5 | uniform mat4 ProjMat;
6 | uniform vec2 OutSize;
7 |
8 | out vec2 texCoord;
9 | flat out float aspectRatio;
10 |
11 | void main(){
12 | vec4 outPos = ProjMat * vec4(Position.xy * OutSize, 0.0, 1.0);
13 | gl_Position = vec4(outPos.xy, 0.2, 1.0);
14 | aspectRatio = OutSize.x / OutSize.y;
15 | texCoord = Position.xy;
16 | }
17 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/centers.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D ApproxCentersSampler;
4 |
5 | in vec2 texCoord;
6 | flat in vec2 oneTexel;
7 |
8 | out vec4 fragColor;
9 |
10 | void main() {
11 | fragColor = texture(ApproxCentersSampler, texCoord);
12 | vec3 c1 = texture(ApproxCentersSampler, texCoord + vec2(oneTexel.x, 0.0)).rgb;
13 | vec3 c2 = texture(ApproxCentersSampler, texCoord + vec2(0.0, oneTexel.y)).rgb;
14 | vec3 c3 = texture(ApproxCentersSampler, texCoord + vec2(oneTexel.x, -oneTexel.y)).rgb;
15 | vec3 c4 = texture(ApproxCentersSampler, texCoord + vec2(oneTexel.x, oneTexel.y)).rgb;
16 | if (dot(fragColor.rgb - c1, vec3(1.0)) < 0.02
17 | || dot(fragColor.rgb - c2, vec3(1.0)) < 0.02
18 | || dot(fragColor.rgb - c3, vec3(1.0)) < 0.02
19 | || dot(fragColor.rgb - c4, vec3(1.0)) < 0.02) {
20 | fragColor = vec4(0.0);
21 | }
22 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/centers.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec4 Position;
4 |
5 | uniform mat4 ProjMat;
6 | uniform vec2 OutSize;
7 |
8 | out vec2 texCoord;
9 | flat out vec2 oneTexel;
10 |
11 | void main(){
12 | vec4 outPos = ProjMat * vec4(Position.xy * OutSize, 0.0, 1.0);
13 | gl_Position = vec4(outPos.xy, 0.2, 1.0);
14 | oneTexel = 1.0 / OutSize;
15 | texCoord = Position.xy;
16 | }
17 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/filter.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D ItemEntitySampler;
6 | uniform sampler2D ItemEntityDepthSampler;
7 |
8 | in vec2 texCoord;
9 |
10 | out vec4 fragColor;
11 |
12 | void main() {
13 | fragColor = vec4(0.0);
14 | float depth = texture(ItemEntityDepthSampler, texCoord).r;
15 |
16 | if (depth < LIGHTDEPTH) {
17 | depth = LinearizeDepth(depth / LIGHTDEPTH);
18 | if (depth < LIGHTRANGE) {
19 | fragColor = texture(ItemEntitySampler, texCoord);
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/filter.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec4 Position;
4 |
5 | uniform mat4 ProjMat;
6 | uniform vec2 OutSize;
7 |
8 | out vec2 texCoord;
9 |
10 | void main() {
11 | vec4 outPos = ProjMat * vec4(Position.xy * OutSize, 0.0, 1.0);
12 | gl_Position = vec4(outPos.xy, 0.2, 1.0);
13 | texCoord = Position.xy;
14 | }
15 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/light_apply.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D DiffuseSampler;
7 | uniform sampler2D DiffuseDepthSampler;
8 | uniform sampler2D LightsSampler;
9 | uniform sampler2D VolumeSampler;
10 | uniform sampler2D BlurSampler;
11 |
12 | uniform vec2 VolumeSize;
13 | uniform vec2 LightsSize;
14 |
15 | in vec2 texCoord;
16 | flat in vec2 oneTexel;
17 | flat in vec2 oneTexelLights;
18 | flat in vec2 oneTexelVolume;
19 | flat in float aspectRatio;
20 | flat in float conversionK;
21 |
22 | out vec4 outColor;
23 |
24 | void main() {
25 | float depth = LinearizeDepth(texture(DiffuseDepthSampler, texCoord).r);
26 | outColor = texture(DiffuseSampler, texCoord);
27 |
28 | if (depth < LIGHTRANGE + LIGHTR) {
29 | vec4 aggColor = vec4(0.0, 0.0, 0.0, 1.0);
30 | vec4 blurColor = texture(BlurSampler, texCoord);
31 | vec2 screenCoord = (texCoord - vec2(0.5)) * vec2(aspectRatio, 1.0);
32 | float conversion = conversionK * depth;
33 | vec3 worldCoord = vec3(screenCoord * conversion, depth);
34 |
35 | int i = 0;
36 | int zone = int(floor(max((worldCoord.x + LIGHTRANGE) * LIGHTVOLX / (2 * LIGHTRANGE), 0.0)) + floor(max((worldCoord.z) * LIGHTVOLZ / LIGHTRANGE, 0.0)) * LIGHTVOLX);
37 | vec4 volvec = texture(VolumeSampler, (vec2(float(i), float(zone)) + 0.5) * oneTexelVolume);
38 |
39 | while (volvec.a > 0.5 && i < int(LightsSize.x)) {
40 | int li = decodeInt(volvec);
41 | i += 1;
42 | volvec = texture(VolumeSampler, (vec2(float(i), float(zone)) + 0.5) * oneTexelVolume);
43 |
44 | vec4 xvec = texture(LightsSampler, (vec2(float(li), 0.0) + 0.5) * oneTexelLights);
45 | vec4 yvec = texture(LightsSampler, (vec2(float(li), 1.0) + 0.5) * oneTexelLights);
46 | vec4 zvec = texture(LightsSampler, (vec2(float(li), 2.0) + 0.5) * oneTexelLights);
47 | vec3 lightWorldCoord = vec3(decodeInt(xvec), decodeInt(yvec), decodeInt(zvec)) / FIXEDPOINT;
48 | float lightDist = length(worldCoord - lightWorldCoord);
49 | if (lightDist < LIGHTR) {
50 | vec3 lightColor = texture(LightsSampler, (vec2(float(li), 3.0) + 0.5) * oneTexelLights).rgb;
51 | vec2 lightPos = lightWorldCoord.xy / (lightWorldCoord.z * conversionK) * vec2(1.0 / aspectRatio, 1.0);
52 | lightPos = 0.5 - abs(lightPos);
53 | aggColor.rgb += clamp((pow(1.0 / (lightDist + SPREAD), 2.0) - CUTOFF) * BOOST, 0.0, 1.0) * lightColor * clamp(LIGHTRANGE - length(lightWorldCoord), 0.0, 6.0) * clamp(min(lightPos.x, lightPos.y), 0.0, 0.05) * 20.0 / 6.0;
54 | }
55 | }
56 |
57 | outColor.rgb *= vec3(1.0) + aggColor.rgb * LIGHTINTENSITY * 5.0 * pow(1.0 - clamp(length(blurColor.rgb), 0.0, 1.0), 3.0);
58 | outColor.rgb += LIGHTINTENSITY * aggColor.rgb * 0.1;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/light_apply.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | in vec4 Position;
7 |
8 | uniform sampler2D LightsSampler;
9 | uniform sampler2D VolumeSampler;
10 | uniform mat4 ProjMat;
11 | uniform vec2 OutSize;
12 | uniform vec2 LightsSize;
13 | uniform vec2 VolumeSize;
14 |
15 | out vec2 texCoord;
16 | flat out vec2 oneTexel;
17 | flat out vec2 oneTexelLights;
18 | flat out vec2 oneTexelVolume;
19 | flat out float aspectRatio;
20 | flat out float conversionK;
21 |
22 | void main(){
23 | vec4 outPos = ProjMat * vec4(Position.xy * OutSize, 0.0, 1.0);
24 | oneTexel = 1.0 / OutSize;
25 | oneTexelLights = 1.0 / LightsSize;
26 | oneTexelVolume = 1.0 / VolumeSize;
27 | aspectRatio = OutSize.x / OutSize.y;
28 | texCoord = Position.xy;
29 | conversionK = tan(FOV / 360.0 * 3.14159265358979) * 2.0;
30 |
31 | gl_Position = vec4(outPos.xy, 0.2, 1.0);
32 | }
33 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/light_apply_i.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D DiffuseSampler;
7 | uniform sampler2D DiffuseDepthSampler;
8 | uniform sampler2D LightsSampler;
9 | uniform sampler2D VolumeSampler;
10 | uniform sampler2D CompareDepthSampler;
11 |
12 | uniform vec2 VolumeSize;
13 | uniform vec2 LightsSize;
14 |
15 | in vec2 texCoord;
16 | flat in vec2 oneTexel;
17 | flat in vec2 oneTexelLights;
18 | flat in vec2 oneTexelVolume;
19 | flat in float aspectRatio;
20 | flat in float conversionK;
21 |
22 | out vec4 outColor;
23 |
24 | void main() {
25 | outColor = texture(DiffuseSampler, texCoord);
26 | if (outColor.a > 0.0) {
27 | float oDepth = texture(DiffuseDepthSampler, texCoord).r;
28 | float compDepth = texture(CompareDepthSampler, texCoord).r;
29 | float depth = LinearizeDepth(oDepth);
30 |
31 | if (oDepth >= LIGHTDEPTH && oDepth < compDepth && depth < LIGHTRANGE + LIGHTR) {
32 | vec4 aggColor = vec4(0.0, 0.0, 0.0, 1.0);
33 | vec2 screenCoord = (texCoord - vec2(0.5)) * vec2(aspectRatio, 1.0);
34 | float conversion = conversionK * depth;
35 | vec3 worldCoord = vec3(screenCoord * conversion, depth);
36 |
37 | int i = 0;
38 | int zone = int(floor(max((worldCoord.x + LIGHTRANGE) * LIGHTVOLX / (2 * LIGHTRANGE), 0.0)) + floor(max((worldCoord.z) * LIGHTVOLZ / LIGHTRANGE, 0.0)) * LIGHTVOLX);
39 | vec4 volvec = texture(VolumeSampler, (vec2(float(i), float(zone)) + 0.5) * oneTexelVolume);
40 |
41 | while (volvec.a > 0.5 && i < int(LightsSize.x)) {
42 | int li = decodeInt(volvec);
43 | i += 1;
44 | volvec = texture(VolumeSampler, (vec2(float(i), float(zone)) + 0.5) * oneTexelVolume);
45 |
46 | vec4 xvec = texture(LightsSampler, (vec2(float(li), 0.0) + 0.5) * oneTexelLights);
47 | vec4 yvec = texture(LightsSampler, (vec2(float(li), 1.0) + 0.5) * oneTexelLights);
48 | vec4 zvec = texture(LightsSampler, (vec2(float(li), 2.0) + 0.5) * oneTexelLights);
49 | vec3 lightWorldCoord = vec3(decodeInt(xvec), decodeInt(yvec), decodeInt(zvec)) / FIXEDPOINT;
50 | float lightDist = length(worldCoord - lightWorldCoord);
51 | if (lightDist < LIGHTR) {
52 | vec3 lightColor = texture(LightsSampler, (vec2(float(li), 3.0) + 0.5) * oneTexelLights).rgb;
53 | vec2 lightPos = lightWorldCoord.xy / (lightWorldCoord.z * conversionK) * vec2(1.0 / aspectRatio, 1.0);
54 | lightPos = 0.5 - abs(lightPos);
55 | aggColor.rgb += clamp((pow(1.0 / (lightDist + SPREAD), 2.0) - CUTOFF) * BOOST, 0.0, 1.0) * lightColor * clamp(LIGHTRANGE - length(lightWorldCoord), 0.0, 6.0) * clamp(min(lightPos.x, lightPos.y), 0.0, 0.05) * 20.0 / 6.0;
56 | }
57 | }
58 |
59 | float Intensity = outColor.a < 1.0 ? LIGHTINTENSITYT : LIGHTINTENSITY;
60 | outColor.rgb *= vec3(1.0) + aggColor.rgb * Intensity * 5.0 * pow(1.0 - clamp(length(outColor.rgb), 0.0, 1.0), 3.0);
61 | outColor.rgb += Intensity * aggColor.rgb * 0.1;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/light_apply_t.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D DiffuseSampler;
7 | uniform sampler2D DiffuseDepthSampler;
8 | uniform sampler2D LightsSampler;
9 | uniform sampler2D VolumeSampler;
10 | uniform sampler2D CompareDepthSampler;
11 |
12 | uniform vec2 VolumeSize;
13 | uniform vec2 LightsSize;
14 |
15 | in vec2 texCoord;
16 | flat in vec2 oneTexel;
17 | flat in vec2 oneTexelLights;
18 | flat in vec2 oneTexelVolume;
19 | flat in float aspectRatio;
20 | flat in float conversionK;
21 |
22 | out vec4 outColor;
23 |
24 | void main() {
25 | outColor = texture(DiffuseSampler, texCoord);
26 | if (outColor.a > 0.0) {
27 | float oDepth = texture(DiffuseDepthSampler, texCoord).r;
28 | float compDepth = texture(CompareDepthSampler, texCoord).r;
29 | float depth = LinearizeDepth(oDepth);
30 |
31 | if (oDepth < compDepth && depth < LIGHTRANGE + LIGHTR) {
32 | vec4 aggColor = vec4(0.0, 0.0, 0.0, 1.0);
33 | vec2 screenCoord = (texCoord - vec2(0.5)) * vec2(aspectRatio, 1.0);
34 | float conversion = conversionK * depth;
35 | vec3 worldCoord = vec3(screenCoord * conversion, depth);
36 |
37 | int i = 0;
38 | int zone = int(floor(max((worldCoord.x + LIGHTRANGE) * LIGHTVOLX / (2 * LIGHTRANGE), 0.0)) + floor(max((worldCoord.z) * LIGHTVOLZ / LIGHTRANGE, 0.0)) * LIGHTVOLX);
39 | vec4 volvec = texture(VolumeSampler, (vec2(float(i), float(zone)) + 0.5) * oneTexelVolume);
40 |
41 | while (volvec.a > 0.5 && i < int(LightsSize.x)) {
42 | int li = decodeInt(volvec);
43 | i += 1;
44 | volvec = texture(VolumeSampler, (vec2(float(i), float(zone)) + 0.5) * oneTexelVolume);
45 |
46 | vec4 xvec = texture(LightsSampler, (vec2(float(li), 0.0) + 0.5) * oneTexelLights);
47 | vec4 yvec = texture(LightsSampler, (vec2(float(li), 1.0) + 0.5) * oneTexelLights);
48 | vec4 zvec = texture(LightsSampler, (vec2(float(li), 2.0) + 0.5) * oneTexelLights);
49 | vec3 lightWorldCoord = vec3(decodeInt(xvec), decodeInt(yvec), decodeInt(zvec)) / FIXEDPOINT;
50 | float lightDist = length(worldCoord - lightWorldCoord);
51 | if (lightDist < LIGHTR) {
52 | vec3 lightColor = texture(LightsSampler, (vec2(float(li), 3.0) + 0.5) * oneTexelLights).rgb;
53 | vec2 lightPos = lightWorldCoord.xy / (lightWorldCoord.z * conversionK) * vec2(1.0 / aspectRatio, 1.0);
54 | lightPos = 0.5 - abs(lightPos);
55 | aggColor.rgb += clamp((pow(1.0 / (lightDist + SPREAD), 2.0) - CUTOFF) * BOOST, 0.0, 1.0) * lightColor * clamp(LIGHTRANGE - length(lightWorldCoord), 0.0, 6.0) * clamp(min(lightPos.x, lightPos.y), 0.0, 0.05) * 20.0 / 6.0;
56 | }
57 | }
58 |
59 | outColor.rgb *= vec3(1.0) + aggColor.rgb * LIGHTINTENSITYT * 5.0 * pow(1.0 - clamp(length(outColor.rgb), 0.0, 1.0), 3.0);
60 | outColor.rgb += LIGHTINTENSITYT * aggColor.rgb * 0.1;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/transparency.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D MainSampler;
6 | uniform sampler2D MainDepthSampler;
7 | uniform sampler2D TranslucentSampler;
8 | uniform sampler2D TranslucentDepthSampler;
9 | uniform sampler2D ItemEntitySampler;
10 | uniform sampler2D ItemEntityDepthSampler;
11 | uniform sampler2D ParticlesSampler;
12 | uniform sampler2D ParticlesDepthSampler;
13 | uniform sampler2D WeatherSampler;
14 | uniform sampler2D WeatherDepthSampler;
15 | uniform sampler2D CloudsSampler;
16 | uniform sampler2D CloudsDepthSampler;
17 |
18 | uniform int Test;
19 |
20 | in vec2 texCoord;
21 | in vec2 oneTexel;
22 |
23 |
24 | #define NUM_LAYERS 6
25 |
26 | vec4 color_layers[NUM_LAYERS];
27 | float depth_layers[NUM_LAYERS];
28 | int index_layers[NUM_LAYERS] = int[NUM_LAYERS](0, 1 ,2, 3, 4, 5);
29 | int active_layers = 0;
30 |
31 | out vec4 fragColor;
32 |
33 | int try_insert( sampler2D cSampler, sampler2D dSampler, vec2 coord, int ie ) {
34 | vec4 color = texture(cSampler, coord);
35 | if ( color.a == 0.0 ) {
36 | return 0;
37 | }
38 |
39 | float depth = texture( dSampler, coord ).r;
40 | if (ie > 0) {
41 | if (depth < LIGHTDEPTH) {
42 | if (Test == 1) {
43 | color.rgb = vec3(0.0, 1.0, 0.0);
44 | depth = 0.0;
45 | }
46 | else {
47 | return 1;
48 | }
49 | }
50 | }
51 | color_layers[active_layers] = color;
52 | depth_layers[active_layers] = depth;
53 |
54 | int jj = active_layers++;
55 | int ii = jj - 1;
56 | while ( jj > 0 && depth > depth_layers[index_layers[ii]] ) {
57 | int indexTemp = index_layers[ii];
58 | index_layers[ii] = index_layers[jj];
59 | index_layers[jj] = indexTemp;
60 |
61 | jj = ii--;
62 | }
63 |
64 | return 2;
65 | }
66 |
67 | vec3 blend( vec3 dst, vec4 src ) {
68 | return ( dst * ( 1.0 - src.a ) ) + src.rgb;
69 | }
70 |
71 | void main() {
72 | color_layers[0] = vec4( texture( MainSampler, texCoord ).rgb, 1.0 );
73 | depth_layers[0] = texture( MainDepthSampler, texCoord ).r;
74 | active_layers = 1;
75 |
76 | try_insert(CloudsSampler, CloudsDepthSampler, texCoord, 0);
77 | try_insert(TranslucentSampler, TranslucentDepthSampler, texCoord, 0);
78 | try_insert(ParticlesSampler, ParticlesDepthSampler, texCoord, 0);
79 | try_insert(WeatherSampler, WeatherDepthSampler, texCoord, 0);
80 | if (try_insert(ItemEntitySampler, ItemEntityDepthSampler, texCoord, 1) == 1) {
81 | if (try_insert(ItemEntitySampler, ItemEntityDepthSampler, texCoord + vec2(0.0, oneTexel.y), 1) == 1) {
82 | try_insert(ItemEntitySampler, ItemEntityDepthSampler, texCoord + vec2(0.0, -oneTexel.y), 1);
83 | }
84 |
85 | }
86 |
87 | vec3 texelAccum = color_layers[index_layers[0]].rgb;
88 | for ( int ii = 1; ii < active_layers; ++ii ) {
89 | texelAccum = blend( texelAccum, color_layers[index_layers[ii]] );
90 | }
91 |
92 | fragColor = vec4( texelAccum.rgb, 1.0 );
93 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/transparency.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec4 Position;
4 |
5 | uniform mat4 ProjMat;
6 | uniform vec2 OutSize;
7 |
8 | out vec2 texCoord;
9 | out vec2 oneTexel;
10 |
11 | void main() {
12 | vec4 outPos = ProjMat * vec4(Position.xy * OutSize, 0.0, 1.0);
13 | gl_Position = vec4(outPos.xy, 0.2, 1.0);
14 | oneTexel = 1.0 / OutSize;
15 | texCoord = Position.xy;
16 | }
17 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/zone_calc.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D LightsSampler;
7 |
8 | in vec2 texCoord;
9 | flat in vec2 oneTexel;
10 | flat in vec2 oneTexelLights;
11 | flat in float count;
12 | flat in float stepX;
13 | flat in float stepZ;
14 |
15 | out vec4 fragColor;
16 |
17 | void main() {
18 | fragColor = vec4(0.0);
19 |
20 | vec2 pos = gl_FragCoord.xy - 0.5;
21 | int targetIndex = int(round(pos.x));
22 | int zoneX = int(round(pos.y)) % LIGHTVOLX;
23 | int zoneZ = int(round(pos.y)) / LIGHTVOLX;
24 |
25 | int foundIndex = 0;
26 |
27 | for (int i = 0; i < int(count); i += 1) {
28 | vec4 xvec = texture(LightsSampler, (vec2(float(i), 0.0) + 0.5) * oneTexelLights);
29 | vec4 zvec = texture(LightsSampler, (vec2(float(i), 2.0) + 0.5) * oneTexelLights);
30 | vec3 lightCoord = vec3(decodeInt(xvec), 0.0, decodeInt(zvec)) / FIXEDPOINT;
31 | if (lightCoord.x >= -LIGHTRANGE + (float(zoneX) * stepX) - LIGHTR
32 | && lightCoord.x <= -LIGHTRANGE + (float(zoneX + 1) * stepX) + LIGHTR
33 | && lightCoord.z >= (float(zoneZ) * stepZ) - LIGHTR
34 | && lightCoord.z <= (float(zoneZ + 1) * stepZ) + LIGHTR) {
35 | if (targetIndex == foundIndex) {
36 | fragColor = encodeInt(i);
37 | break;
38 | }
39 | foundIndex += 1;
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/shaders/post/zone_calc.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | in vec4 Position;
7 |
8 | uniform sampler2D LightsSampler;
9 |
10 | uniform mat4 ProjMat;
11 | uniform vec2 LightsSize;
12 | uniform vec2 OutSize;
13 |
14 | out vec2 texCoord;
15 | flat out vec2 oneTexel;
16 | flat out vec2 oneTexelLights;
17 | flat out float count;
18 | flat out float stepX;
19 | flat out float stepZ;
20 |
21 | void main(){
22 | float x = -1.0;
23 | float y = -1.0;
24 | if (Position.x > 0.001){
25 | x = 1.0;
26 | }
27 | if (Position.y > 0.001){
28 | y = 1.0;
29 | }
30 |
31 | gl_Position = vec4(x, y, 0.2, 1.0);
32 | oneTexel = 1.0 / OutSize;
33 | oneTexelLights = 1.0 / LightsSize;
34 | texCoord = Position.xy;
35 | stepX = 2.0 * LIGHTRANGE / float(LIGHTVOLX);
36 | stepZ = LIGHTRANGE / float(LIGHTVOLZ);
37 |
38 | vec4 tmpCount = texture(LightsSampler, vec2(1.0, 0.0) - (1.0 / LightsSize) * 0.5);
39 | count = 0.0;
40 | if (tmpCount.a == 69.0 / 255.0) {
41 | tmpCount.a = 1.0;
42 | count = float(decodeInt(tmpCount));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/azure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/azure.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/black.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/blue.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/cyan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/cyan.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/green.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/lime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/lime.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/magenta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/magenta.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/mint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/mint.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/monitor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/monitor.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/orange.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/pink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/pink.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/red.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/tungsten.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/tungsten.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/violet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/violet.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/white.png
--------------------------------------------------------------------------------
/resourcepack/assets/minecraft/textures/misc/yellow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/assets/minecraft/textures/misc/yellow.png
--------------------------------------------------------------------------------
/resourcepack/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 55,
4 | "description": "Colored Lights"
5 | }
6 | }
--------------------------------------------------------------------------------
/resourcepack/pack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/light_painter/45ec859c0f069f3ca25359ac8a8538394dc5a246/resourcepack/pack.png
--------------------------------------------------------------------------------