Back to Filament

View

docs/android/dokka/filament-android/com.google.android.filament/-view/index.md

1.75.027.3 KB
Original Source

//filament-android/com.google.android.filament/View

View

open class View

Encompasses all the state needed for rendering a Scene.

render operates on View objects. These View objects specify important parameters such as:

  • The Scene
  • The Camera
  • The Viewport
  • Some rendering parameters

View instances are heavy objects that internally cache a lot of data needed for rendering. It is not advised for an application to use many View objects.

For example, in a game, a View could be used for the main scene and another one for the game's user interface. More View instances could be used for creating special effects (e.g. a View is akin to a rendering pass).

See also

Renderer
Scene
Camera
RenderTarget

Types

NameSummary
AmbientOcclusion[main]
enum AmbientOcclusion
List of available ambient occlusion techniques.
AmbientOcclusionOptions[main]
open class AmbientOcclusionOptions
Options for screen space Ambient Occlusion (SSAO) and Screen Space Cone Tracing (SSCT)
AntiAliasing[main]
enum AntiAliasing
List of available post-processing anti-aliasing techniques.
BlendMode[main]
enum BlendMode
BloomOptions[main]
open class BloomOptions
Options to control 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 12. 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 minor axis. The minimum value is 2^levels and the the maximum is lower of the original resolution and 4096. 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). - 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. | | DepthOfFieldOptions | [main] open class DepthOfFieldOptions Options to control Depth of Field (DoF) effect in the scene. | | Dithering | [main] enum Dithering List of available post-processing dithering techniques. | | DynamicResolutionOptions | [main] open class DynamicResolutionOptions 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. | | FogOptions | [main] open class FogOptions Options to control large-scale fog in the scene. | | GuardBandOptions | [main] open class GuardBandOptions Options for the screen-space guard band. | | MultiSampleAntiAliasingOptions | [main] open class MultiSampleAntiAliasingOptions Options for Multi-Sample Anti-aliasing (MSAA) | | OnPickCallback | [main] interface OnPickCallback An interface to implement a custom class to receive results of picking queries. | | PickingQueryResult | [main] open class PickingQueryResult A class containing the result of a picking query | | QualityLevel | [main] enum QualityLevel Generic quality level. | | RenderQuality | [main] open class RenderQuality Structure used to set the precision of the color buffer and related quality settings. | | ScreenSpaceReflectionsOptions | [main] open class ScreenSpaceReflectionsOptions Options for Screen-space Reflections. | | ShadowType | [main] enum ShadowType List of available shadow mapping techniques. | | SoftShadowOptions | [main] open class SoftShadowOptions View-level options for PCSS Shadowing. | | StereoscopicOptions | [main] open class StereoscopicOptions Options for stereoscopic (multi-eye) rendering. | | TargetBufferFlags | [main] enum TargetBufferFlags Used to select buffers. | | TemporalAntiAliasingOptions | [main] open class TemporalAntiAliasingOptions Options for Temporal Anti-aliasing (TAA) Most TAA parameters are extremely costly to change, as they will trigger the TAA post-process shaders to be recompiled. | | ToneMapping | [main] enum ToneMapping List of available tone-mapping operators | | VignetteOptions | [main] open class VignetteOptions Options to control the vignetting effect. | | VsmShadowOptions | [main] open class VsmShadowOptions View-level options for VSM Shadowing. |

Functions

