Particle cloud?

The procedural trees in my wyrd forest playground are coming along nicely. It is time to do leaves. I see them elsewhere implemented as particle clouds with a persistent random seed or hash that keeps particles fixed. What is recommended to use for particle clouds in cge? I see there is a particle emitter component but that doesn’t seem like what I want? Does cge support particle cloud? Otherwise I can create a sphere with random leaf locations in it, but want it to be as fast and light as possible (so it can be a real forest).

The code from Geometry3D component | Castle Game Engine makes a great leaf cloud. It looks legit.

If you want to construct static 3D meshes, then indeed you can just build them using X3D nodes like TIndexedFaceSet, TIndexedTriangleSet, TTriangleSet and such. For a simplest quad, use TQuadSet. The examples from Geometry3D component | Castle Game Engine and Writing code to modify scenes and transformations | Manual | Castle Game Engine (" 11. Building a mesh using code") may be helpful.

As for particle clouds: I don’t think you really want to involve particle systems for this case. In any case, we have external components in CGE now to do particles: Additional Components | Castle Game Engine , see “Particle Emitter” and " Effekseer Integration" mentioned there.

It could be possible create leaves geometry using geometry shaders ( Programmable shaders component | Castle Game Engine ).

But for start, I’d say that 1st solution, simplest, is best. Just build meshes of leaves from X3D nodes like TIndexedFaceSet, TIndexedTriangleSet, TTriangleSet, TQuadSet.

That is what I ended up doing. Using just one face for the leaf… and then adding random faces in the leaf cloud. It looks really good and seems fast.

2 Likes