mattrdowney / planetaria

A Unity framework for Euclidean 2-sphere games (e.g. 2D virtual reality games) [quasi-MIT license]
Other
10 stars 2 forks source link

PlanetariaCucoloris or PlanetariaFog #38

Open mattrdowney opened 6 years ago

mattrdowney commented 6 years ago

Point light + "cookies"

mattrdowney commented 6 years ago

Notably, a good way to represent all surface tiles is using two circular textures (#44).

Writing to the texture at runtime (i.e. keeping the asset synchronized between GPU and CPU) is the hard part.

mattrdowney commented 6 years ago

PlanetariaCucoloris and PlanetariaFog cannot use the same data representation.

While Unity's cucoloris (Cookie) is 2D, and Planetaria cucoloris must be 1D (representing a circular segment). In a sense, I have already implemented PlanetariaFog (as it was originally intended) -- see WorldPlanetarium (I would need to augment it so it has the ability to write to arbitrary single pixels).

PlanetariaCucoloris might (for early technology) benefit from a lookup table of ratios.

Essentially, each pixel in the 1D segment represents a band of 2PI/pixels degrees. Thus, if you have 360 pixels, each pixel represents a degree of the image. Assume the middle pixel(s) represent the "north" or "up" direction (useful for SectorLight/"SpotLight"). The lookup table is useful so you can do a binary search to find the pixel that should be used for a given ratio y/x, rather than computing atan2(y,x), although this seems like a evil micro-optimization that way down the line would never be useful.

Notably, for SectorLight the PlanetariaCucoloris does not represent 360 degrees, but instead the angle of the circular sector it represents.

ArcLight could have a concept of PlanetariaCucoloris, but it would be very difficult to implement.

WorldLight cannot have a concept of PlanetariaCucoloris, which supports the idea of removing WorldLight outright (and users can always use Unity's built-in point light if they want to).