Posted 26 March 2012 - 05:59 PM
I have a question regarding nVIDIA Cg shader language (or I guess any shader language for that matter, but I am using Cg.) Is it possible to create a cubemap for point light shadows in the vertex/pixel shader itself assuming you have the position of a given light, or must the cube map be generated outside your shader and passed in? I ask because I have all the necessary data available in my shaders however to get the data in my C++ code would result in me going through with some potentially pointless work.
I want to see if there is a way to construct the cube map per light in the shader and just do my calculations from there, essentially putting all my cube map code into the shader.
Posted 26 March 2012 - 08:13 PM
Then, you'd bind your main render target and draw your scene again using a pixel shader that samples the cubemap to determined how much the pixel is shadowed and incorporate that into the usual lighting/shading calculations.
So you can render the cube map on the GPU, but you do have to do some extra work on the CPU to set everything up. The cubemap cannot be generated and used entirely by shaders without any CPU involvement at all.
Posted 26 March 2012 - 10:04 PM
Posted 26 March 2012 - 10:19 PM
Posted 27 March 2012 - 12:49 PM
That answers my question!
Do the cube maps have to be generated from the point of view of a given light, whether done on CPU or GPU, or can a generic cube map be made and then applied and transformed to work for a light at any position?
Posted 27 March 2012 - 09:01 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users