[DX9] many lights: registers VS Volume Texture

Started by
5 comments, last by 21st Century Moose 10 years, 2 months ago

Hi,

I want to expand maximum lights capability in my 3D engine. The DX9, forward rendering is used there. The lights pass to shader as array of corresponding shader structs, located in registers memory. So, registers memory is restriction for max lights.

Could anybody tell me tell whether the performance will be good enough when i will hold lights array in Volume Texture? I mean in compare to registers memory..

Thanks for your help!

Advertisement

I think that the bandwidth usage and overhead of transferring a few kilobytes to the GPU is no problem. You can use Vertex Texture Fetch in the vertex shader to lookup your lights array.

Only when you want each light to cast shadows will you notice performance issues.

thank you for reply, Tispe.

I will take your post into account. Before i started to do anything, I want to hear the point views of people concerning topic question. So, please tell me if somebody has different point of view.

You can use Vertex Texture Fetch in the vertex shader to lookup your lights array.

Nice advice! Didn't know about such feature.

Only when you want each light to cast shadows will you notice performance issues.

Only direct lighting calculations are there..

Fetching a value from a texture will be slower than fetching it from a constant/register. The latter hardware is optimized for predictable data access, where it assumes that every pixel/vertex will read every register, in the same order. The former hardware is designed assuming that each pixel/vertex will read different texels, and that not every texel in the source image will be used.

If you want to use VTF on D3D9, you have to check the caps to see if it's supported, and query whether each texture format you want to use with VTF is also supported. Most D3D9 era cards with VTF support will only work with four-channel 16F (half float) format.

Does it have to be a volume texture, not 1D or 2D? What's your actual usage idea?

It might also be good to define what you mean with 'many lights'. Does this mean many lights in total in the scene, or many lights affecting a single renderable?

If it's the first, you could optimize by having relative small renderables ('submeshes') and then take for example the 8 lights that most affect that renderable. In most situations having more then 8 lights affecting one renderable, the difference in result is quite small.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

It might also be good to define what you mean with 'many lights'. Does this mean many lights in total in the scene, or many lights affecting a single renderable?

If it's the first, you could optimize by having relative small renderables ('submeshes') and then take for example the 8 lights that most affect that renderable. In most situations having more then 8 lights affecting one renderable, the difference in result is quite small.

With Vertex texture fetch, one can render the same mesh using instancing.

As for D3D9, I think it's for people with new graphic card but stuck with Windows XP.

One can also fall back to Doom3 style rendering,which use additive blending with multiple pass.

One can also fall back to Doom3 style rendering,which use additive blending with multiple pass.

This could also be done using instancing, where each light is defined by per-instance data.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement