Hi
I want to start writing forward rendering pipeline for my deferred engine and I'm looking for efficient way to pass light information to shader.
I have an idea about it.I don't want to pass light info as constant or array so I'm thinking about sending them as textures.
for point lights I need:
struct PointLight
{
COLOR LightColor;
Vector3 LightPosition;
float LightRadius;
}
It seems I can store this structure in 2 pixel of a texture:
RGB=LightColor;
alpha=LightRadius;
RGB=xyz of light position
struct SpotLight
{
COLOR LightColor;
Vector3 LightPosition;
float LightRadius;
float CosAngel;
}
RGB=LightColor;
alpha=LightRadius;
RGB=xyz of light position
alpha=CosAngel;
so with a texture 128*2 I can pass 128 point light to the shader.
But what is the best way to fill this texture?Should I make a vertex buffer with light info and pass it to a shader to writing in texture or use LockRect and fill the texture on CPU?
also I can pack all light info in one texture and use another texture to pass ligh Ids to shader






