UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

75 lines (74 loc) 4.12 kB
import type { N8AOPostPass } from "n8ao"; import { type EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js"; import { VolumeParameter } from "../VolumeParameter.js"; /**See (N8AO documentation)[https://github.com/N8python/n8ao] */ export declare enum ScreenSpaceAmbientOcclusionN8QualityMode { Performance = 0, Low = 1, Medium = 2, High = 3, Ultra = 4 } /** [ScreenSpaceAmbientOcclusionN8](https://engine.needle.tools/docs/api/ScreenSpaceAmbientOcclusionN8) is a screen space ambient occlusion (SSAO) effect. * Ambient Occlusion is a shading method used to calculate how exposed each point in a scene is to ambient lighting. * The effect enhances the depth and realism of 3D scenes by simulating the soft shadows that occur in crevices, corners, and areas where objects are close to each other. * This implementation uses the N8AO library to provide high-quality SSAO with various quality settings. * @summary Screen Space Ambient Occlusion (SSAO) Post-Processing Effect * @category Effects * @group Components * @link [N8AO documentation](https://github.com/N8python/n8ao) */ export declare class ScreenSpaceAmbientOcclusionN8 extends PostProcessingEffect { get typeName(): string; get pass(): N8AOPostPass; gammaCorrection: boolean; /** The most important parameter for your ambient occlusion effect. * Controls the radius/size of the ambient occlusion in world units. * Should be set to how far you want the occlusion to extend from a given object. * Set it too low, and AO becomes an edge detector. * Too high, and the AO becomes "soft" and might not highlight the details you want. * The radius should be one or two magnitudes less than scene scale: * if your scene is 10 units across, the radius should be between 0.1 and 1. If its 100, 1 to 10. * @default 1 */ aoRadius: VolumeParameter; /** The second most important parameter for your ambient occlusion effect. * Controls how fast the ambient occlusion fades away with distance in proportion to its radius. * Defaults to 1, and behind-the-scenes, is a calculated as a ratio of your radius (0.2 * distanceFalloff is the size used for attenuation). * Decreasing it reduces "haloing" artifacts and improves the accuracy of your occlusion, * but making it too small makes the ambient occlusion disappear entirely. * @default 1 */ falloff: VolumeParameter; /** A purely artistic control for the intensity of the AO - runs the ao through the function pow(ao, intensity), * which has the effect of darkening areas with more ambient occlusion. * Useful to make the effect more pronounced. * An intensity of 2 generally produces soft ambient occlusion that isn't too noticeable, * whereas one of 5 produces heavily prominent ambient occlusion. * @default 1 */ intensity: VolumeParameter; /** The color of the ambient occlusion. By default, it is black, but it can be changed to any color * to offer a crude approximation of global illumination. * Recommended in scenes where bounced light has a uniform "color", * for instance a scene that is predominantly lit by a blue sky. * The color is expected to be in the sRGB color space, and is automatically converted to linear space for you. * Keep the color pretty dark for sensible results. * @default new Color(0, 0, 0) */ color: VolumeParameter; /** If you want the AO to calculate the radius based on screen space, you can do so by setting configuration.screenSpaceRadius to true. * This is useful for scenes where the camera is moving across different scales a lot, * or for scenes where the camera is very close to the objects. * @default false */ screenspaceRadius: boolean; /** * The quality of the ambient occlusion effect. * @default ScreenSpaceAmbientOcclusionN8QualityMode.Medium */ quality: ScreenSpaceAmbientOcclusionN8QualityMode; private _ssao?; onValidate(): void; onCreateEffect(): EffectProviderResult; }