@hology/webgpu-renderer 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -281,7 +281,7 @@ type RendererExtractedLightState = ExtractedLightState;
|
|
|
281
281
|
* without mutating the scene's material slots. Return `undefined` to use the
|
|
282
282
|
* renderer fallback material, or `null` to intentionally skip the draw.
|
|
283
283
|
*/
|
|
284
|
-
type RendererMaterialResolver = (material: Material, pass?: 'opaque' | 'late') => WGSLShaderMaterial | null | undefined;
|
|
284
|
+
type RendererMaterialResolver = (material: Material, pass?: 'opaque' | 'late' | 'outline') => WGSLShaderMaterial | null | undefined;
|
|
285
285
|
interface RendererOptions {
|
|
286
286
|
canvas: HTMLCanvasElement;
|
|
287
287
|
/** Linear-sRGB clear color. Presentation converts it to display sRGB. */
|
|
@@ -616,8 +616,8 @@ interface VolumetricFogOptions {
|
|
|
616
616
|
/** Temporal sub-froxel jitter accumulated by fog history and optionally TAA. */
|
|
617
617
|
readonly temporalJitter?: boolean;
|
|
618
618
|
/**
|
|
619
|
-
* Fog-local temporal reconstruction
|
|
620
|
-
*
|
|
619
|
+
* Fog-local temporal reconstruction of the 3D scattering/extinction grid.
|
|
620
|
+
* This history is accumulated before front-to-back integration.
|
|
621
621
|
*/
|
|
622
622
|
readonly temporal?: false | VolumetricFogTemporalOptions;
|
|
623
623
|
/** Stable per-ray depth jitter. Breaks slice bands without animated noise. */
|
|
@@ -669,6 +669,8 @@ declare class VolumetricFogEffect {
|
|
|
669
669
|
private scene;
|
|
670
670
|
readonly integratedVolume: FrameGraphTextureHandle;
|
|
671
671
|
readonly columnDepthBounds: FrameGraphTextureHandle;
|
|
672
|
+
readonly scatteringHistoryA: FrameGraphTextureHandle;
|
|
673
|
+
readonly scatteringHistoryB: FrameGraphTextureHandle;
|
|
672
674
|
private readonly options;
|
|
673
675
|
private readonly resources;
|
|
674
676
|
private readonly uniformStorage;
|
|
@@ -695,6 +697,16 @@ declare class VolumetricFogEffect {
|
|
|
695
697
|
private readonly projectionInverse;
|
|
696
698
|
private readonly viewProjectionInverse;
|
|
697
699
|
private readonly previousTemporalViewProjection;
|
|
700
|
+
private readonly previousFroxelViewProjection;
|
|
701
|
+
private readonly previousFroxelCameraPosition;
|
|
702
|
+
private previousFroxelNear;
|
|
703
|
+
private previousFroxelFar;
|
|
704
|
+
private previousFroxelWidth;
|
|
705
|
+
private previousFroxelHeight;
|
|
706
|
+
private froxelHistoryValid;
|
|
707
|
+
private froxelHistoryWriteIndex;
|
|
708
|
+
private activeHistoryRead;
|
|
709
|
+
private activeHistoryWrite;
|
|
698
710
|
private explicitVolumes;
|
|
699
711
|
private volumeObjects;
|
|
700
712
|
private extractedLights;
|
|
@@ -735,7 +747,7 @@ declare class VolumetricFogEffect {
|
|
|
735
747
|
private getResources;
|
|
736
748
|
}
|
|
737
749
|
/** WGSL appended to a material that calls rendererApplyVolumetricFog(). */
|
|
738
|
-
declare const VOLUMETRIC_FOG_MATERIAL_WGSL = "\nfn
|
|
750
|
+
declare const VOLUMETRIC_FOG_MATERIAL_WGSL = "\nfn rendererSampleIntegratedFogRaw(uv: vec2<f32>, normalizedDepth: f32) -> vec4<f32> {\n let sliceCount = f32(textureDimensions(volumetricFogTexture).z);\n let slicePosition = clamp(normalizedDepth, 0.0, 1.0) * sliceCount;\n let textureZ = clamp((slicePosition - 0.5) / sliceCount, 0.0, 1.0);\n let integrated = textureSampleLevel(volumetricFogTexture, volumetricFogSampler, vec3<f32>(uv, textureZ), 0.0);\n // The volume stores slice endpoints but has no texel for the near-plane\n // identity value. Reconstruct that missing endpoint for the first slice.\n return mix(vec4<f32>(0.0, 0.0, 0.0, 1.0), integrated, min(slicePosition, 1.0));\n}\nfn rendererSampleIntegratedFog(uv: vec2<f32>, normalizedDepth: f32) -> vec4<f32> {\n return rendererSampleIntegratedFogRaw(uv, normalizedDepth);\n}\nfn rendererApplyVolumetricFog(color: vec4<f32>, worldPosition: vec3<f32>) -> vec4<f32> {\n let clip = rendererCamera.viewProj * vec4<f32>(worldPosition, 1.0);\n let uv = clip.xy / clip.w * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n let distance = length(worldPosition - rendererCamera.cameraPosition.xyz);\n let bounds = textureSampleLevel(volumetricFogBoundsTexture, volumetricFogBoundsSampler, uv, 0.0).rg;\n let z = clamp(log(max(distance, bounds.x) / bounds.x) / max(log(bounds.y / bounds.x), 0.0001), 0.0, 1.0);\n let fog = rendererSampleIntegratedFog(uv, z);\n return vec4<f32>(fog.rgb + color.rgb * fog.a, color.a);\n}";
|
|
739
751
|
/** Adds the froxel input; append VOLUMETRIC_FOG_MATERIAL_WGSL and call its helper in fsMain. */
|
|
740
752
|
declare function configureVolumetricFogMaterial(material: WGSLShaderMaterial, resource?: string, boundsResource?: string): WGSLShaderMaterial;
|
|
741
753
|
|
|
@@ -766,6 +778,10 @@ type ToonOutlineParameters = {
|
|
|
766
778
|
thickness?: number;
|
|
767
779
|
/** Linear RGB outline color. Defaults to black. */
|
|
768
780
|
color?: readonly [number, number, number] | readonly number[];
|
|
781
|
+
/** Outline color source. Missing values preserve the legacy fixed-color behavior. */
|
|
782
|
+
colorMode?: "fixed" | "darkenedAlbedo";
|
|
783
|
+
/** Linear albedo darkening from 0 (unchanged) to 1 (black). Defaults to 0.65. */
|
|
784
|
+
darkening?: number;
|
|
769
785
|
/** Defaults to the source material's opacity. */
|
|
770
786
|
alpha?: number;
|
|
771
787
|
/** Set to false to suppress the otherwise enabled outline. */
|