2D objects in 3D space

Hi there,

I have written a program where my terrain is a rigid body body control (don’t know if that is relevant) , but what I’m trying to do is place some trees in that terrain.

I don’t think I want a lot of meshes of trees which would slow things down, so I’m wondering how I can position 2D images of trees in 3D locations on my terrain ? Presumably they would need to be rotated so they are “square on” to the player’s line of sight, otherwise they would be invisible.

I have searched the help and the beginner tutorials but can’t find anything relevant.

Can someone point me in the right direction ?

Thank you.

Well, if you don’t want them to all be separate meshes (tons of quads) then your only option is to write a custom shader that would do billboarding in the shader. Not the kind of thing you’ll find ready tutorials for, I guess.

I do similar in the IsoSurfaceDemo but I also have LOD, paging, and a bunch of other things going on there. The source is available if you get desperate, though.

Edit: actually I just remember my version is also complicated by the fact that I take four different views of the trees and change between them depending on view angle. But they are still billboarded and the atlas indexing part could probably be ignored.

Hi pspeed,

Thank you, is a demo of your program available anywhere ?

Yeah, source and demo are available…

Here is a video:

It’s using the trees from SimAboreal (also open source) and here is a video of the impostors test:

The far trees are just billboarded quads.

Very impressive, thanks. I doubt if mine will be that sophisticated, but I’m sure I’ll get a few ideas

Oh… it occurs to me that the grass is doing exactly what you want. Lots of batched shapes (triangles in this case) rotating to face the camera.

I like how in the Impostors WIP video, the camera’s point of focus is clearly the ladies boobs =)

You need to fix your avatar pic… I read this comment and thought “That sounds like something thetoucher would say…” then went “oh.” :smile:

“ladies” wasn’t quite that typical though :stuck_out_tongue: