Heat map visualization shader help please
I don't have a lot of shader programming experience, so I'm trying to do something that will expand my horizons.
Suppose you had a list of events at various world positions, with an influence radius, and suppose you had a 3d model of an environment. I'm trying to figure out how to best take this world event data and render it in 3d in a form that illustrates the usual heat map functionality, such as a radial falloff of influence around the events, and an accumulation of stacked influences for overlapping events, that ultimately result in a cool to warm color mapping based on the weight range.
I'm not sure if I'm totally trying the wrong stuff, but my current attempt at getting something working is by passing an array of event world positions into the shader that I render the world with and then I'm trying to figure out in my shader how to calculate the accurate world position of the fragment, so that I can basically calculate the accumulation of event 'weights' that should effect that particular pixel from all the events. I'm thinking I would need to write those accumulated results into a floating point FBO buffer and then render the scene again and mapping the accumulated values in that buffer to the cold to hot color gradiant that I want to see it as.
Anyways, I'm spinning my wheels at this first step. I don't really know how to calculate the world position of a fragment with which to use with the world position of the events passed in through a uniform array. I'm trying a dead simple test setup in order to see this working, by having an event in the middle of my map, and the color should blend from green to red for pixels within 500.0 world distance from the event, which should result in me seeing a color gradient 500 world units around my event position.
Anyone know how to calculate the world position of a fragment in the shader? My mesh doesn't have UVs, as it is a simple colorized debugging model of the navigation mesh of a game level.
Any help appreciated, both on my current attempt and if there is a better or alternative way to do this.