jsp
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
#include "/lib/shaderSettings/mainLighting.glsl"
|
||||
#include "/lib/lighting/heldLighting.glsl"
|
||||
|
||||
float modify_handheld_pulse() {
|
||||
#if HAND_BLOCKLIGHT_FLICKERING > 0
|
||||
return getHeldLightFlicker();
|
||||
#endif
|
||||
return 1.0;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
#include "/lib/shaderSettings/photonics.glsl"
|
||||
|
||||
bool modify_is_hand() {
|
||||
const float render_factor = 1f / PHOTONICS_RENDER_SCALE;
|
||||
|
||||
return texelFetch(depthtex0, ivec2(gl_FragCoord.xy * render_factor + 0.5), 0).x < 0.56;
|
||||
}
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/shaderSettings/photonics.glsl"
|
||||
#include "/lib/shaderSettings/materials.glsl"
|
||||
#include "/lib/shaderSettings/mainLighting.glsl"
|
||||
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE > 0 && PHOTONICS_LIGHTING_MODE == 2
|
||||
#define PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL PHOTONICS_RESTIR_FLICKER_FIRE
|
||||
#else
|
||||
#define PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL 0
|
||||
#endif
|
||||
|
||||
void modify_light(inout Light light, vec3 world_pos) {
|
||||
int mat = light.blockId;
|
||||
vec3 color = light.color;
|
||||
float intensity = 1.0;
|
||||
|
||||
vec3 torchColor = vec3(1.0, 0.6627, 0.3569);
|
||||
vec3 fireColor = vec3(1.0, 0.4, 0.0);
|
||||
vec3 lavaColor = vec3(1.0, 0.35, 0.0);
|
||||
vec3 halfSoulColor = vec3(0.702, 0.7294, 0.6745);
|
||||
vec3 halfEndBreathColor = vec3(0.7843, 0.349, 0.3333);
|
||||
|
||||
#if BLOCKLIGHT_FLICKERING > 0 || PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
vec2 flickerNoiseBlock = texture2DLod(noisetex, vec2(frameTimeCounter * 0.09), 0.0).rb;
|
||||
float flickerIntensity = mix(1.0, min1(max(flickerNoiseBlock.r, flickerNoiseBlock.g) * 1.7), pow2(max(BLOCKLIGHT_FLICKERING, PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL) * 0.1));
|
||||
if (light.index < 0) flickerIntensity = 1.0; // Don't apply flickering to handHeld light since it already has its own flickering function in handheld_light_pulse_modifier.glsl
|
||||
#endif
|
||||
|
||||
if (mat < 10516) {
|
||||
if (mat < 10452) {
|
||||
if (mat < 10396) {
|
||||
if (mat < 10072) { // No fire-related block
|
||||
if (mat == 10068 || mat == 10070) { // Lava
|
||||
color = lavaColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(lavaColor, colorSoul, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = colorEndBreath;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (mat == 10072) { // Fire
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, halfSoulColor, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = halfEndBreathColor;
|
||||
#endif
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
}
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
else if (mat == 10076) { // Soul Fire
|
||||
intensity = light.intensity;
|
||||
intensity *= flickerIntensity;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (mat == 10396) { // Jack o'Lantern
|
||||
color = torchColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(torchColor, colorSoul, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = colorEndBreath;
|
||||
#endif
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mat < 10496) {
|
||||
if (mat == 10452) { // Magma Block
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, colorSoul, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = colorEndBreath;
|
||||
#endif
|
||||
}
|
||||
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
|
||||
else if (mat == 10476) { // Crying Obsidian
|
||||
color = normalize(netherColor);
|
||||
intensity = light.intensity;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (mat == 10496) { // Torch
|
||||
color = torchColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(torchColor, halfSoulColor, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = halfEndBreathColor;
|
||||
#endif
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
}
|
||||
else if (mat == 10500) { // End Rod
|
||||
#if END_ROD_COLOR_PROFILE == 1
|
||||
color = vec3(END_ROD_R, END_ROD_G, END_ROD_B) / 255 * END_ROD_I;
|
||||
#elif (END_ROD_COLOR_PROFILE == 2 || (END_ROD_COLOR_PROFILE == 3 && defined OVERWORLD))
|
||||
color = vec3(pow2(getRainbowColor(vec2(0.0), float(END_ROD_RAINBOW_ANIMATE))));
|
||||
#else
|
||||
#ifdef END
|
||||
color = vec3(1.0, 0.4, 1.0); // End Rod in the End dimension
|
||||
#else
|
||||
color = vec3(0.9, 0.9, 0.95);
|
||||
#endif
|
||||
#endif
|
||||
intensity = light.intensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mat < 10652) {
|
||||
if (mat < 10576) {
|
||||
if (mat == 10516) { // Furnace
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, colorSoul, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = colorEndBreath;
|
||||
#endif
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
}
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
else if (mat == 10528) { // Soul Torch
|
||||
intensity = light.intensity;
|
||||
intensity *= flickerIntensity;
|
||||
}
|
||||
#endif
|
||||
else if (mat == 10560 || mat == 10562) { // Lantern
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, halfSoulColor, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = halfEndBreathColor;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (mat == 10576) { // Smoker
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, colorSoul, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = colorEndBreath;
|
||||
#endif
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
}
|
||||
else if (mat == 10580) { // Blast Furnace
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, colorSoul, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = colorEndBreath;
|
||||
#endif
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
}
|
||||
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
|
||||
else if (mat == 10588) { // Respawn Anchor
|
||||
color = normalize(netherColor);
|
||||
intensity = light.intensity;
|
||||
|
||||
}
|
||||
else if (mat == 10592) { // Respawn Anchor (charged)
|
||||
color = normalize(netherColor);
|
||||
intensity = light.intensity;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (mat < 10836) {
|
||||
if (mat == 10652) { // Campfire
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, halfSoulColor, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = halfEndBreathColor;
|
||||
#endif
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
}
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
else if (mat == 10656) { // Soul Campfire
|
||||
intensity = light.intensity;
|
||||
intensity *= flickerIntensity;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (mat == 10836) { // Brewing Stand
|
||||
color = fireColor;
|
||||
intensity = light.intensity;
|
||||
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
|
||||
color = mix(fireColor, colorSoul, inSoulValley);
|
||||
#elif defined PURPLE_END_FIRE_INTERNAL
|
||||
color = colorEndBreath;
|
||||
#endif
|
||||
}
|
||||
#if PHOTONICS_RESTIR_FLICKER_FIRE_INTERNAL > 0
|
||||
else if (mat == 10984) { // Soul Fire
|
||||
intensity = light.intensity;
|
||||
intensity *= flickerIntensity;
|
||||
}
|
||||
#endif
|
||||
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
|
||||
else if (mat == 30020) { // Nether Portal
|
||||
color = normalize(netherColor);
|
||||
intensity = light.intensity;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if BLOCKLIGHT_FLICKERING > 0
|
||||
intensity *= flickerIntensity;
|
||||
#endif
|
||||
|
||||
#ifdef RANDOM_BLOCKLIGHT
|
||||
float RandR = texture2DLod(noisetex, 0.00016 * RANDOM_BLOCKLIGHT_SIZE * world_pos.xz, 0.0).r * XLIGHT_R;
|
||||
float RandG = texture2DLod(noisetex, 0.00029 * RANDOM_BLOCKLIGHT_SIZE * world_pos.xz, 0.0).r * XLIGHT_G;
|
||||
float RandB = texture2DLod(noisetex, 0.00034 * RANDOM_BLOCKLIGHT_SIZE * world_pos.xz, 0.0).r * XLIGHT_B;
|
||||
color = vec3(RandR, RandG, RandB) * 0.875;
|
||||
#endif
|
||||
|
||||
light.color = color * intensity;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/shaderSettings/photonics.glsl"
|
||||
|
||||
ivec2 modify_denoiser_depth_fetch(ivec2 texCoord) {
|
||||
const float render_factor = 1f / PHOTONICS_RENDER_SCALE ;
|
||||
|
||||
return ivec2(texCoord * render_factor + 0.5);
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
void modify_restir_gi(inout vec3 color){
|
||||
color = saturateColors(color, 1.2);
|
||||
color *= mix(0.066, 0.05, sunVisibility2) * PHOTONICS_INDIRECT_INTENSITY * 0.1;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/shaderSettings/materials.glsl"
|
||||
|
||||
void voxel_color_modifier(inout vec4 color, vec3 rt_pos, ivec3 rt_block_pos) {
|
||||
int mat = result_block_id;
|
||||
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
|
||||
if (mat == 30020) color.rgb = normalize(netherColor) * GetLuminance(color.rgb) * 2.5;
|
||||
#endif
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// Photonics API - content provided by the Photonics mod at runtime.
|
||||
// This empty file ensures the shader pack loads without the mod installed.
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// Photonics API - content provided by the Photonics mod at runtime.
|
||||
// This empty file ensures the shader pack loads without the mod installed.
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#define shadow2D texture
|
||||
#define texture2D texture
|
||||
#define texture2DLod textureLod
|
||||
#define PHOTONICS_SHADER_INTERFACE
|
||||
#define FRAGMENT_SHADER
|
||||
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/util/spaceConversion.glsl"
|
||||
#include "/lib/util/dither.glsl"
|
||||
#include "/lib/antialiasing/jitter.glsl"
|
||||
#include "/lib/shaderSettings/photonics.glsl"
|
||||
#include "/lib/shaderSettings/materials.glsl"
|
||||
#include "/lib/shaderSettings/mainLighting.glsl"
|
||||
|
||||
uniform vec3 sunPosition;
|
||||
uniform vec3 upPosition;
|
||||
|
||||
vec3 sunVec = normalize(sunPosition);
|
||||
vec3 upVec = normalize(upPosition);
|
||||
vec3 sunVecWorld = normalize(mat3(gbufferModelViewInverse) * sunVec);
|
||||
|
||||
float SdotU = dot(sunVec, upVec);
|
||||
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
|
||||
float sunVisibility2 = sunVisibility * sunVisibility;
|
||||
|
||||
#include "/lib/colors/lightAndAmbientColors.glsl"
|
||||
|
||||
float sunVisibilitySaturated = clamp((dot(sunVec, upVec) + 0.0625f) / 0.125f, 0.0f, 1.0f);
|
||||
vec3 lightVecWorld = (sunVecWorld.y < 0.0f) ? -sunVecWorld : sunVecWorld;
|
||||
|
||||
const float rcp_render_scale = 1f / PHOTONICS_RENDER_SCALE;
|
||||
ivec2 ph_tex_coord = ivec2(texelCoord * rcp_render_scale + 0.5);
|
||||
|
||||
vec3 load_world_position() {
|
||||
#if PHOTONICS_LIGHTING_MODE == 1
|
||||
#define fixThisStupidShaderBugWithDifferentDepthTex depthtex1
|
||||
#else
|
||||
#define fixThisStupidShaderBugWithDifferentDepthTex depthtex0
|
||||
#endif
|
||||
vec2 texCoord = gl_FragCoord.xy / floor(vec2(viewWidth, viewHeight) * PHOTONICS_RENDER_SCALE);
|
||||
float depth = texelFetch(fixThisStupidShaderBugWithDifferentDepthTex, ph_tex_coord, 0).r;
|
||||
#ifdef TAA
|
||||
vec3 screenPos = vec3(TAAJitter(texCoord, -0.5), depth);
|
||||
#else
|
||||
vec3 screenPos = vec3(texCoord, depth);
|
||||
#endif
|
||||
vec3 playerPos = ViewToPlayer(ScreenToView(screenPos));
|
||||
#ifdef PHOTONICS_PIXELATED_SHADOWS_INTERNAL
|
||||
playerPos += texelFetch(colortex11, ph_tex_coord, 0).rgb;
|
||||
#endif
|
||||
|
||||
return playerPos + cameraPositionBest;
|
||||
}
|
||||
|
||||
void load_fragment_variables(out vec3 albedo, out vec3 world_pos, out vec3 world_normal, out vec3 world_normal_mapped) {
|
||||
albedo = texelFetch(colortex10, ph_tex_coord, 0).xyz;
|
||||
world_normal = texelFetch(colortex20, ph_tex_coord, 0).xyz;
|
||||
world_normal_mapped = texelFetch(colortex4, ph_tex_coord, 0).xyz;
|
||||
world_pos = load_world_position() - 0.01f * world_normal;
|
||||
}
|
||||
|
||||
vec3 sun_direction = normalize(lightVecWorld);
|
||||
|
||||
vec3 indirect_light_color = pow(mix(lightColor, vec3(GetLuminance(lightColor)), 0.8f) * mix(2.5, 1.0, sunVisibility2), vec3(1.5));
|
||||
|
||||
vec2 get_taa_jitter() { return vec2(0.0f); }
|
||||
|
||||
vec3 get_sky_color(ivec2 gBufferLoc, vec3 worldPos, vec3 newNormal) {
|
||||
return vec3(0.0);
|
||||
}
|
||||
|
||||
bool is_in_world() { return texelFetch(depthtex0, ph_tex_coord, 0).x <= 0.99999f; }
|
||||
|
||||
#define PH_USE_CUSTOM_ALPHA
|
||||
#define PH_ALPHA_FUNC(color) apply_tint_impl(color)
|
||||
|
||||
vec3 apply_tint_impl(vec4 color) {
|
||||
#if PHOTONICS_LIGHTING_MODE == 1
|
||||
float tintStrength = 1.66;
|
||||
float tintSaturation = 1.35;
|
||||
#elif PHOTONICS_LIGHTING_MODE == 2
|
||||
float tintStrength = 1.0;
|
||||
float tintSaturation = 1.2;
|
||||
#endif
|
||||
return clamp01(saturateColors(mix(
|
||||
color.rgb,
|
||||
vec3(step(color.a, 0.5)),
|
||||
abs((color.a * 2f) - 1f)
|
||||
), tintSaturation) * tintStrength);
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void write_indirect(vec3 color) {
|
||||
/* RENDERTARGETS:9 */
|
||||
color = saturateColors(color, 1.25f);
|
||||
fragColor = vec4(color, 1.0f);
|
||||
}
|
||||
Reference in New Issue
Block a user