• Create Account

### #ActualKoder4Fun

Posted 19 August 2012 - 03:41 AM

After some hours of search and some implementations that doesn't work I hope on help of people that know more about this topic.

I need this on a iterative radiosity renderer, using gathering method, writed in C# using GPU (with XNA), to speed up the rendering.

For each polygon I have a lightmap and a list of lightmaps visible from it. That's work ok.
The idea is that when all lightmaps in "visible list" have an average energy less than a thresold I can skip the light gathering for the entire polygon's lightmap.

In a first time I've considered only the average energy, but I find that accounting for distance (or better the square of the distance, that is the physical decay of light) i can rescale the average energy and check against the threshold to do a better filtering:
public void GatherEnergy(float accuracy, ref Hemicube h, ref SceneRenderer scene)
{
bool skip = true;
for (int i = 0; i < VisibleLightMaps.Length; ++i)
{
if ((VisibleLightMaps[i].lightmap.AverageEnergy / VisibleLightMaps[i].distSquared) > energyThreshold)
{
skip = false;
break;
}
}
if (skip)
return;
if (ForDetailMesh)
GatherEnergyForDetailMesh(accuracy, ref h, ref scene);
else
GatherEnergyForPoly(accuracy, ref h, ref scene);

CalculateMaxAndAverageEnergy();
}


NOTE: the distance I need is the real minimun distance (or distance squared) between the polygons. The points that define the distance segment can be on a vertex, on edge, or inside the polygon.

I hope to be clear.

### #1Koder4Fun

Posted 19 August 2012 - 03:32 AM

After some hours of search and some implementations that doesn't work I hope on help of people that know more about this topic.

I need this on a iterative radiosity renderer, using gathering method, writed in C# using GPU (with XNA), to speed up the rendering.

For each polygon I have a lightmap and a list of lightmaps visible from it. That's work ok.
The idea is that when all lightmaps in "visible list" have an average energy less than a thresold I can skip the light gathering for the entire polygon's lightmap.

In a first time I've considered only the average energy, but I find that accounting for distance (or better the square of the distance, that is the physical decay of light) i can rescale the average energy and check against the threshold to do a better filtering.

I hope to be clear.