Labels

November 16, 2012

BGE Candy - Area lights

I have a new PC computer and this is a milestone for the development for BGE and my racing game. Finally I can to some more quality screen capture, and the first ones to show you are - area lights!



As soon as I saw Arkano22`s implementation of area lights in gamedev.net forums I knew Blender must have it in GE! This is a slightly modified version of Arkano22 technique, the biggest differences are the smoother light falloff and specular reflection glossiness variations based of the reflecting surface properties and distance, and of course - the texture support!

video showing how to set-up them:



win32 build: https://dl.dropbox.com/u/11542084/Blender246AreaBuild.zip

19 comments:

  1. Do you know what you just did with those reflections?

    You made it possible to remake your BPCEM scene with arealights. Each arealight having the texture of its corresponding wall.

    Is it possible to give the arealight a instant falloff, so that it produces the reflection but no light? Could be useful to fake reflections only, otherwise it will be interesting to see what GI effects you can produce with this.

    I am gonna do some serious tests with this!!! :D

    ReplyDelete
  2. I made small example. http://www.pasteall.org/blend/17534

    I had some problems making the arealights the same size as the meshes, the metric system seems to be buggy. I made the meshes 8x4m, but the arealights 8,4m are much smaller... don't know what the problem is at the moment.

    ReplyDelete
  3. When you untick the Diffuse tickbox and only use Specular (in the arealight "Lamp" settings); there is no falloff to the reflection.

    Could you fix that, so that the reflection is the same using Diffuse or not?

    ReplyDelete
  4. I did not apply the scale, that's why the measurements did not match.

    ReplyDelete
  5. I made a better blend file here:

    http://blenderartists.org/forum/showthread.php?209688-Box-Projected-Cube-Environment-Mapping-demo-%28Shiny!%29&p=2243142&viewfull=1#post2243142

    ReplyDelete
    Replies
    1. hey, thats pretty neat, hehe. about the specular falloff - youre right, I have to check that.

      Delete
  6. Love it. But can you please tell me what music I'm listening to ?

    ReplyDelete
    Replies
    1. It is a soundtrack from Half-life 2 mod "Neotokyo". You can listen and download it in soundcloud.com

      Delete
  7. I found another use for it ;)

    http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR&p=2244203&viewfull=1#post2244203

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Hey, how did you do the textures? do you have to blur them in preprocess to use as a light source? I'm curious because you get sharp reflections but soft glow aura...

    ReplyDelete
    Replies
    1. You mean the texture blurring? I am just changing the mip-mapping offset based on the distance of the surface. Basically something like:
      miplevel = distance*glossiness;
      texture = texture2DLod(sampler,coords,miplevel);

      Delete
    2. Actually I can just give the whole code :) I will host it somewhere, hold on.

      Delete
    3. here you go: https://dl.dropbox.com/u/11542084/AreaLights.txt

      this is the whole blender implementation on the shader side.
      you have to run this for each area light in the scene something like this:

      for (i=0; i<AREALIGHTS; ++i)
      {
      diffuse += areaDiff();
      spec += areaSpec();

      #ifdef TEXTURE
      diffuse *= areaDiffTexture();
      spec *= areaSpecTexture();
      #endif
      }

      Delete
    4. Heh, nice trick with the mipmaps! And thanks for the code. You can see some of the results here http://www.flickr.com/photos/marcinignac/8210047821/in/set-72157629801608107 i'll play with textures later.

      Delete
    5. nice results!
      I went through all of your work - awesome stuff!

      Delete
  10. hey i stumbled upon a version of realtime spherical area lights. do you plan to also implement this type of light into blender?

    ReplyDelete