object placement textures

I’m trying to make a game with one area that has a big grassy field and another with a bunch of trees. It would be an absolute pain to place every grass and tree object onto the terrain one by one, so could I use a white and black texture to tell blender to place a grass object on the terrain mesh wherever there is white, with x space between each grass object? I know this might require some python, but i’m hoping blender already has something similar to this built-in.

A similar question:
If i used a script on each grass object to toggle visibilty after the player is a certain distance from the grass, would that improve performance, or just slow it down even more by trying to process all that for each individual grass object?

  • Will

you could do this in textures where you could have a grass texture and a… earth or so texture.
while im not sure thi is what you want, mb i could help

good idea with the texture, but i think this is not available. The BGE does a bit hard on accessing texture information (maybe I’m wrong with that).

But to go on with your idea, it is possible to access the material id of a face. So a sort of LOD script dynamically could place a grass object at the location of a vertex if it belongs to a specific material.

Beside that I can remember a thread from ideasman42 where he created a lot of tree objects… can’t find it right now.

That’s the jist of it, but i’m not actually trying to apply the texture thing in real-time. Just a one-time thing, like what you would do with a heightmap or something. But thanks anyway. If you know of any similar ways of doing this, please tell me.

  • Will

Here’s what I do, I’d use vertex groups to do it. I know the way you wanted is cooler, but I believe it would work if the the info was vertex painted (I’m most likely saying none sense). But if you manually chose the faces where the grass texture is, and name that group grass, you could apply a particle modifier, set the particles to hair and set the display to object, then select the grass object, and the grass selection group. Then go to the modifier and apply it. That will generate instances of the grass or trees.
The search for ideasman’s ‘big level’ setup and use the script set, then you may delete all instances, but not before you are sure it works…

I wish there was a way to do what you want but with texture and objects. Stencil panting is quite limited…


Finaly found it, another way to do similar things , but this has nothing to do with textures , you would have to place them hand by hand. its a nice tutorial and this method is kinda fun to do.

greets Equal

Hmm… I think this is where the idea comes from, but, since he didn’t want to place them by hand I didn’t mention the particle editing part…

Wow, thanks! I’ll try both of those methods!

  • Will