From 54706ad65e02dfbab76549e33db042383705032f Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Wed, 18 May 2022 13:25:34 -0700 Subject: [PATCH] Reorder items in View.java to prep for beamsplitter. --- .../com/google/android/filament/View.java | 1488 ++++++++--------- 1 file changed, 744 insertions(+), 744 deletions(-) diff --git a/android/filament-android/src/main/java/com/google/android/filament/View.java b/android/filament-android/src/main/java/com/google/android/filament/View.java index 91a7991e0e..6a70b8e3a1 100644 --- a/android/filament-android/src/main/java/com/google/android/filament/View.java +++ b/android/filament-android/src/main/java/com/google/android/filament/View.java @@ -85,656 +85,6 @@ public class View { private SoftShadowOptions mSoftShadowOptions; private GuardBandOptions mGuardBandOptions; - /** - * Generic quality level. - */ - public enum QualityLevel { - LOW, - MEDIUM, - HIGH, - ULTRA - } - - public enum BlendMode { - OPAQUE, - TRANSLUCENT - } - - /** - * Dynamic resolution can be used to either reach a desired target frame rate by lowering the - * resolution of a View, or to increase the quality when the rendering is faster - * than the target frame rate. - * - *

- * This structure can be used to specify the minimum scale factor used when lowering the - * resolution of a View, and the maximum scale factor used when increasing the - * resolution for higher quality rendering. The scale factors can be controlled on each X and Y - * axis independently. By default, all scale factors are set to 1.0. - *

- * - *

- * Dynamic resolution is only supported on platforms where the time to render a frame can be - * measured accurately. Dynamic resolution is currently only supported on Android. - *

- */ - public static class DynamicResolutionOptions { - /** - * Enables or disables dynamic resolution on a View. - */ - public boolean enabled = false; - - /** - * If false, the system scales the major axis first. - */ - public boolean homogeneousScaling = false; - - /** - * The minimum scale in X and Y this View should use. - */ - public float minScale = 0.5f; - - /** - * The maximum scale in X and Y this View should use. - */ - public float maxScale = 1.0f; - - /** - * Sharpness when QualityLevel.MEDIUM or higher is used [0, 1]. - * 0 is disabled, 1 is the sharpest setting. - * The default is set to 0.9 - */ - public float sharpness = 0.9f; - - /** - * Upscaling quality - * LOW: bilinear filtered blit. Fastest, poor quality - * MEDIUM: AMD FidelityFX FSR1 w/ mobile optimizations no RCAS sharpening pass - * HIGH: AMD FidelityFX FSR1 w/ mobile optimizations + RCAS - * ULTRA: AMD FidelityFX FSR1 - * FSR1 require a well anti-aliased (MSAA or TAA), noise free scene. - * - * The default upscaling quality is set to LOW. - */ - @NonNull - public QualityLevel quality = QualityLevel.LOW; - } - - /** - * Options for screen space Ambient Occlusion - */ - public static class AmbientOcclusionOptions { - /** - * Ambient Occlusion radius in meters, between 0 and ~10. - */ - public float radius = 0.3f; - - /** - * Self-occlusion bias in meters. Use to avoid self-occlusion. Between 0 and a few mm. - */ - public float bias = 0.0005f; - - /** - * Controls ambient occlusion's contrast. Must be positive. Default is 1. - * Good values are between 0.5 and 3. - */ - public float power = 1.0f; - - /** - * How each dimension of the AO buffer is scaled. Must be either 0.5 or 1.0. - */ - public float resolution = 0.5f; - - /** - * Strength of the Ambient Occlusion effect. Must be positive. - */ - public float intensity = 1.0f; - - /** - * Depth distance that constitute an edge for filtering. Must be positive. - * Default is 5cm. - * This must be adjusted with the scene's scale and/or units. - * A value too low will result in high frequency noise, while a value too high will - * result in the loss of geometry edges. For AO, it is generally better to be too - * blurry than not enough. - */ - public float bilateralThreshold = 0.05f; - - /** - * The quality setting controls the number of samples used for evaluating Ambient - * occlusion. The default is QualityLevel.LOW which is sufficient for most mobile - * applications. - */ - @NonNull - public QualityLevel quality = QualityLevel.LOW; - - /** - * The lowPassFilter setting controls the quality of the low pass filter applied to - * AO estimation. The default is QualityLevel.MEDIUM which is sufficient for most mobile - * applications. QualityLevel.LOW disables the filter entirely. - */ - @NonNull - public QualityLevel lowPassFilter = QualityLevel.MEDIUM; - - /** - * The upsampling setting controls the quality of the ambient occlusion buffer upsampling. - * The default is QualityLevel.LOW and uses bilinear filtering, a value of - * QualityLevel.HIGH or more enables a better bilateral filter. - */ - @NonNull - public QualityLevel upsampling = QualityLevel.LOW; - - /** - * enable or disable screen space ambient occlusion - */ - public boolean enabled = false; - - /** - * enables bent normals computation from AO, and specular AO - */ - public boolean bentNormals = false; - - /** - * Minimal angle to consider in radian. This is used to reduce the creases that can - * appear due to insufficiently tessellated geometry. - * For e.g. a good values to try could be around 0.2. - */ - public float minHorizonAngleRad = 0.0f; - - - /** - * Full cone angle in radian, between 0 and pi/2. This affects the softness of the shadows, - * as well as how far they are cast. A smaller angle yields to sharper and shorter shadows. - * The default angle is about 60 degrees. - */ - public float ssctLightConeRad = 1.0f; - - /** - * Distance from where tracing starts. - * This affects how far shadows are cast. - */ - public float ssctShadowDistance = 0.01f; - - /** - * Maximum contact distance with the cone. Intersections between the traced cone and - * geometry samller than this distance are ignored. - */ - public float ssctContactDistanceMax = 1.0f; - - /** - * Intensity of the shadows. - */ - public float ssctIntensity = 0.8f; - - /** - * Light direction. - */ - @NonNull @Size(min = 3) - public float[] ssctLightDirection = { 0, -1, 0 }; - - /** - * Depth bias in world units (mitigate self shadowing) - */ - public float ssctDepthBias = 0.01f; - - /** - * Depth slope bias (mitigate self shadowing) - */ - public float ssctDepthSlopeBias = 0.01f; - - /** - * Tracing sample count, between 1 and 255. This affects the quality as well as the - * distance of the shadows. - */ - public int ssctSampleCount = 4; - - /** - * Numbers of rays to trace, between 1 and 255. This affects the noise of the shadows. - * Performance degrades quickly with this value. - */ - public int ssctRayCount = 1; - - /** - * Enables or disables SSCT. - */ - public boolean ssctEnabled = false; - } - - /** - * Options for Multi-sample Anti-aliasing (MSAA) - * @see View#setMultiSampleAntiAliasingOptions - */ - public static class MultiSampleAntiAliasingOptions { - /** enables or disables temporal anti-aliasing */ - public boolean enabled = false; - - /** - * number of samples to use for multi-sampled anti-aliasing.\n - * 0: treated as 1 - * 1: no anti-aliasing - * n: sample count. Effective sample could be different depending on the - * GPU capabilities. - */ - public int sampleCount = 4; - - /** - * custom resolve improves quality for HDR scenes, but may impact performance. - */ - public boolean customResolve = false; - }; - - /** - * Options for Temporal Anti-aliasing (TAA) - * @see View#setTemporalAntiAliasingOptions - */ - public static class TemporalAntiAliasingOptions { - /** reconstruction filter width typically between 0 (sharper, aliased) and 1 (smoother) */ - public float filterWidth = 1.0f; - - /** history feedback, between 0 (maximum temporal AA) and 1 (no temporal AA). */ - public float feedback = 0.04f; - - /** enables or disables temporal anti-aliasing */ - public boolean enabled = false; - }; - - /** - * Options for Screen-space Reflections. - * @see View#setScreenSpaceReflectionOptions - */ - public static class ScreenSpaceReflectionsOptions { - /** ray thickness, in world units */ - public float thickness = 0.1f; - - /** bias, in world units, to prevent self-intersections */ - public float bias = 0.01f; - - /** maximum distance, in world units, to raycast */ - public float maxDistance = 3.0f; - - /** stride, in texels, for samples along the ray. */ - public float stride = 2.0f; - - /** enables or disables screen-space reflections */ - public boolean enabled = false; - }; - - /** - * Options for the screen-space guard band. - * A guard band can be enabled to avoid some artifacts towards the edge of the screen when - * using screen-space effects such as SSAO. - * Enabling the guard band reduces performance slightly. - * Currently the guard band can only be enabled or disabled. - * - * @see View#setGuardBandOptions - */ - public static class GuardBandOptions { - /** enables or disables the guard band */ - public boolean enabled = false; - }; - - /** - * Options for controlling the Bloom effect - * - * enabled: Enable or disable the bloom post-processing effect. Disabled by default. - * levels: Number of successive blurs to achieve the blur effect, the minimum is 3 and the - * maximum is 11. This value together with resolution influences the spread of the - * blur effect. This value can be silently reduced to accommodate the original - * image size. - * resolution: Resolution of bloom's vertical axis. The minimum value is 2^levels and the - * the maximum is lower of the original resolution and 2048. This parameter is - * silently clamped to the minimum and maximum. - * It is highly recommended that this value be smaller than the target resolution - * after dynamic resolution is applied (horizontally and vertically). - * strength: how much of the bloom is added to the original image. Between 0 and 1. - * blendMode: Whether the bloom effect is purely additive (false) or mixed with the original - * image (true). - * anamorphism: Bloom's aspect ratio (x/y), for artistic purposes. - * threshold: When enabled, a threshold at 1.0 is applied on the source image, this is - * useful for artistic reasons and is usually needed when a dirt texture is used. - * dirt: A dirt/scratch/smudges texture (that can be RGB), which gets added to the - * bloom effect. Smudges are visible where bloom occurs. Threshold must be - * enabled for the dirt effect to work properly. - * dirtStrength: Strength of the dirt texture. - * - * @see View#setBloomOptions - */ - public static class BloomOptions { - - public enum BlendingMode { - ADD, - INTERPOLATE - } - - /** - * User provided dirt texture - */ - @Nullable - public Texture dirt = null; - - /** - * strength of the dirt texture - */ - public float dirtStrength = 0.2f; - - /** - * Strength of the bloom effect, between 0.0 and 1.0 - */ - public float strength = 0.10f; - - /** - * Resolution of minor axis (2^levels to 2048) - */ - public int resolution = 360; - - /** - * Bloom x/y aspect-ratio (1/32 to 32) - */ - public float anamorphism = 1.0f; - - /** - * Number of blur levels (3 to 11) - */ - public int levels = 6; - - /** - * How the bloom effect is applied - */ - public BlendingMode blendMode = BlendingMode.ADD; - - /** - * Whether to threshold the source - */ - public boolean threshold = true; - - /** - * enable or disable bloom - */ - public boolean enabled = false; - - /** - * limit highlights to this value before bloom. Use +inf for no limiting. - * minimum value is 10.0. - */ - public float highlight = 1000.0f; - - - /** - * enable screen-space lens flare - */ - public boolean lensFlare = false; - - /** - * enable starburst effect on lens flare - */ - public boolean starburst = true; - - /** - * amount of chromatic aberration - */ - public float chromaticAberration = 0.005f; - - /** - * number of flare "ghosts" - */ - public int ghostCount = 4; - - /** - * spacing of the ghost in screen units [0, 1[ - */ - public float ghostSpacing = 0.6f; - - /** - * hdr threshold for the ghosts - */ - public float ghostThreshold = 10.0f; - - /** - * thickness of halo in vertical screen units, 0 to disable - */ - public float haloThickness = 0.1f; - - /** - * radius of halo in vertical screen units [0, 0.5] - */ - public float haloRadius = 0.4f; - - /** - * hdr threshold for the halo - */ - public float haloThreshold = 10.0f; - } - - /** - * Options to control fog in the scene - * - * @see View#setFogOptions - */ - public static class FogOptions { - /** - * distance in world units from the camera where the fog starts ( >= 0.0 ) - */ - public float distance = 0.0f; - - /** - * fog's maximum opacity between 0 and 1 - */ - public float maximumOpacity = 1.0f; - - /** - * fog's floor in world units - */ - public float height = 0.0f; - - /** - * how fast fog dissipates with altitude - */ - public float heightFalloff = 1.0f; - - /** - * Fog's color as a linear RGB color. - */ - @NonNull - @Size(min = 3) - public float[] color = { 0.5f, 0.5f, 0.5f }; - - /** - * fog's density at altitude given by 'height' - */ - public float density = 0.1f; - - /** - * distance in world units from the camera where in-scattering starts - */ - public float inScatteringStart = 0.0f; - - /** - * size of in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100) - */ - public float inScatteringSize = -1.0f; - - /** - * fog color will be modulated by the IBL color in the view direction - */ - public boolean fogColorFromIbl = false; - - /** - * enable or disable fog - */ - public boolean enabled = false; - } - - /** - * Options to control Depth of Field (DoF) effect in the scene - * - * @see View#setDepthOfFieldOptions - */ - public static class DepthOfFieldOptions { - - public enum Filter { - NONE, - UNUSED, - MEDIAN - } - - /** - * circle of confusion scale factor (amount of blur) - * - *

cocScale can be used to set the depth of field blur independently from the camera - * aperture, e.g. for artistic reasons. This can be achieved by setting:

- * - * cocScale = cameraAperture / desiredDoFAperture - * - * - */ - public float cocScale = 1.0f; - - /** maximum aperture diameter in meters (zero to disable bokeh rotation) */ - public float maxApertureDiameter = 0.01f; - - /** enable or disable Depth of field effect */ - public boolean enabled = false; - - /** filter to use for filling gaps in the kernel */ - @NonNull - public Filter filter = Filter.MEDIAN; - - /** perform DoF processing at native resolution */ - public boolean nativeResolution = false; - - /** - *

Number of of rings used by the foreground kernel. The number of rings affects quality - * and performance. The actual number of sample per pixel is defined - * as (ringCount * 2 - 1)^2. Here are a few commonly used values:

- * 3 rings : 25 ( 5x 5 grid) - * 4 rings : 49 ( 7x 7 grid) - * 5 rings : 81 ( 9x 9 grid) - * 17 rings : 1089 (33x33 grid) - * - *

With a maximum circle-of-confusion of 32, it is never necessary to use more than 17 rings.

- * - *

Usually all three settings below are set to the same value, however, it is often - * acceptable to use a lower ring count for the "fast tiles", which improves performance. - * Fast tiles are regions of the screen where every pixels have a similar - * circle-of-confusion radius.

- * - *

A value of 0 means default, which is 5 on desktop and 3 on mobile.

- */ - public int foregroundRingCount = 0; - - /** - * Number of of rings used by the background kernel. The number of rings affects quality - * and performance. - * @see #foregroundRingCount - */ - public int backgroundRingCount = 0; - - /** - * Number of of rings used by the fast gather kernel. The number of rings affects quality - * and performance. - * @see #foregroundRingCount - */ - public int fastGatherRingCount = 0; - - /** - * maximum circle-of-confusion in pixels for the foreground, must be in [0, 32] range. - * A value of 0 means default, which is 32 on desktop and 24 on mobile. - */ - public int maxForegroundCOC = 0; - - /** - * maximum circle-of-confusion in pixels for the background, must be in [0, 32] range. - * A value of 0 means default, which is 32 on desktop and 24 on mobile. - */ - public int maxBackgroundCOC = 0; - }; - - /** - * Options to control the vignetting effect. - */ - public static class VignetteOptions { - /** - * High values restrict the vignette closer to the corners, between 0 and 1. - */ - public float midPoint = 0.5f; - - /** - * Controls the shape of the vignette, from a rounded rectangle (0.0), to an oval (0.5), - * to a circle (1.0). The value must be between 0 and 1. - */ - public float roundness = 0.5f; - - /** - * Softening amount of the vignette effect, between 0 and 1. - */ - public float feather = 0.5f; - - /** - * Color of the vignette effect as a linear RGBA color. The alpha channel is currently - * ignored. - */ - @NonNull - @Size(min = 4) - public float[] color = { 0.0f, 0.0f, 0.0f, 1.0f }; - - /** - * Enables or disables the vignette effect. - */ - public boolean enabled = false; - } - - /** - * Structure used to set the color precision for the rendering of a View. - * - *

- * This structure offers separate quality settings for different parts of the rendering - * pipeline. - *

- * - * @see #setRenderQuality - * @see #getRenderQuality - */ - public static class RenderQuality { - /** - *

- * A quality of HIGH or ULTRA means using an RGB16F or RGBA16F color - * buffer. This means colors in the LDR range (0..1) have 10 bit precision. A quality of - * LOW or MEDIUM means using an R11G11B10F opaque color buffer or an - * RGBA16F transparent color buffer. With R11G11B10F colors in the LDR range have a precision of - * either 6 bits (red and green channels) or 5 bits (blue channel). - *

- */ - public QualityLevel hdrColorBuffer = QualityLevel.HIGH; - } - - /** - * List of available ambient occlusion techniques. - * @deprecated use setAmbientOcclusionOptions instead - * @see #setAmbientOcclusion - */ - @Deprecated - public enum AmbientOcclusion { - NONE, - SSAO - } - - /** - * List of available post-processing anti-aliasing techniques. - * - * @see #setAntiAliasing - * @see #getAntiAliasing - */ - public enum AntiAliasing { - /** - * No anti aliasing performed as part of post-processing. - */ - NONE, - - /** - * FXAA is a low-quality but very efficient type of anti-aliasing. (default). - */ - FXAA - } - /** * List of available tone-mapping operators * @@ -753,100 +103,6 @@ public class View { ACES } - /** - * List of available post-processing dithering techniques. - */ - public enum Dithering { - NONE, - TEMPORAL - } - - /** - * List of available shadow mapping techniques. - * - * @see #setShadowType - */ - public enum ShadowType { - /** - * Percentage-closer filtered shadows (default). - */ - PCF, - - /** - * Variance shadows. - */ - VSM, - - /** - * Percentage-closer filtered shadows, with contact hardening simulation. - */ - DPCF, - - /** - * Percentage-closer soft shadows - */ - PCSS - } - - /** - * View-level options for VSM shadowing. - * - * Warning: This API is still experimental and subject to change. - * - * @see View#setVsmShadowOptions - */ - public static class VsmShadowOptions { - /** - * Sets the number of anisotropic samples to use when sampling a VSM shadow map. If greater - * than 0, mipmaps will automatically be generated each frame for all lights. - * This implies mipmapping below. - * - *

- * The number of anisotropic samples = 2 ^ vsmAnisotropy. - *

- * - */ - public int anisotropy = 0; - - /** - * Whether to generate mipmaps for all VSM shadow maps. - */ - public boolean mipmapping = false; - - /** - * VSM minimum variance scale, must be positive. - */ - public float minVarianceScale = 1.0f; - - /** - * VSM light bleeding reduction amount, between 0 and 1. - */ - public float lightBleedReduction = 0.2f; - } - - /** - * View-level options for DPCF and PCSS Shadowing. - * - * Warning: This API is still experimental and subject to change. - * - * @see View#setSoftShadowOptions - */ - public static class SoftShadowOptions { - /** - * Globally scales the penumbra of all DPCF and PCSS shadows - * Acceptable values are greater than 0 - */ - public float penumbraScale = 1.0f; - - /** - * Globally scales the computed penumbra ratio of all DPCF and PCSS shadows. - * This effectively controls the strength of contact hardening effect and is useful for - * artistic purposes. Higher values make the shadows become softer faster. - * Acceptable values are equal to or greater than 1. - */ - public float penumbraRatioScale = 1.0f; - } - /** * Used to select buffers. */ @@ -1876,5 +1132,749 @@ public class View { private static native boolean nIsScreenSpaceRefractionEnabled(long nativeView); private static native void nPick(long nativeView, int x, int y, Object handler, InternalOnPickCallback internalCallback); + /** + * List of available ambient occlusion techniques. + * @deprecated use setAmbientOcclusionOptions instead + * @see #setAmbientOcclusion + */ + @Deprecated + public enum AmbientOcclusion { + NONE, + SSAO + } + // The remainder of this file is generated by beamsplitter + + /** + * Generic quality level. + */ + public enum QualityLevel { + LOW, + MEDIUM, + HIGH, + ULTRA + } + + public enum BlendMode { + OPAQUE, + TRANSLUCENT + } + + /** + * Dynamic resolution can be used to either reach a desired target frame rate by lowering the + * resolution of a View, or to increase the quality when the rendering is faster + * than the target frame rate. + * + *

+ * This structure can be used to specify the minimum scale factor used when lowering the + * resolution of a View, and the maximum scale factor used when increasing the + * resolution for higher quality rendering. The scale factors can be controlled on each X and Y + * axis independently. By default, all scale factors are set to 1.0. + *

+ * + *

+ * Dynamic resolution is only supported on platforms where the time to render a frame can be + * measured accurately. Dynamic resolution is currently only supported on Android. + *

+ */ + public static class DynamicResolutionOptions { + /** + * Enables or disables dynamic resolution on a View. + */ + public boolean enabled = false; + + /** + * If false, the system scales the major axis first. + */ + public boolean homogeneousScaling = false; + + /** + * The minimum scale in X and Y this View should use. + */ + public float minScale = 0.5f; + + /** + * The maximum scale in X and Y this View should use. + */ + public float maxScale = 1.0f; + + /** + * Sharpness when QualityLevel.MEDIUM or higher is used [0, 1]. + * 0 is disabled, 1 is the sharpest setting. + * The default is set to 0.9 + */ + public float sharpness = 0.9f; + + /** + * Upscaling quality + * LOW: bilinear filtered blit. Fastest, poor quality + * MEDIUM: AMD FidelityFX FSR1 w/ mobile optimizations no RCAS sharpening pass + * HIGH: AMD FidelityFX FSR1 w/ mobile optimizations + RCAS + * ULTRA: AMD FidelityFX FSR1 + * FSR1 require a well anti-aliased (MSAA or TAA), noise free scene. + * + * The default upscaling quality is set to LOW. + */ + @NonNull + public QualityLevel quality = QualityLevel.LOW; + } + + /** + * Options for controlling the Bloom effect + * + * enabled: Enable or disable the bloom post-processing effect. Disabled by default. + * levels: Number of successive blurs to achieve the blur effect, the minimum is 3 and the + * maximum is 11. This value together with resolution influences the spread of the + * blur effect. This value can be silently reduced to accommodate the original + * image size. + * resolution: Resolution of bloom's vertical axis. The minimum value is 2^levels and the + * the maximum is lower of the original resolution and 2048. This parameter is + * silently clamped to the minimum and maximum. + * It is highly recommended that this value be smaller than the target resolution + * after dynamic resolution is applied (horizontally and vertically). + * strength: how much of the bloom is added to the original image. Between 0 and 1. + * blendMode: Whether the bloom effect is purely additive (false) or mixed with the original + * image (true). + * anamorphism: Bloom's aspect ratio (x/y), for artistic purposes. + * threshold: When enabled, a threshold at 1.0 is applied on the source image, this is + * useful for artistic reasons and is usually needed when a dirt texture is used. + * dirt: A dirt/scratch/smudges texture (that can be RGB), which gets added to the + * bloom effect. Smudges are visible where bloom occurs. Threshold must be + * enabled for the dirt effect to work properly. + * dirtStrength: Strength of the dirt texture. + * + * @see View#setBloomOptions + */ + public static class BloomOptions { + + public enum BlendingMode { + ADD, + INTERPOLATE + } + + /** + * User provided dirt texture + */ + @Nullable + public Texture dirt = null; + + /** + * strength of the dirt texture + */ + public float dirtStrength = 0.2f; + + /** + * Strength of the bloom effect, between 0.0 and 1.0 + */ + public float strength = 0.10f; + + /** + * Resolution of minor axis (2^levels to 2048) + */ + public int resolution = 360; + + /** + * Bloom x/y aspect-ratio (1/32 to 32) + */ + public float anamorphism = 1.0f; + + /** + * Number of blur levels (3 to 11) + */ + public int levels = 6; + + /** + * How the bloom effect is applied + */ + public BlendingMode blendMode = BlendingMode.ADD; + + /** + * Whether to threshold the source + */ + public boolean threshold = true; + + /** + * enable or disable bloom + */ + public boolean enabled = false; + + /** + * limit highlights to this value before bloom. Use +inf for no limiting. + * minimum value is 10.0. + */ + public float highlight = 1000.0f; + + + /** + * enable screen-space lens flare + */ + public boolean lensFlare = false; + + /** + * enable starburst effect on lens flare + */ + public boolean starburst = true; + + /** + * amount of chromatic aberration + */ + public float chromaticAberration = 0.005f; + + /** + * number of flare "ghosts" + */ + public int ghostCount = 4; + + /** + * spacing of the ghost in screen units [0, 1[ + */ + public float ghostSpacing = 0.6f; + + /** + * hdr threshold for the ghosts + */ + public float ghostThreshold = 10.0f; + + /** + * thickness of halo in vertical screen units, 0 to disable + */ + public float haloThickness = 0.1f; + + /** + * radius of halo in vertical screen units [0, 0.5] + */ + public float haloRadius = 0.4f; + + /** + * hdr threshold for the halo + */ + public float haloThreshold = 10.0f; + } + + /** + * Options to control fog in the scene + * + * @see View#setFogOptions + */ + public static class FogOptions { + /** + * distance in world units from the camera where the fog starts ( >= 0.0 ) + */ + public float distance = 0.0f; + + /** + * fog's maximum opacity between 0 and 1 + */ + public float maximumOpacity = 1.0f; + + /** + * fog's floor in world units + */ + public float height = 0.0f; + + /** + * how fast fog dissipates with altitude + */ + public float heightFalloff = 1.0f; + + /** + * Fog's color as a linear RGB color. + */ + @NonNull + @Size(min = 3) + public float[] color = { 0.5f, 0.5f, 0.5f }; + + /** + * fog's density at altitude given by 'height' + */ + public float density = 0.1f; + + /** + * distance in world units from the camera where in-scattering starts + */ + public float inScatteringStart = 0.0f; + + /** + * size of in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100) + */ + public float inScatteringSize = -1.0f; + + /** + * fog color will be modulated by the IBL color in the view direction + */ + public boolean fogColorFromIbl = false; + + /** + * enable or disable fog + */ + public boolean enabled = false; + } + + /** + * Options to control Depth of Field (DoF) effect in the scene + * + * @see View#setDepthOfFieldOptions + */ + public static class DepthOfFieldOptions { + + public enum Filter { + NONE, + UNUSED, + MEDIAN + } + + /** + * circle of confusion scale factor (amount of blur) + * + *

cocScale can be used to set the depth of field blur independently from the camera + * aperture, e.g. for artistic reasons. This can be achieved by setting:

+ * + * cocScale = cameraAperture / desiredDoFAperture + * + * + */ + public float cocScale = 1.0f; + + /** maximum aperture diameter in meters (zero to disable bokeh rotation) */ + public float maxApertureDiameter = 0.01f; + + /** enable or disable Depth of field effect */ + public boolean enabled = false; + + /** filter to use for filling gaps in the kernel */ + @NonNull + public Filter filter = Filter.MEDIAN; + + /** perform DoF processing at native resolution */ + public boolean nativeResolution = false; + + /** + *

Number of of rings used by the foreground kernel. The number of rings affects quality + * and performance. The actual number of sample per pixel is defined + * as (ringCount * 2 - 1)^2. Here are a few commonly used values:

+ * 3 rings : 25 ( 5x 5 grid) + * 4 rings : 49 ( 7x 7 grid) + * 5 rings : 81 ( 9x 9 grid) + * 17 rings : 1089 (33x33 grid) + * + *

With a maximum circle-of-confusion of 32, it is never necessary to use more than 17 rings.

+ * + *

Usually all three settings below are set to the same value, however, it is often + * acceptable to use a lower ring count for the "fast tiles", which improves performance. + * Fast tiles are regions of the screen where every pixels have a similar + * circle-of-confusion radius.

+ * + *

A value of 0 means default, which is 5 on desktop and 3 on mobile.

+ */ + public int foregroundRingCount = 0; + + /** + * Number of of rings used by the background kernel. The number of rings affects quality + * and performance. + * @see #foregroundRingCount + */ + public int backgroundRingCount = 0; + + /** + * Number of of rings used by the fast gather kernel. The number of rings affects quality + * and performance. + * @see #foregroundRingCount + */ + public int fastGatherRingCount = 0; + + /** + * maximum circle-of-confusion in pixels for the foreground, must be in [0, 32] range. + * A value of 0 means default, which is 32 on desktop and 24 on mobile. + */ + public int maxForegroundCOC = 0; + + /** + * maximum circle-of-confusion in pixels for the background, must be in [0, 32] range. + * A value of 0 means default, which is 32 on desktop and 24 on mobile. + */ + public int maxBackgroundCOC = 0; + }; + + /** + * Options to control the vignetting effect. + */ + public static class VignetteOptions { + /** + * High values restrict the vignette closer to the corners, between 0 and 1. + */ + public float midPoint = 0.5f; + + /** + * Controls the shape of the vignette, from a rounded rectangle (0.0), to an oval (0.5), + * to a circle (1.0). The value must be between 0 and 1. + */ + public float roundness = 0.5f; + + /** + * Softening amount of the vignette effect, between 0 and 1. + */ + public float feather = 0.5f; + + /** + * Color of the vignette effect as a linear RGBA color. The alpha channel is currently + * ignored. + */ + @NonNull + @Size(min = 4) + public float[] color = { 0.0f, 0.0f, 0.0f, 1.0f }; + + /** + * Enables or disables the vignette effect. + */ + public boolean enabled = false; + } + + /** + * Structure used to set the color precision for the rendering of a View. + * + *

+ * This structure offers separate quality settings for different parts of the rendering + * pipeline. + *

+ * + * @see #setRenderQuality + * @see #getRenderQuality + */ + public static class RenderQuality { + /** + *

+ * A quality of HIGH or ULTRA means using an RGB16F or RGBA16F color + * buffer. This means colors in the LDR range (0..1) have 10 bit precision. A quality of + * LOW or MEDIUM means using an R11G11B10F opaque color buffer or an + * RGBA16F transparent color buffer. With R11G11B10F colors in the LDR range have a precision of + * either 6 bits (red and green channels) or 5 bits (blue channel). + *

+ */ + public QualityLevel hdrColorBuffer = QualityLevel.HIGH; + } + + /** + * Options for screen space Ambient Occlusion + */ + public static class AmbientOcclusionOptions { + /** + * Ambient Occlusion radius in meters, between 0 and ~10. + */ + public float radius = 0.3f; + + /** + * Self-occlusion bias in meters. Use to avoid self-occlusion. Between 0 and a few mm. + */ + public float bias = 0.0005f; + + /** + * Controls ambient occlusion's contrast. Must be positive. Default is 1. + * Good values are between 0.5 and 3. + */ + public float power = 1.0f; + + /** + * How each dimension of the AO buffer is scaled. Must be either 0.5 or 1.0. + */ + public float resolution = 0.5f; + + /** + * Strength of the Ambient Occlusion effect. Must be positive. + */ + public float intensity = 1.0f; + + /** + * Depth distance that constitute an edge for filtering. Must be positive. + * Default is 5cm. + * This must be adjusted with the scene's scale and/or units. + * A value too low will result in high frequency noise, while a value too high will + * result in the loss of geometry edges. For AO, it is generally better to be too + * blurry than not enough. + */ + public float bilateralThreshold = 0.05f; + + /** + * The quality setting controls the number of samples used for evaluating Ambient + * occlusion. The default is QualityLevel.LOW which is sufficient for most mobile + * applications. + */ + @NonNull + public QualityLevel quality = QualityLevel.LOW; + + /** + * The lowPassFilter setting controls the quality of the low pass filter applied to + * AO estimation. The default is QualityLevel.MEDIUM which is sufficient for most mobile + * applications. QualityLevel.LOW disables the filter entirely. + */ + @NonNull + public QualityLevel lowPassFilter = QualityLevel.MEDIUM; + + /** + * The upsampling setting controls the quality of the ambient occlusion buffer upsampling. + * The default is QualityLevel.LOW and uses bilinear filtering, a value of + * QualityLevel.HIGH or more enables a better bilateral filter. + */ + @NonNull + public QualityLevel upsampling = QualityLevel.LOW; + + /** + * enable or disable screen space ambient occlusion + */ + public boolean enabled = false; + + /** + * enables bent normals computation from AO, and specular AO + */ + public boolean bentNormals = false; + + /** + * Minimal angle to consider in radian. This is used to reduce the creases that can + * appear due to insufficiently tessellated geometry. + * For e.g. a good values to try could be around 0.2. + */ + public float minHorizonAngleRad = 0.0f; + + + /** + * Full cone angle in radian, between 0 and pi/2. This affects the softness of the shadows, + * as well as how far they are cast. A smaller angle yields to sharper and shorter shadows. + * The default angle is about 60 degrees. + */ + public float ssctLightConeRad = 1.0f; + + /** + * Distance from where tracing starts. + * This affects how far shadows are cast. + */ + public float ssctShadowDistance = 0.01f; + + /** + * Maximum contact distance with the cone. Intersections between the traced cone and + * geometry samller than this distance are ignored. + */ + public float ssctContactDistanceMax = 1.0f; + + /** + * Intensity of the shadows. + */ + public float ssctIntensity = 0.8f; + + /** + * Light direction. + */ + @NonNull @Size(min = 3) + public float[] ssctLightDirection = { 0, -1, 0 }; + + /** + * Depth bias in world units (mitigate self shadowing) + */ + public float ssctDepthBias = 0.01f; + + /** + * Depth slope bias (mitigate self shadowing) + */ + public float ssctDepthSlopeBias = 0.01f; + + /** + * Tracing sample count, between 1 and 255. This affects the quality as well as the + * distance of the shadows. + */ + public int ssctSampleCount = 4; + + /** + * Numbers of rays to trace, between 1 and 255. This affects the noise of the shadows. + * Performance degrades quickly with this value. + */ + public int ssctRayCount = 1; + + /** + * Enables or disables SSCT. + */ + public boolean ssctEnabled = false; + } + + /** + * Options for Multi-sample Anti-aliasing (MSAA) + * @see View#setMultiSampleAntiAliasingOptions + */ + public static class MultiSampleAntiAliasingOptions { + /** enables or disables temporal anti-aliasing */ + public boolean enabled = false; + + /** + * number of samples to use for multi-sampled anti-aliasing.\n + * 0: treated as 1 + * 1: no anti-aliasing + * n: sample count. Effective sample could be different depending on the + * GPU capabilities. + */ + public int sampleCount = 4; + + /** + * custom resolve improves quality for HDR scenes, but may impact performance. + */ + public boolean customResolve = false; + }; + + /** + * Options for Temporal Anti-aliasing (TAA) + * @see View#setTemporalAntiAliasingOptions + */ + public static class TemporalAntiAliasingOptions { + /** reconstruction filter width typically between 0 (sharper, aliased) and 1 (smoother) */ + public float filterWidth = 1.0f; + + /** history feedback, between 0 (maximum temporal AA) and 1 (no temporal AA). */ + public float feedback = 0.04f; + + /** enables or disables temporal anti-aliasing */ + public boolean enabled = false; + }; + + /** + * Options for Screen-space Reflections. + * @see View#setScreenSpaceReflectionOptions + */ + public static class ScreenSpaceReflectionsOptions { + /** ray thickness, in world units */ + public float thickness = 0.1f; + + /** bias, in world units, to prevent self-intersections */ + public float bias = 0.01f; + + /** maximum distance, in world units, to raycast */ + public float maxDistance = 3.0f; + + /** stride, in texels, for samples along the ray. */ + public float stride = 2.0f; + + /** enables or disables screen-space reflections */ + public boolean enabled = false; + }; + + /** + * Options for the screen-space guard band. + * A guard band can be enabled to avoid some artifacts towards the edge of the screen when + * using screen-space effects such as SSAO. + * Enabling the guard band reduces performance slightly. + * Currently the guard band can only be enabled or disabled. + * + * @see View#setGuardBandOptions + */ + public static class GuardBandOptions { + /** enables or disables the guard band */ + public boolean enabled = false; + }; + + /** + * List of available post-processing anti-aliasing techniques. + * + * @see #setAntiAliasing + * @see #getAntiAliasing + */ + public enum AntiAliasing { + /** + * No anti aliasing performed as part of post-processing. + */ + NONE, + + /** + * FXAA is a low-quality but very efficient type of anti-aliasing. (default). + */ + FXAA + } + + /** + * List of available post-processing dithering techniques. + */ + public enum Dithering { + NONE, + TEMPORAL + } + + /** + * List of available shadow mapping techniques. + * + * @see #setShadowType + */ + public enum ShadowType { + /** + * Percentage-closer filtered shadows (default). + */ + PCF, + + /** + * Variance shadows. + */ + VSM, + + /** + * Percentage-closer filtered shadows, with contact hardening simulation. + */ + DPCF, + + /** + * Percentage-closer soft shadows + */ + PCSS + } + + /** + * View-level options for VSM shadowing. + * + * Warning: This API is still experimental and subject to change. + * + * @see View#setVsmShadowOptions + */ + public static class VsmShadowOptions { + /** + * Sets the number of anisotropic samples to use when sampling a VSM shadow map. If greater + * than 0, mipmaps will automatically be generated each frame for all lights. + * This implies mipmapping below. + * + *

+ * The number of anisotropic samples = 2 ^ vsmAnisotropy. + *

+ * + */ + public int anisotropy = 0; + + /** + * Whether to generate mipmaps for all VSM shadow maps. + */ + public boolean mipmapping = false; + + /** + * VSM minimum variance scale, must be positive. + */ + public float minVarianceScale = 1.0f; + + /** + * VSM light bleeding reduction amount, between 0 and 1. + */ + public float lightBleedReduction = 0.2f; + } + + /** + * View-level options for DPCF and PCSS Shadowing. + * + * Warning: This API is still experimental and subject to change. + * + * @see View#setSoftShadowOptions + */ + public static class SoftShadowOptions { + /** + * Globally scales the penumbra of all DPCF and PCSS shadows + * Acceptable values are greater than 0 + */ + public float penumbraScale = 1.0f; + + /** + * Globally scales the computed penumbra ratio of all DPCF and PCSS shadows. + * This effectively controls the strength of contact hardening effect and is useful for + * artistic purposes. Higher values make the shadows become softer faster. + * Acceptable values are equal to or greater than 1. + */ + public float penumbraRatioScale = 1.0f; + } }