Unwrap 2D texture to polar coordinates

by Garan   Last Updated April 16, 2018 11:13 AM

I'm trying to create a lighting engine for a 2D game. What I'm planning to do is something similar to this tutorial, specifically the concept of unwrapping the Cartesian coordinates to a 2D polar coordinate texture.

One of the big differences, however, is that he first creates a 1D texture of the distances the raycast travels, and then uses that information to draw the view mask. What I'd like to do is completely transform the occlusion mask into a 2D texture based on the polar coordinates and then do some other calculations.

How can I do that using OpenGL? Which kind of shader would that be?

(The full pipeline of the lighting: draw shadow mask onto texture -> unwrap that texture into polar map centered at light source -> color in that light mask based on the information in it -> re-wrap it into a Cartesian coordinate mask -> combine that information with the sprites being draw)

Tags : opengl 2d lighting


Related Questions


Incorrect Normal Matrix

Updated April 19, 2015 20:05 PM

GL_SPOT_CUTOFF not working properly

Updated April 22, 2015 04:05 AM

Handling light bounding volume

Updated May 29, 2016 08:05 AM


How to generate a multiplier map for radiosity

Updated August 27, 2016 08:05 AM