aframe-surface-scatter

1.1.0 • Public • Published

AFrame-surface-scatter

Demo

Screenshot of a 3D rendered field of grass with flowers

Simple Example

<a-cylinder radius="0.02" height="0.04" color="red"></a-cylinder>
<a-sphere radius="0.5" position="0 1 -2" surface-scatter="object:#decoration;count:800;"><a-sphere>

You can use multiple surface-scatter components by appending __name to the component e.g.

<a-sphere radius="0.5" surface-scatter__flowers="object:#flowers;count:800;" surface-scatter__trees="object:#trees;count:20;"><a-sphere>

surface-scatter component

This component uses instancing to cover one object in another.

Property Type Description Default
object selector Object to place on the surface of this object
count number Amount of objects 128
weightAttribute string Specifies a vertex attribute to be used as a weight when sampling from the surface. Faces with higher weights are more likely to be sampled, and those with weights of zero will not be sampled at all. For vector attributes, only .x is used in sampling. If no weight attribute is selected, sampling is randomly distributed by area. ""
scale vec3 Amount to scale the objects by {}
rotation vec3 Amount to rotate the objects by {}
scaleJitter vec3 Add randomness to the scaling {}
rotationJitter vec3 Add randomness to the rotation {}
uniformJitter boolean Scale x,y,z together (true) or each independently (false) true

Readme

Keywords

none

Package Sidebar

Install

npm i aframe-surface-scatter

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

937 kB

Total Files

15

Last publish

Collaborators

  • adarosecannon