nstbayless / mini3d-plus

a kart game and engine for the playdate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Difference between shapes and imposters

a2 opened this issue · comments

I see that you're using a lib3d.imposter in the kart.lua example. Can you explain (or add some documentation around this) what exactly an imposter is and when I would want to use one?

An imposter is an object that is always rendered perpendicular to the camera, so in effect it's a 3D object that is always rendered as 2D.

In this repo it's the kart itself.

It is most usually used for the player character or HUD.

commented

@gingerbeardman's explanation is correct. The most famous example is probably doom's barrels:

barrel imposters from doom

Documentation should be added. There really isn't much in the way of documentation at all. I will endeavour to add some.

Okay this makes sense to me now. I ended up adding some imposters to my game and it works great. I wonder if it could be worth renaming "Imposter" to "Sprite" since they are essentially sprites that participate in the 3D scene?

Note: This is just how I, coming from an iOS world, think about it. On Apple platforms, the 3D framework manages "scenes" and the 2D version of the framework manages "sprites".

commented

@a2: Sprite is already used by the Playdate API.

I'm curious to see your game. If you are on discord, you can add me: NaOH#1432

@nstbayless Happy to discuss on Discord (not tonight since it's getting late in my time zone).

You are technically correct that Sprite is used by the Playdate API. That said, you'd still have to refer to that class as playdate.graphics.sprite or (gfx.sprite if you set up the gfx alias). That leaves lib3d.sprite available if you want, though I'm happy to brainstorm alternatives too :)

Are billboards the same thing?

We could also call them billboards!

I don't think it's bad to have two "entities" called "Sprite" if that's the best name for what it is? If you think about it, lib3d.point and playdate.geometry.point both exist and provide different functionality related to their own purposes. I guess I'd rather not call them "imposters", but naming is one of those hard problems.

commented

I am not really sure I understand what the problem with the name "Imposter" is. It's a fairly standard term as far as I've seen. All it needs is documentation I think.

re: points. I would like to remove lib3d.point if at all possible, or refactor it at least, because right now it's causing vastly too many mallocs for my liking.

@nstbayless Oh, I didn't realize it was a standard term. That is definitely something I could have checked before starting this conversation. Let me know if you want help with replacing lib3d.point!

commented

A billboard, as I understand it, is a type of imposter which does not pitch up and down to face the camera; it only adjusts yaw. But I could be wrong about that.

commented

I have not been working on the 3D engine much this past week. If you would like to take a stab at factoring out points, please be my guest. One option is to make functions take x,y,z args separately. Another option is a memory pool for points specifically.

An imposter is an object that is always rendered perpendicular to the camera, so in effect it's a 3D object that is always rendered as 2D.

Closing this as resolved.