1

I seem to be in a rut at the moment while writing the rendering side of my game engine. My original plan was to implement, at the very least, dynamic per pixel lighting with HLSL and having a light buffer communicate with the shader for a maximum of 8 lights.

It is important to note that as of now, my entire map is made a 3 dimensional array of blocks (64x64x64). After a VERY basic face reduction algorithm, I'm looking at 32x32x32x6 faces to render in the worst case scenario. I'm going to be using other methods to reduce the load but first I wanted to get this settled.

Currently, with 8 lights in the shader, I'm obtaining frame rates of around 60-120 with a GTX 470 which is a decent card. Obviously there are many other optimizations I must look into but as dynamic lighting is not crucial to me (at least not for 8 lights), I've been looking into light mapping.

If I were to have 4x4 lumels per face, I'm looking at a texture atlas for my light map of the entire level that is 32x32x32x6x16 large with 4 bytes per pixel. This comes out to a texture that I would use that is 2048x2048 (closest power-2 resolution).

I've already looked at a couple of sources, notably this one, http://www.flipcode.com/archives/Light_Mapping_Theory_and_Implementation.shtml, and while I grasp how to implement it with a basic scene, I'm stumped on how I could implement it with my current geometry situation.

So here is my question. Is there a better way to do this? Is a light map of this size alright to use? I feel comfortable with using 4x4 lumels per face as the bilinear filtering seems to really smooth things out in the end. Also, would it be fairly simple to combine a static light map system with a dynamic per pixel one with HLSL?

Joseph Pla
  • 1,600
  • 1
  • 10
  • 21
  • 1
    Does each face have a different texture? Do you call drawprimitive seperately for each cube? Also if you up your "voxel" density 4 fold how much does it affect frame rate? I would suspect you are less limited by the lighting and more limited by non-optimal rendering choices ... – Goz Mar 01 '13 at 18:20
  • No i've done quite a bit to minimize the batch count. I render every cube with about 32 draw calls and without the shaders I'm getting around 900 frames per second. – Joseph Pla Mar 01 '13 at 23:51
  • Also, I don't need a super high voxel density for what I'm doing. A field span of 64-128 would suffice and with both I'm getting very good frame rates. – Joseph Pla Mar 01 '13 at 23:53
  • 32 draw calls!? How many draw calls per frame? – Goz Mar 02 '13 at 07:18
  • In total, I'm using about 40 draw calls per frame, which is quite little really. – Joseph Pla Mar 02 '13 at 23:16
  • right ... I thought you were saying you were drawing each cube with 32 calls ;) – Goz Mar 03 '13 at 08:20
  • Post up your HLSL then ... – Goz Mar 03 '13 at 08:21

1 Answers1

1

http://www.rastertek.com/dx10tut18.html

Textures you use would be 4x4 mini textures inside your "super texture". Check out that link, but to be honest, you aren't giving very much to go on.

Voula11
  • 26
  • 2