I want to create a grassy field in defold but I am not sure how to go about doing so since defold does not have a foilage/terrain system. Any help would be appreciate.
I haven’t tried adding foliage toa 3D scene with Defold but I would recommend first finding a simple/low-poly grass model, creating a grass game object and adding a model component using the grass model. Then, create a ground with collision. After that, you can use factories to create multiple instances of the grass. While doing so, if your ground is not a flat surface, you can spawn them up in the sky, use raycasting towards ground and place the model wherever ray hits.
While using multiple instances of the same model, Defold enables instancing so it is kind of already optimized but you can check out this link to learn more about it: Defold materials manual
We are also planning to implement an “instance component” that can be used for things like foliage and grass on top of terrain systems, but I can’t say when it will arrive. For now only models utilize instancing
Instancing seems like the way to go. The thing is that I need the foliage to look similar to how it does in blender because there is a path in the field. It is nothing to complex just a a ground plane with grass and a path. The raycasting method is an idea that would’ve never occurred to me. Thanks.
Thanks for the reply. That would be lovely. How different is this going to be from the way Instancing works currently in Defold?
My plan is to extract the instance position data from blender into a buffer and then render the grass model in defold. I am sure how exactly to go about this.
Can you show us how it looks like in Blender? And how huge of a concept you have in mind?
I think you can use a collision shape and 5 box collision shape to replicate the grass covered area. Will try make a simple example project if I can find time for it ![]()
Also, here is the first step for Defold terrain editor that is being developed by @jhonny.goransson
Jhonny Göransson on X: "Experimenting with a terrain extension for @defold, not there on the visuals yet but it's fun to fiddle with :) #gamedev #madewithdefold" / X
Thanks for the suggestion. I will try it out and also try and see what else I can do.
Managed to create an example project:
that spawns grass on a designed are with kinematic collisions (trigger collisions seems to be ignored by raycast) and also applies a small randomness and respects to terrain shape and height.
GrassSpawn.zip (141.6 KB)
Let me know if there are any parts that are not clear
(around 2K grass is created so not sure how performant that would be)
Thanks.
Thanks a lot.
I forgot to tag you.
