Request: Experience-gated post-process shaders
Journey Bunny
This is an attempted "Shaders in Secondlife" request from a different angle. I want to try to assemble a reasonably scoped, definable approach that a small dev team could realistically implement in finite time. I think most requests try to boil the ocean.
This might not be best merged with other shader requests. It's a specific subset spec... (
See Language, Shader Contract, Effect Mask sections
). Shaders as a fully optional parcel or region experience.Problem
Second Life is a single renderer trying to be every renderer for the game dev/creator resident. The set of real-time techniques available in SL is bounded by the requirement that a technique be either universal or absent. The mechanism to fix this exists everywhere else: let creators write a screen-space post-process pass, scoped to a place, opt-in per user.
Non-goals
These are excluded, not deferred. The design depends on their exclusion.
- No avatar or attachment shaders. Nobody else's avatar affects my render loop. VRChat allows this, it's very common, very powerful, and has serious performance implications. If we want it in SL, make it a separate feature.
- No material or surface shaders. That is a separate proposal. This is a fullscreen pass only.
- No compute shaders, storage buffers, atomics, or image writes. Fragment shader only, let the GPU dispatch the work. This eliminates an infinite variety of inscrutible future conflicts.
- No precompiled binaries. Assets are source text and the viewer is the compiler. Permit only assets declared in the manifest, subject to normal permissions. Accepting binaries runs too many risks (and is too much for LL to automate a red-team).
- No guarantee of pixel-identical output across GPUs. A custom viewer can disable any of this.
Language
Adopt WGSL and use Tint
(from Dawn ) as the front-end. Dawn (and Tint) were originally Apache 2.0. Dawn was changed to BSD 3-Clause License a few years ago, which better matches SLV's LGPL. It has a decade of browser-adversary hardening, and emits GLSL, HLSL, MSL, and SPIR-V from one source. Shader contract
One fullscreen fragment pass, executed after scene render and tone-mapping, before UI composite.
Input
scene_color | texture_2d<f32> | Post-tonemap, linear
scene_depth | texture_2d<f32> | Linearized 0..1, a resolved copy
effect_mask | texture_2d<u32> | R8Uint. Channel 0 through 7, where 0 is untagged
history | texture_2d<f32> | Previous frame's output. Always bound; cleared on effect star
samp | sampler | Viewer-owned, clamp-to-edge, linear filtering
args | Args | Uniform. 16 vec4<f32> of creator parameters
tex0..tex3 | texture_2d<f32> | Up to four manifest-declared texture assets
env | Below.
struct Env {
resolution : vec2<f32>, // offset 0
time : f32, // 8
delta_time : f32, // 12
camera_pos : vec3<f32>, // 16 vec3 aligns to 16
near : f32, // 28
camera_fwd : vec3<f32>, // 32
far : f32, // 44
sun_dir : vec3<f32>, // 48
fov_y : f32, // 60
frame_index : u32, // 64
}
struct Args {
v : array<vec4<f32>, 16>,
}
Effect Mask
Without pixel identity, a fullscreen pass can only ever treat the scene uniformly (eg, whole-screen toon shader).
Mechanism:
A 3-bit channel per face, values 0 through 7, where 0 means untagged. The viewer writes it during the existing geometry pass. The post-process pass reads it. Creators set it through the build tools and through LSL, exactly as they set a texture or a material.#Experience
The Experience system provides a named responsible owner, grid-wide revocation (suspend the Experience and every effect under it dies), a consent flow users already understand, per-user blocking, and parcel scoping.
LSL surface
- integer llSetScreenEffect(key agent, string effect_name, list params);
- integer llUpdateScreenEffectParams(key agent, list params);
- integer llClearScreenEffect(key agent);
Effects clear automatically on region crossing, on teleport, on Experience revocation, and on watchdog trip. (GPU timer query around the pass, rolling median over N frames. If measured cost exceeds the declared ceiling by a fixed factor for a sustained window, the pass is disabled, the user is toasted, and the asset is blacklisted for the session.)
Log In
Toothless Draegonne
Yes please.
Although I would also suggest adding an RLV way of doing this, or using RLV instead, since it's an already-used, already-understood way of granting enhanced permissions, and is already used to provide screenspace effects. It would also make such postprocessing available without the danger of a single experience that may or may not be trusted, gaining grid-wide near-monopoly status, tied to the parcel or region you are in. It would also kind of suck to have toys that can only be used in one place, and it would be nice to be able to play around everywhere instead of whatever few regions are using the experience the toys were compiled under.
Think AVSitter. Now I've no reason to distrust Code Violet, but they are an example of an experience that you're almost required to have on a parcel for a lot of furniture to work properly. There are other experiences with owners that I trust about as far as I could throw, that will never be added to any land I run.