image that always faces the camera

I’m playing with an idea to do a simple 3d space game. I want to render each star (that you can select) as an image that always faces the camera. It will get smaller if you back away from it, but you’ll never see it “on-edge”. I’ve searched the manual and haven’t found how to do this. Any ideas?

Certainly. It’s called a billboard.

I wanted to do something similar yesterday, and this is the code I use:

node = render.attachNewNode(CardMaker('spark').generate())
tex = loader.loadTexture("data/spark.png")
node.setTexture( tex )
node.reparentTo( render )
node.setPos( 0,0,2 ) # Where you want it
node.setLightOff() # Light does not affect it
node.setTransparency(True) # My image has some alpha transparency in it
node.setBillboardPointEye() # This is where the magic happends. :P

Thanks for your help. I’ll give it a shot.

Do 2d images broadcast onto a “card” and presented billboard fashion use more resources than just using an non-flat object?

In other words does an animated sprite of of spinning globe use more resources than a 3d model of a globe that is actually spinning?

JB SKaggs

depends. if your sprite is 1024x1024 pixel image with an animation of 60 different images. a spinning globe might be less of a recource problem. but in most cases a animated sprite is faster (to render), although it might eat a bit more texture-memory

sorry for hijacking the thread or whatever, but what does this part do:


It creates a square and names it “spark”. :slight_smile: