<GSplat/>
<GSplat> コンポーネントは Gaussian Splats をレンダリングするために使用します。Gaussian Splats は高品質な 3D コンテンツをキャプチャしてレンダリングする新しい手法です。シーンの形状とライティングを非常に高品質な結果で捉えます。
useSplat フックは ply や sog ファイル、またはエンジンがロードできるその他のファイルを受け付けます。
使い方
useSplat フックで Gaussian Splat Asset をロードし、<GSplat> コンポーネントでレンダリングできます。
const { asset } = useSplat('/assets/toy-cat.sog');
<GSplat asset={asset} />
- Demo
- Code
gsplat-example.jsx
import { Entity } from '@playcanvas/react';
import { GSplat, Camera } from '@playcanvas/react/components';
import { useSplat } from '@playcanvas/react/hooks';
export const GSplatExample = () => {
// Load the Gaussian Splat asset
const { asset } = useSplat('/assets/toy-cat.sog');
// If the asset is not loaded, return null
if (!asset) return null;
// Return the GSplat component
return (
<Entity rotation={[180, 180, 0]} position={[0, -0.7, 0]} >
<GSplat asset={asset} />
</Entity>
);
};
PlayCanvas ドキュメントの GSplat Component で詳細を確認できます。
プロパティ
| Name | Type | Default |
|---|---|---|
customAabb? | BoundingBox | nullSets a custom object space bounding box for visibility culling of the attached gsplat.
Gets the custom object space bounding box for visibility culling of the attached gsplat.
Returns the custom AABB if set, otherwise falls back to the resource's AABB. | - |
material? | - | |
highQualitySH? | boolean | - |
castShadows? | booleanSets whether gsplat will cast shadows for lights that have shadow casting enabled. Defaults
to false.
Gets whether gsplat will cast shadows for lights that have shadow casting enabled. | - |
lodBaseDistance? | numberSets the base distance for the first LOD transition (LOD 0 to LOD 1). Objects closer
than this distance use the highest quality LOD. Each subsequent LOD level transitions
at a progressively larger distance, controlled by lodMultiplier. Clamped to a
minimum of 0.1. Defaults to 5.
Gets the base distance for the first LOD transition. | - |
lodMultiplier? | numberSets the multiplier between successive LOD distance thresholds. Each LOD level
transitions at this factor times the previous level's distance, creating a geometric
progression. Lower values keep higher quality at distance; higher values switch to
coarser LODs sooner. Clamped to a minimum of 1.2 to avoid degenerate logarithmic LOD
computation. LOD distances are automatically compensated for the camera's field of
view — a wider FOV makes objects appear smaller on screen, so LOD switches to coarser
levels sooner to match the reduced screen-space detail. Defaults to 3.
Gets the geometric multiplier between successive LOD distance thresholds. | - |
workBufferUpdate? | numberSets the work buffer update mode.
Splat data is rendered to a work buffer only when needed (e.g., when transforms change).
Can be:
- WORKBUFFER_UPDATE_AUTO: Update only when needed (default).
- WORKBUFFER_UPDATE_ONCE: Force update this frame, then switch to AUTO.
- WORKBUFFER_UPDATE_ALWAYS: Update every frame.
This is typically useful when using custom shader code via setWorkBufferModifier
that depends on external factors like time or animated uniforms.
Note: WORKBUFFER_UPDATE_ALWAYS has a performance impact as it re-renders
all splat data to the work buffer every frame. Where possible, consider using shader
customization on the gsplat material (`app.scene.gsplat.material`) which is applied
during final rendering without re-rendering the work buffer.
Gets the work buffer update mode. | - |
layers? | number[]Sets an array of layer IDs (Layer#id ) to which this gsplat should belong. Don't
push, pop, splice or modify this array. If you want to change it, set a new one instead.
Gets the array of layer IDs (Layer#id ) to which this gsplat belongs. | - |
asset? | number | AssetSets the gsplat asset for this gsplat component. Can also be an asset id.
Gets the gsplat asset id for this gsplat component. | - |
resource? | GSplatResourceBase | nullSets a GSplat resource directly (for procedural/container splats).
When set, this takes precedence over the asset property.
Gets the GSplat resource. Returns the directly set resource if available,
otherwise returns the resource from the assigned asset. | - |
system? | ComponentSystemThe ComponentSystem used to create this Component. | - |
entity? | EntityThe Entity that this Component is attached to. | - |
enabled? | booleanSets the enabled state of the component.
Gets the enabled state of the component. | - |