NameSummary
clearFrameHistory[main]
open fun clearFrameHistory(engine: Engine)
When certain temporal features are used (e.g.: TAA or Screen-space reflections), the view keeps a history of previous frame renders associated with the Renderer the view was last used with.
getAmbientOcclusion[main]
open fun getAmbientOcclusion(): View.AmbientOcclusion
Queries the type of ambient occlusion active for this View.
getAmbientOcclusionOptions[main]
open fun getAmbientOcclusionOptions(): View.AmbientOcclusionOptions
Gets the ambient occlusion options.
getAntiAliasing[main]
open fun getAntiAliasing(): View.AntiAliasing
Queries whether anti-aliasing is enabled during the post-processing stage.
getBlendMode[main]
open fun getBlendMode(): View.BlendMode
getBloomOptions[main]
open fun getBloomOptions(): View.BloomOptions
Gets the bloom options
getCamera[main]
open fun getCamera(): Camera
Gets this View's associated Camera, or null if none has been assigned.
getColorGrading[main]
open fun getColorGrading(): ColorGrading
Returns the ColorGrading associated to this view.
getDepthOfFieldOptions[main]
open fun getDepthOfFieldOptions(): View.DepthOfFieldOptions
Gets the Depth of Field options
getDithering[main]
open fun getDithering(): View.Dithering
Queries whether dithering is enabled during the post-processing stage.
getDynamicResolutionOptions[main]
open fun getDynamicResolutionOptions(): View.DynamicResolutionOptions
Returns the dynamic resolution options associated with this view.
getEffectiveGridSize[main]
open fun getEffectiveGridSize(): Double
Returns the effective grid size used for grid-based world origin snapping.
getFogEntity[main]
open fun getFogEntity(): Int
Get an Entity representing the large scale fog object.
getFogOptions[main]
open fun getFogOptions(): View.FogOptions
Gets the fog options
getGridSize[main]
open fun getGridSize(): Double
Returns the grid size used for grid-based world origin snapping.
getGuardBandOptions[main]
open fun getGuardBandOptions(): View.GuardBandOptions
Returns screen-space guard band options.
getLastDynamicResolutionScale[main]
open fun getLastDynamicResolutionScale(out: Array<Float>): Array<Float>
Returns the last dynamic resolution scale factor used by this view.
getMaterialGlobal[main]
open fun getMaterialGlobal(index: Int, out: Array<Float>): Array<Float>
Get the value of the material global variables.
getMultiSampleAntiAliasingOptions[main]
open fun getMultiSampleAntiAliasingOptions(): View.MultiSampleAntiAliasingOptions
Returns multi-sample anti-aliasing options.
getName[main]
open fun getName(): String
Returns the View's name.
getNativeObject[main]
open fun getNativeObject(): Long
getRenderQuality[main]
open fun getRenderQuality(): View.RenderQuality
Returns the render quality used by this view.
getRenderTarget[main]
open fun getRenderTarget(): RenderTarget
Gets the offscreen render target associated with this view.
getSampleCount[main]
open fun getSampleCount(): Int
Returns the effective MSAA sample count.
getScene[main]
open fun getScene(): Scene
Gets this View's associated Scene, or null if none has been assigned.
getScreenSpaceReflectionsOptions[main]
open fun getScreenSpaceReflectionsOptions(): View.ScreenSpaceReflectionsOptions
Returns screen-space reflections options.
getSoftShadowOptions[main]
open fun getSoftShadowOptions(): View.SoftShadowOptions
Gets soft shadowing options associated with this View.
getStereoscopicOptions[main]
open fun getStereoscopicOptions(): View.StereoscopicOptions
Gets the stereoscopic options.
getTemporalAntiAliasingOptions[main]
open fun getTemporalAntiAliasingOptions(): View.TemporalAntiAliasingOptions
Returns temporal anti-aliasing options.
getToneMapping[main]
open fun getToneMapping(): View.ToneMapping
Returns the tone-mapping function.
getViewport[main]
open fun getViewport(): Viewport
Returns the rectangular rendering area.
getVignetteOptions[main]
open fun getVignetteOptions(): View.VignetteOptions
Gets the vignette options
getVisibleLayers[main]
open fun getVisibleLayers(): Int
Returns the visible layers.
getVisibleRenderableCount[main]
open fun getVisibleRenderableCount(): Int
Returns the most recent number of visible renderables for the current Scene as calculated the last time Renderer::render() was called with this View and Scene.
getVsmShadowOptions[main]
open fun getVsmShadowOptions(): View.VsmShadowOptions
Gets the VSM shadowing options.
hasCamera[main]
open fun hasCamera(): Boolean
Query whether a camera is set.
isFrontFaceWindingInverted[main]
open fun isFrontFaceWindingInverted(): Boolean
Returns true if post-processing is enabled.
isFrustumCullingEnabled[main]
open fun isFrustumCullingEnabled(): Boolean
isPostProcessingEnabled[main]
open fun isPostProcessingEnabled(): Boolean
Returns true if post-processing is enabled.
isStencilBufferEnabled[main]
open fun isStencilBufferEnabled(): Boolean
isTransparentPickingEnabled[main]
open fun isTransparentPickingEnabled(): Boolean
Returns true if transparent picking is enabled.
pick[main]
open fun pick(x: Int, y: Int, handler: Any, callback: View.OnPickCallback)
Creates a picking query.
setAmbientOcclusion[main]
open fun setAmbientOcclusion(ao: View.AmbientOcclusion)
Activates or deactivates ambient occlusion.
setAmbientOcclusionOptions[main]
open fun setAmbientOcclusionOptions(options: View.AmbientOcclusionOptions)
Sets ambient occlusion options.
setAntiAliasing[main]
open fun setAntiAliasing(type: View.AntiAliasing)
Enables or disables anti-aliasing in the post-processing stage.
setBlendMode[main]
open fun setBlendMode(blendMode: View.BlendMode)
Sets the blending mode used to draw the view into the SwapChain.
setBloomOptions[main]
open fun setBloomOptions(options: View.BloomOptions)
Sets bloom options.
setCamera[main]
open fun setCamera(camera: Camera)
Sets this View's Camera.
setColorGrading[main]
open fun setColorGrading(colorGrading: ColorGrading)
Sets this View's color grading transforms.
setDepthOfFieldOptions[main]
open fun setDepthOfFieldOptions(options: View.DepthOfFieldOptions)
Sets Depth of Field options.
setDithering[main]
open fun setDithering(dithering: View.Dithering)
Enables or disables dithering in the post-processing stage.
setDynamicLightingOptions[main]
open fun setDynamicLightingOptions(zLightNear: Float, zLightFar: Float)
Sets options relative to dynamic lighting for this view.
setDynamicResolutionOptions[main]
open fun setDynamicResolutionOptions(options: View.DynamicResolutionOptions)
Sets the dynamic resolution options for this view.
setFogOptions[main]
open fun setFogOptions(options: View.FogOptions)
Sets fog options.
setFrontFaceWindingInverted[main]
open fun setFrontFaceWindingInverted(inverted: Boolean)
Inverts the winding order of front faces.
setFrustumCullingEnabled[main]
open fun setFrustumCullingEnabled(enabled: Boolean)
Enables or disables frustum culling.
setGridSize[main]
open fun setGridSize(size: Double)
Sets the grid size for grid-based world origin snapping.
setGuardBandOptions[main]
open fun setGuardBandOptions(options: View.GuardBandOptions)
Enables or disable screen-space guard band.
setLayerEnabled[main]
open fun setLayerEnabled(layer: Int, enabled: Boolean)
Enables or disables a specific layer.
setMaterialGlobal[main]
open fun setMaterialGlobal(index: Int, value: Array<Float>)
Set the value of material global variables.
setMultiSampleAntiAliasingOptions[main]
open fun setMultiSampleAntiAliasingOptions(options: View.MultiSampleAntiAliasingOptions)
Enables or disable multi-sample anti-aliasing (MSAA).
setName[main]
open fun setName(name: String)
Sets the View's name.
setPostProcessingEnabled[main]
open fun setPostProcessingEnabled(enabled: Boolean)
Enables or disables post processing.
setRenderQuality[main]
open fun setRenderQuality(renderQuality: View.RenderQuality)
Sets the rendering quality for this view (e.g.
setRenderTarget[main]
open fun setRenderTarget(target: RenderTarget)
Specifies an offscreen render target to render into.
setSampleCount[main]
open fun setSampleCount(count: Int)
Sets how many samples are to be used for MSAA in the post-process stage.
setScene[main]
open fun setScene(scene: Scene)
Sets this View instance's Scene.
setScreenSpaceReflectionsOptions[main]
open fun setScreenSpaceReflectionsOptions(options: View.ScreenSpaceReflectionsOptions)
Enables or disable screen-space reflections.
setScreenSpaceRefractionEnabled[main]
open fun setScreenSpaceRefractionEnabled(enabled: Boolean)
Enables or disables screen space refraction.
setShadowingEnabled[main]
open fun setShadowingEnabled(enabled: Boolean)
Enables or disables shadow mapping.
setShadowType[main]
open fun setShadowType(type: View.ShadowType)
Sets the shadow mapping technique this View uses.
setSoftShadowOptions[main]
open fun setSoftShadowOptions(options: View.SoftShadowOptions)
Sets soft shadowing options that apply across the entire View.
setStencilBufferEnabled[main]
open fun setStencilBufferEnabled(enabled: Boolean)
Enables use of the stencil buffer.
setStereoscopicOptions[main]
open fun setStereoscopicOptions(options: View.StereoscopicOptions)
Sets the stereoscopic rendering options for this view.
setTemporalAntiAliasingOptions[main]
open fun setTemporalAntiAliasingOptions(options: View.TemporalAntiAliasingOptions)
Enables or disable temporal anti-aliasing (TAA).
setToneMapping[main]
open fun setToneMapping(type: View.ToneMapping)
Enables or disables tone-mapping in the post-processing stage.
setTransparentPickingEnabled[main]
open fun setTransparentPickingEnabled(enabled: Boolean)
Enables or disables transparent picking.
setViewport[main]
open fun setViewport(viewport: Viewport)
Specifies the rectangular rendering area.
setVignetteOptions[main]
open fun setVignetteOptions(options: View.VignetteOptions)
Sets vignette options.
setVisibleLayers[main]
open fun setVisibleLayers(select: Int, values: Int)
Sets which layers are visible.
setVsmShadowOptions[main]
open fun setVsmShadowOptions(options: View.VsmShadowOptions)
Sets VSM shadowing options that apply across the entire View.