• Create Account

#Actualmv348

Posted 15 September 2012 - 11:23 PM

Thanks for all the input guys! I just got shadow-mapping workingwith a single light, for a single model. So now I am moving towards multiple lights, and multiple models.

To avoid excessive extra-rendering, I am planning on enclosing each lamp in a bounding volume (i.e. an Axis Aligned Bounding Box) and checking for intersections with each models bounding volume. I admit I haven't read up much on this just yet, there's something called 'Cascaded Shadows' that I need to look into, but I wanted to get your input on the algorithm I came up with today.

Here's the psuedo-code. Should be pretty self explanatory:


Algorithm:

PositionModels()
PositionsLights()
/////////////////
/////////////////

for  light in AllLights
{
// determine which models are hit by the light
for model in AllModels:
{
if (collision(light.volume, model.volume)
{
}
}

// if any models were hit by the light
if (light.modelsInView.Count > 0)
{

// render all models in this light's view to the light's shadowmap
for model in light.modelsInView
{
model.render();
}

}

}

//////////////////
// FINAL RENDER //
//////////////////

for model in models:
{
{
}
model.render();

}



Obviously the relevant lists need to be cleared after each rendered. Further optimizations can obviously be made, such as caching shadows for stable objects. But I think the general structure is captured here, wouldn't you say?

Any input/feedback would be appreciated.

#4mv348

Posted 15 September 2012 - 11:22 PM

Thanks for all the input guys! I just got shadow-mapping workingwith a single light, for a single model. So now I am moving towards multiple lights, and multiple models.

To avoid excessive extra-rendering, I am planning on enclosing each lamp in a bounding volume (i.e. an Axis Aligned Bounding Box) and checking for intersections with each models bounding volume. I admit I haven't read up much on this just yet, there's something called 'Cascaded Shadows' that I need to look into, but I wanted to get your input on the algorithm I came up with today.

Here's the psuedo-code. Should be pretty self explanatory:


Algorithm:

PositionModels()
PositionsLights()
/////////////////
////////////////////////////////

for  light in AllLights
{
// determine which models are hit by the light
for model in AllModels:
{
if (collision(light.volume, model.volume)
{
}
}

// if any models were hit by the light
if (light.modelsInView.Count > 0)
{

// render all models in this light's view to the light's shadowmap
for model in light.modelsInView
{
model.render();
}

}

}

//////////////////
// FINAL RENDER //
//////////////////

for model in models:
{
{
}
model.render();

}



Obviously the relevant lists need to be cleared after each rendered. Further optimizations can obviously be made, such as caching shadows for stable objects. But I think the general structure is captured here, wouldn't you say?

Any input/feedback would be appreciated.

#3mv348

Posted 15 September 2012 - 11:17 PM

Thanks for all the input guys! I just got shadow-mapping workingwith a single light, for a single model. So now I am moving towards multiple lights, and multiple models.

To avoid excessive extra-rendering, I am planning on enclosing each lamp in a bounding volume (i.e. an Axis Aligned Bounding Box) and checking for intersections with each models bounding volume. I admit I haven't read up much on this just yet, there's something called 'Cascaded Shadows' that I need to look into, but I wanted to get your input on the algorithm I came up with today.

Here's the psuedo-code. Should be pretty self explanatory:


Algorithm:

PositionModels()
PositionsLights()
/////////////////
////////////////
for  light in AllLights
{
// determine which models are hit by the light
for model in AllModels:
{
if (collision(light.volume, model.volume)
{
}
}
}

// if any models were hit by a light
if (light.modelsInView.Count > 0)
{

// render all models in this light's view to the light's shadowmap
for model in light.modelsInView
{
model.render();

}

}

//////////////////
// FINAL RENDER //
//////////////////

for model in models:
{
{
}
model.render();

}



Obviously the relevant lists need to be cleared after each rendered. Further optimizations can obviously be made, such as caching shadows for stable objects. But I think the general structure is captured here, wouldn't you say?

Any input/feedback would be appreciated.

#2mv348

Posted 15 September 2012 - 11:15 PM

Thanks for all the input guys! I just got shadow-mapping workingwith a single light, for a single model. So now I am moving towards multiple lights, and multiple models.

To avoid excessive extra-rendering, I am planning on enclosing each lamp in a bounding volume (i.e. an Axis Aligned Bounding Box) and checking for intersections with each models bounding volume. I admit I haven't read up much on this just yet, there's something called 'Cascaded Shadows' that I need to look into, but I wanted to get your input on the algorithm I came up with today.

Here's the psuedo-code. Should be pretty self explanatory:


Algorithm:

PositionModels()
PositionsLights()
/////////////////
////////////////
for  light in AllLights
{
// determine which models are hit by the light
for model in AllModels:
{
if (collision(light.volume, model.volume)
{
}
}
}

// if any models were hit
if (light.modelsInView.Count > 0)
{

// render all models in this light's view to the light's shadowmap
for model in light.modelsInView
{
model.render();

}

}

//////////////////
// FINAL RENDER //
//////////////////

for model in models:
{
{
}
model.render();

}



Further optimizations can obviously be made, such as caching shadows for stable objects. But I think the general structure is captured here, wouldn't you say?

Any input/feedback would be appreciated.

#1mv348

Posted 15 September 2012 - 11:12 PM

Thanks for all the input guys! I just got shadow-mapping workingwith a single light, for a single model. So now I am moving towards multiple lights, and multiple models.

To avoid excessive extra-rendering, I am planning on enclosing each lamp in a bounding volume (i.e. an Axis Aligned Bounding Box) and checking for intersections with each models bounding volume. I admit I haven't read up much on this just yet, there's something called 'Cascaded Shadows' that I need to look into, but I wanted to get your input on the algorithm I came up with today.

Here's the psuedo-code. Should be pretty self explanatory:


Algorithm:

PositionModels()
PositionsLights()
/////////////////
////////////////
for  light in AllLights
{
// determine which models are hit by the light
for model in AllModels:
{
if (collision(light.volume, model.volume)
{
}
}

// if any models were hit
if (light.modelsInView.Count > 0)
{

// render all models in this light's view to the light's shadowmap
for model in light.modelsInView
{
model.render();

}

}
}
//////////////////
// FINAL RENDER //
//////////////////

for model in models:
{
{