Soft shadows keep their width on the ground across the sun cascades

The pcss radii and penumbra factor were in UV of whichever cascade map a pixel read, the same in every cascade. Each cascade's map spans 3.5 to 5 times the ground of the one before (measured on 1.4.3: the cascades end at about 4, 27, 120 and 450 m), so a soft shadow turned that much softer at every cascade step, a step that moves with the camera (issue #1291).

The runtime now measures each cascade from the camera block the lighting shaders read (c4 rows 42 to 57, a projective matrix per cascade, and row 58, the cascade ends): the UV and depth per metre where the cascade begins and ends. It passes two factors per cascade in two new support buffer fields, pcss_depth and pcss_scale, and translator patch 0017 applies them in the PCSS lookup. The values keep their meaning in the second cascade, which holds most shadows on screen, so the look at a given pcss value stays where most players see it. The narrowest radius stays in texels. The HDR field moves from byte 1440 to 1472. With pcss = 0 nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
itaskaev2andClaude Opus 5.5 committed 2026-11-19 11:41:00 +01:00
1 parent ebce67b367
commit 4edf63a6dd
6 files changed
+179 -29

No files matched your search

+3 -3
View File
@@ -1,5 +1,5 @@
// Generated by tools/build_shaders.py from runtime/shaders/hdr_tonemap.frag; do not edit.
// source sha256 2680db17a9c8cd3ad85bcbc75d67e46e84179dfbe4ac7e7904fcdc935febe4ca
// source sha256 92e96e90540b3b7b022393843a05a1bc2addaf9f2afc535d8204faace6cebdf0
#pragma once
#include <stdint.h>
static const uint32_t hdr_tonemap_spv[] = {
@@ -15,7 +15,7 @@ static const uint32_t hdr_tonemap_spv[] = {
0x00000002, 0x00050048, 0x00000437, 0x00000000, 0x00000023, 0x00000000, 0x00040047, 0x00000439,
0x00000021, 0x00000004, 0x00040047, 0x00000439, 0x00000022, 0x00000000, 0x00040047, 0x0000043e,
0x00000006, 0x00000010, 0x00030047, 0x0000043f, 0x00000002, 0x00050048, 0x0000043f, 0x00000000,
0x00000023, 0x00000000, 0x00050048, 0x0000043f, 0x00000001, 0x00000023, 0x000005a0, 0x00040047,
0x00000023, 0x00000000, 0x00050048, 0x0000043f, 0x00000001, 0x00000023, 0x000005c0, 0x00040047,
0x00000441, 0x00000021, 0x00000000, 0x00040047, 0x00000441, 0x00000022, 0x00000000, 0x00040047,
0x00000493, 0x0000001e, 0x00000000, 0x00020013, 0x00000002, 0x00030021, 0x00000003, 0x00000002,
0x00030016, 0x00000006, 0x00000020, 0x00040017, 0x00000007, 0x00000006, 0x00000003, 0x00040017,
@@ -81,7 +81,7 @@ static const uint32_t hdr_tonemap_spv[] = {
0x0004003b, 0x00000430, 0x00000431, 0x00000002, 0x00040020, 0x00000432, 0x00000002, 0x00000073,
0x0004001c, 0x00000436, 0x00000073, 0x0000042d, 0x0003001e, 0x00000437, 0x00000436, 0x00040020,
0x00000438, 0x00000002, 0x00000437, 0x0004003b, 0x00000438, 0x00000439, 0x00000002, 0x0004002b,
0x00000080, 0x0000043d, 0x0000005a, 0x0004001c, 0x0000043e, 0x00000073, 0x0000043d, 0x0004001e,
0x00000080, 0x0000043d, 0x0000005c, 0x0004001c, 0x0000043e, 0x00000073, 0x0000043d, 0x0004001e,
0x0000043f, 0x0000043e, 0x00000073, 0x00040020, 0x00000440, 0x00000002, 0x0000043f, 0x0004003b,
0x00000440, 0x00000441, 0x00000002, 0x00040020, 0x00000442, 0x00000002, 0x00000006, 0x0006002c,
0x00000007, 0x00000463, 0x00000128, 0x00000128, 0x00000128, 0x0004002b, 0x00000006, 0x0000046f,
+2 -2
View File
@@ -27,8 +27,8 @@ layout(location = 0) in vec4 uv;
layout(location = 0) out vec4 color;
layout(set = 0, binding = 0, std140) uniform SupportBuffer {
vec4 pad[90];
vec4 hdr; // byte 1440 (vk_exec_draw.c support_fill): game white / HUD white, peak / game white, hue correction
vec4 pad[92];
vec4 hdr; // byte 1472 (vk_exec_draw.c support_fill): game white / HUD white, peak / game white, hue correction
} support_buffer;
layout(set = 0, binding = 1) uniform sampler2D fp_t_tcb_8;
layout(set = 0, binding = 2) uniform sampler2D fp_t_tcb_A;
+111 -19
View File
@@ -16,6 +16,7 @@
// 9365-9488, 9489-9921, 10013-10079 @ b75be8cf (MIT, Copyright (c) 2026 jhaizhou); the uniform-buffer spans, texture and
// sampler descriptor lookups and the dispatch flow follow LAS Recomp runtime/nvn/vulkan/exec.c:1851-1908, 2300-2516
// @ da35b83a (MIT, Copyright (c) 2026 Peiikai). The support buffer layout is Ryujinx's SupportBuffer.cs (MIT).
#include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
@@ -36,8 +37,10 @@
#define MAX_DESC 1024
#define CHUNK_BYTES (4u << 20)
#define ZERO_BYTES 65536u
#define SUPPORT_BYTES 1456u // Ryujinx SupportBuffer (std140): alpha_test, is_bgra[8], viewport_inverse, viewport_size, ...;
// 1408 pcss and 1424 shadow_spread (translator patches 0010, 0011), 1440 HDR (support_fill)
#define SUPPORT_BYTES 1488u // Ryujinx SupportBuffer (std140): alpha_test, is_bgra[8], viewport_inverse, viewport_size, ...;
// 1408 pcss, 1424 shadow_spread, 1440 pcss_depth and 1456 pcss_scale (translator patches 0010,
// 0011, 0017), 1472 HDR (support_fill)
#define SUP_IN 11 // support_in: viewport size, point size, then pcss_depth and pcss_scale per cascade
#define NVN_STAGE_VS 0
#define NVN_STAGE_FS 1
#define NVN_STAGE_CS 5
@@ -245,7 +248,7 @@ typedef struct {
uint64_t vgen;
int vb_valid;
uint8_t support[SUPPORT_BYTES]; // last support buffer and where it lives
float sup_in[3]; // the support_fill arguments it was filled from
float sup_in[SUP_IN]; // the support_fill arguments it was filled from
VkBuffer sup_buf;
VkDeviceSize sup_off;
int sup_valid;
@@ -286,7 +289,7 @@ static struct { int mode; uint64_t calls, cmds, empty; } DD = {-1};
typedef struct { int cls, use; uint64_t bytes; } RsCount;
typedef struct {
uint32_t hn; // words of h the last signature filled; 0: none
uint64_t h[24]; // generations, feedback images, support inputs, base instance
uint64_t h[28]; // generations, feedback images, support inputs, base instance
const VkPipeInfo *info; // the pipeline whose RsList ranges body holds, as of bind op generation gen
uint64_t gen;
uint8_t body[RS_BYTES];
@@ -510,6 +513,7 @@ typedef struct VkExecDraw {
VkDescSlot d[MAX_DESC];
VkBufferView bv[MAX_DESC];
RsRange rs_tmp[MAX_DESC]; // rs_list's
struct { uint64_t addr; float key[8], out[8]; int valid; } PCSS; // pcss_cascades' last camera block and answer
} VkExecDraw;
static VkExecDraw *draw_new(VkExec *ex) {
@@ -2060,17 +2064,23 @@ static VkDescriptorSet alloc_set_batched(VkExec *ex, VkDescriptorSetLayout layou
return alloc_set(ex, layout);
}
static void support_in(const VkExec *ex, float in[3]) { // what support_fill reads: viewport size, point size
static const float *pcss_params(void);
static void pcss_cascades(const VkExec *ex, float out[8]);
// What support_fill reads: viewport size, point size, and the soft shadows' per-cascade factors (pcss_cascades).
static void support_in(const VkExec *ex, float in[SUP_IN]) {
float k = ex->pass_scale > 1 ? (float)ex->pass_scale : 1.0f;
in[0] = ex->in_pass && ex->has_vp ? ex->vp[0][2] * k : (float)ex->pass_w;
in[1] = ex->in_pass && ex->has_vp ? ex->vp[0][3] * k : (float)ex->pass_h;
in[2] = ex->point_size > 0 ? ex->point_size : 1.0f;
pcss_cascades(ex, in + 3);
}
// TOTK_PCSS (percent, 0 = off): the pcss field of the support buffer, which translator patch 0010 reads in every
// explicit-LOD compare on a 2D array texture (the sun cascades). x: penumbra width in UV per unit of light-space depth
// between receiver and blocker (0 keeps the game's single compare), y and z: the narrowest and widest disc radius,
// w: the blocker search radius, all in UV of the cascade map. Radii are in UV, so they hold at any TOTK_SHADOW_SCALE.
// w: the blocker search radius, all in UV of the second cascade's map (pcss_cascades scales them for the others).
// Radii are in UV, so they hold at any TOTK_SHADOW_SCALE.
// TOTK_PCSS_K overrides the depth-to-penumbra factor at 100 percent, for tuning.
static const float *pcss_params(void) {
static float p[4] = {-1, 0, 0, 0};
@@ -2086,6 +2096,86 @@ static const float *pcss_params(void) {
return p;
}
// The pcss_depth and pcss_scale fields (translator patch 0017): per sun cascade, what turns the pcss values into that
// cascade's. The pcss radii are in UV of whichever cascade map a pixel reads, and the game's cascades differ a lot in
// how much ground a UV spans: the measured cascades (1.4.3, Gerudo and Hyrule Field) end at about 4 to 8, 27 to 31, 120
// and 450 m, and each map spans 3.5 to 5 times the ground of the one before. With the same UV radius everywhere a shadow
// turned that much softer at every cascade step, a step that moves with the camera (issue #1291). The pcss values keep
// their meaning in the second cascade, which holds most of the shadows on screen (from a few metres in front of Link
// to about 30 m) and so is the softness players chose with pcss; the other cascades are measured against it.
//
// The lighting shaders read the cascades from the camera block c4 (fragment stage, 0x940 bytes, the block
// runtime/vk_contact.c reads): rows 42 + 4c to 45 + 4c take a view-space position to cascade c's map as a projective
// matrix (u, v, depth, w; the first cascade's w row is 0 0 0 1, the others' are not: the far maps are warped to give
// more texels near the camera), and row 58 holds the distances where the cascades end. For each cascade the
// derivatives of its u, v and depth along the ground are taken at the view axis (view space looks along -z) where the
// cascade begins and where it ends, and averaged geometrically over those two points:
// scale = s_c / s_1, with s the geometric mean of |du/dp| and |dv/dp| (UV per metre): the search and widest radius
// cover the same ground as in the second cascade;
// depth = (s_c / d_c) / (s_1 / d_1), with d = |d depth/dp| (depth per metre): the same penumbra per metre between
// blocker and receiver.
// The narrowest radius stays in texels (the shader keeps it), so the far cascades come back to about the game's own
// filter. A draw without that block, or with values that do not make a cascade, gets 1 everywhere: the same UV values in
// every cascade, as before this field.
static int pcss_measure(const float *u, int c, float dist, float *s, float *d) {
const float *m = u + 4 * (42 + 4 * c); // rows u, v, depth, w
float p[3] = {0, 0, -dist}, h[4];
for (int r = 0; r < 4; r++) h[r] = m[4 * r] * p[0] + m[4 * r + 1] * p[1] + m[4 * r + 2] * p[2] + m[4 * r + 3];
if (!(h[3] > 1e-6f)) return 0;
float len[3];
for (int r = 0; r < 3; r++) { // d(h_r / h_3)/dp = (row_r - (h_r / h_3) row_w) / h_3
float q = h[r] / h[3], g[3];
for (int k = 0; k < 3; k++) g[k] = (m[4 * r + k] - q * m[12 + k]) / h[3];
len[r] = sqrtf(g[0] * g[0] + g[1] * g[1] + g[2] * g[2]);
}
*s = sqrtf(len[0] * len[1]), *d = len[2];
return *s > 1e-7f && *s < 1e4f && *d > 1e-7f && *d < 1e4f;
}
static void pcss_measure_all(const float *u, float out[8]) {
const float *end = u + 4 * 58;
float s[4], d[4];
for (int c = 0; c < 4; c++) {
float near = c ? end[c - 1] : 0.0f, far = end[c];
if (!(far > near) || !(far < 1e5f)) return;
float s0, d0, s1, d1;
if (!pcss_measure(u, c, c ? near : 0.5f * far, &s0, &d0) || !pcss_measure(u, c, far, &s1, &d1)) return;
s[c] = sqrtf(s0 * s1), d[c] = sqrtf(d0 * d1);
}
float r[8];
for (int c = 0; c < 4; c++) {
float sc = s[c] / s[1], dc = (s[c] / d[c]) / (s[1] / d[1]);
if (!(sc > 1e-4f && sc < 1e2f) || !(dc > 1e-3f && dc < 1e3f)) return;
r[c] = dc, r[4 + c] = sc;
}
memcpy(out, r, sizeof r);
static volatile int32_t logged;
if (!__atomic_exchange_n(&logged, 1, __ATOMIC_RELAXED))
rt_log("vk: soft shadows per cascade (cascades end at %.1f, %.1f, %.1f and %.1f m): ground scale %.3f, 1, %.3f, "
"%.3f; penumbra factor %.3f, 1, %.3f, %.3f", end[0], end[1], end[2], end[3], out[4], out[6], out[7], out[0],
out[2], out[3]);
}
// support_in asks for every draw that binds the support buffer, twice (bind_sig and bind_resources), and the camera
// block changes once a frame: the answer is kept with the block's address and its first cascade's u row and cascade
// ends, which move whenever the camera or the sun does.
static void pcss_cascades(const VkExec *ex, float out[8]) {
for (int i = 0; i < 8; i++) out[i] = 1.0f;
if (!(pcss_params()[0] > 0)) return;
const p_bind_buf *b = &ex->ubo[NVN_STAGE_FS][1];
if (!b->addr || b->size != 0x940) return;
const float *u = (const float *)(uintptr_t)b->addr;
float key[8];
memcpy(key, u + 4 * 42, 16), memcpy(key + 4, u + 4 * 58, 16);
VkExecDraw *D = ex->draw;
if (D && D->PCSS.valid && D->PCSS.addr == b->addr && !memcmp(key, D->PCSS.key, sizeof key)) {
memcpy(out, D->PCSS.out, sizeof D->PCSS.out);
return;
}
pcss_measure_all(u, out);
if (D) D->PCSS.addr = b->addr, memcpy(D->PCSS.key, key, sizeof key), memcpy(D->PCSS.out, out, sizeof D->PCSS.out), D->PCSS.valid = 1;
}
// The shadow_spread field of the support buffer: the factor translator patch 0011 applies to the lighting shaders' sun
// shadow filter offset (element 56 .xy of their lighting block), 1 / TOTK_SHADOW_SCALE. The game spaces its four
// compares for its own shadow map texels; with maps TOTK_SHADOW_SCALE times larger, the same offset in UV spans that
@@ -2102,7 +2192,8 @@ static const float *shadow_spread_params(void) {
return p;
}
static void support_fill(uint8_t *b, float w, float h, float point_size) {
static void support_fill(uint8_t *b, const float in[SUP_IN]) {
float w = in[0], h = in[1], point_size = in[2];
memset(b, 0, SUPPORT_BYTES);
float inv[4] = {w > 0 ? 2.0f / w : 0, h > 0 ? 2.0f / h : 0, 0, 0}, size[4] = {w, h, 0, 0};
memcpy(b + 144, inv, 16);
@@ -2111,11 +2202,12 @@ static void support_fill(uint8_t *b, float w, float h, float point_size) {
memcpy(b + 1392, &point_size, 4); // point_size (translator patch 0008): vertex shaders that write none output it
memcpy(b + 1408, pcss_params(), 16); // pcss (translator patch 0010): soft sun shadows in the cascade compares
memcpy(b + 1424, shadow_spread_params(), 16); // shadow_spread (translator patch 0011): sun shadow filter width
memcpy(b + 1440, in + 3, 32); // pcss_depth and pcss_scale (translator patch 0017): soft shadows per cascade
for (int i = 0; i < 73; i++) memcpy(b + 192 + 16 * i, &one, 4); // render scale 1: the host renders at guest size
if (vk_hdr_wanted()) { // read by the HDR tonemap only (shaders/hdr_tonemap.frag), which declares it past the translator's
float hdr[4];
vk_hdr_support(hdr);
memcpy(b + 1440, hdr, 16);
memcpy(b + 1472, hdr, 16);
}
}
@@ -2396,13 +2488,13 @@ static int bind_sig(const VkExec *ex, const VkPipeInfo *info) {
PUT(vk_mem_gen() + vk_usnap_gen() + ex->drop_n); // all only grow in a submission; drop_n: copies a chunk passed
for (int i = 0; i < ex->nfbl && i < 9; i++) PUT((uintptr_t)ex->fbl_img[i]);
if (l->sup) {
float in[3];
float in[SUP_IN + 1] = {0};
support_in(ex, in);
uint64_t a;
uint32_t ps;
memcpy(&a, in, 8), memcpy(&ps, &in[2], 4);
PUT(a);
PUT(ps);
for (int i = 0; i < SUP_IN; i += 2) {
uint64_t a;
memcpy(&a, &in[i], 8);
PUT(a);
}
}
if (l->c0) PUT(D->c0_binst);
for (int i = 0; i < l->np; i++) PUT(ubo_ptr(ex, l->p[i].st, l->p[i].res));
@@ -2587,11 +2679,11 @@ static void bind_resources(VkExec *ex, const VkPipeInfo *info, const uint64_t *b
if (meta) memset(&meta[nd], 0, cnt * sizeof *meta);
#define BI_CUR(k) (D->BI.cur = meta ? &meta[nd + (k)] : NULL)
if (b->kind == VK_PIPE_SUPPORT) {
float in[3];
float in[SUP_IN];
support_in(ex, in);
if (!D->B.sup_valid || MX_NE(in, D->B.sup_in, sizeof in)) { // support_fill reads only these
uint8_t tmp[SUPPORT_BYTES];
support_fill(tmp, in[0], in[1], in[2]);
support_fill(tmp, in);
MX_CPY(D->B.sup_in, in, sizeof in);
if (!D->B.sup_valid || MX_NE(tmp, D->B.support, SUPPORT_BYTES)) { // a new buffer only when the contents changed
VkBuffer sb;
@@ -3517,7 +3609,7 @@ static struct {
uint32_t ndesc, cdesc;
NVNbufferRange vin[17]; // the vertex ranges MQ.vb[nvb - 1] was resolved from, under vk_mem_gen vgen
uint64_t vgen;
float sup_in[3]; // the support buffer last filled for the list and its inputs
float sup_in[SUP_IN]; // the support buffer last filled for the list and its inputs
VkDescriptorBufferInfo sup;
float par_in[4]; // the fragment shader's parameters last written and their inputs
VkDescriptorBufferInfo par;
@@ -3617,12 +3709,12 @@ static int mo_desc(VkExec *ex, const VkPipeInfo *info, MoDraw *q) {
VkDescSlot *o = &d[nd];
int st = nvn_stage_of(b->stage);
if (b->kind == VK_PIPE_SUPPORT) {
float in[3];
float in[SUP_IN];
support_in(ex, in);
if (!MQ.sup.buffer || memcmp(in, MQ.sup_in, sizeof in)) {
VkBuffer sb;
VkDeviceSize so;
support_fill(scratch(ex, SUPPORT_BYTES, &sb, &so), in[0], in[1], in[2]);
support_fill(scratch(ex, SUPPORT_BYTES, &sb, &so), in);
MQ.sup = (VkDescriptorBufferInfo){sb, so, SUPPORT_BYTES};
memcpy(MQ.sup_in, in, sizeof in);
}
+3 -3
View File
@@ -1,7 +1,7 @@
"""Build the shader translator: build/xlate/totk_xlate.exe (Ryujinx 1.3.2 + patches, NativeAOT, SPIR-V for Vulkan).
Copies tools/vendor/ryujinx to build/xlate/ryujinx, applies tools/xlate/patches/*.patch there (tools/vendor stays
byte-identical; 0001-0004 are MNG's, 0005-0013, 0015 and 0016 are ours), then runs `dotnet publish`. Needs the .NET 10 SDK, the MSVC build
byte-identical; 0001-0004 are MNG's, 0005-0013 and 0015-0017 are ours), then runs `dotnet publish`. Needs the .NET 10 SDK, the MSVC build
tools and vswhere.exe (docs/building.md). Run with .venv. On Linux it builds build/xlate/totk_xlate for linux-x64, which
NativeAOT links with the system's clang (no MSVC); NativeAOT builds for the OS it runs on only.
@@ -99,8 +99,8 @@ def prepare_sources() -> Path:
for junk in list(src.glob("src/*/obj")) + list(src.glob("src/*/bin")):
shutil.rmtree(junk)
patches = sorted((XLATE / "patches").glob("*.patch"))
if len(patches) != 15:
sys.exit(f"expected 15 patches, found {len(patches)}")
if len(patches) != 16:
sys.exit(f"expected 16 patches, found {len(patches)}")
for patch in patches:
# git apply works outside a repository when given a directory; --check first so a failure names the patch.
for extra in (["--check"], []):
@@ -0,0 +1,57 @@
--- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs
+++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs
@@ -1583,6 +1583,24 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
SpvInstruction uv = context.VectorShuffle(v2, pCoords, pCoords, 0, 1);
SpvInstruction layerF = context.CompositeExtract(f32, pCoords, 2);
SpvInstruction layerI = context.ConvertFToS(s32, layerF);
+
+ // TOTK: soft shadows per cascade. The radii and the penumbra factor above hold for the second cascade, in
+ // UV of its map; each cascade's map spans a different amount of ground per UV. The runtime measures each
+ // cascade against the second (runtime/vk_exec_draw.c, pcss_cascades) and gives pcss_depth[layer], the
+ // penumbra factor's multiplier, and pcss_scale[layer], the UV of this cascade's map that one UV of the
+ // second's ground spans. The search and widest radius take the scale, so a shadow keeps its width on the
+ // ground from one cascade to the next; the narrowest radius stays in texels, the map's own filter. A value
+ // of 0 or below counts as 1.
+ SpvInstruction layerC = context.GlslSClamp(s32, layerI, context.Constant(s32, 0), context.Constant(s32, 3));
+ SpvInstruction cascDepth = context.VectorExtractDynamic(f32, context.Load(v4, context.AccessChain(context.TypePointer(StorageClass.Uniform, v4),
+ context.ConstantBuffers[SupportBuffer.Binding], context.Constant(s32, (int)SupportBufferField.PcssDepth))), layerC);
+ SpvInstruction cascScale = context.VectorExtractDynamic(f32, context.Load(v4, context.AccessChain(context.TypePointer(StorageClass.Uniform, v4),
+ context.ConstantBuffers[SupportBuffer.Binding], context.Constant(s32, (int)SupportBufferField.PcssScale))), layerC);
+ cascDepth = context.Select(f32, context.FOrdGreaterThan(b, cascDepth, zero), cascDepth, one);
+ cascScale = context.Select(f32, context.FOrdGreaterThan(b, cascScale, zero), cascScale, one);
+ lightSize = context.FMul(f32, lightSize, cascDepth);
+ searchR = context.FMul(f32, searchR, cascScale);
+ maxR = context.GlslFMax(f32, context.FMul(f32, maxR, cascScale), minR);
SpvInstruction searchV = context.CompositeConstruct(v2, searchR, searchR);
SpvInstruction sum = zero, count = zero;
--- a/src/Ryujinx.Graphics.Shader/SupportBuffer.cs
+++ b/src/Ryujinx.Graphics.Shader/SupportBuffer.cs
@@ -27,6 +27,8 @@ namespace Ryujinx.Graphics.Shader
PointSize,
Pcss,
ShadowSpread,
+ PcssDepth,
+ PcssScale,
}
public struct SupportBuffer
@@ -86,7 +88,9 @@ namespace Ryujinx.Graphics.Shader
new StructureField(AggregateType.S32, "tfe_vertex_count"),
new StructureField(AggregateType.FP32, "point_size"),
new StructureField(AggregateType.Vector4 | AggregateType.FP32, "pcss"),
- new StructureField(AggregateType.Vector4 | AggregateType.FP32, "shadow_spread")
+ new StructureField(AggregateType.Vector4 | AggregateType.FP32, "shadow_spread"),
+ new StructureField(AggregateType.Vector4 | AggregateType.FP32, "pcss_depth"),
+ new StructureField(AggregateType.Vector4 | AggregateType.FP32, "pcss_scale")
]);
}
@@ -104,5 +108,7 @@ namespace Ryujinx.Graphics.Shader
public Vector4<float> PointSize;
public Vector4<float> Pcss;
public Vector4<float> ShadowSpread;
+ public Vector4<float> PcssDepth;
+ public Vector4<float> PcssScale;
}
}
+3 -2
View File
@@ -276,8 +276,9 @@
# shadows at feet, under stones and in grass that the shadow maps miss. Read at start.
# contact_shadows = 0
# Soft sun shadows (PCSS), percent of the default penumbra width (0 to 200; 0 = the game's own four-tap filter): sharp
# where an object meets the ground and softer the further its shadow falls. Done in the translated shaders (translator
# patch 0010), so the shader cache is rebuilt once after an update. Read at start.
# where an object meets the ground and softer the further its shadow falls. The blur keeps its width on the ground
# from one shadow cascade to the next, so it does not step up where a farther cascade begins. Done in the translated
# shaders (translator patches 0010 and 0017), so the shader cache is rebuilt once after an update. Read at start.
# pcss = 0
# NVIDIA DLSS / DLAA for the 3D scene, on NVIDIA RTX GPUs with the DLSS model from NVIDIA's DLSS SDK next to the