apbodnar/FSPT

How to make a circular LED light?

Closed this issue · 3 comments

How can I replace the default global light with a LED circle somewhere above this wave surface?

The idea is that a properly placed circular light source would produce interesting reflections.

I generated this surface from a 128x128 heights map. It consists of 32k triangles and I'm quite impressed how quickly it renders :)

There's two approaches here:

  1. You can create a different environment sphere map with your lights as part of the HDR image. Env maps are specified with the environment property in the scene JSON. Environment lights use RGBE so you could manually paint your own rgb + alpha images, which may be hard. You could also generate an HDR image and convert to rgbe with something like this.

  2. OR you could create 3D lights by placing new props/meshes in the scene with the emission property set to a path to a texture or a three element rgb array. This part of the code is due for refactoring/cleanup and might not behave well. If you're willing to share your rippled surface mesh, I can cobble something together.

PS. I'll work on adding an option to opt into just one sampling scheme which should speed up rendering speed in brute force situations like refraction.

The obj file is rather large - almost 1 MB: paste.ee/r/5oyU9

Regarding the 2 options, which one is faster? My next question will be: how about multiple colored rings? Is it easy to change the light config on the fly?

I've added a mesh for the LED light and the emittance property doesn't seem to work.

  • LED light mesh: paste.ee/r/K2YJk
  • Wave surface mesh: paste.ee/r/5oyU9
{
  "environment": "environment/autumn_meadow_2k.RGBE.PNG",
  "environmentTheta": 0,
  "cameraPos": [2, 2, 2],
  "cameraDir": [-1, -1, -1],
  "props": [
    {
      "path": "asset_packs/misc/wave_surface.obj",
      "rotate": [{"angle": -1.57, "axis": [1,0,0]}],
      "scale": 1,
      "translate": [0, 0, 0],
      "diffuse": [0, 0, 0],
      "emittance": [0, 0, 0],
      "metallicRoughness": [0, 0, 0],
      "ior": 1.4,
      "dielectric": 0.9,
      "normals": "smooth"
    },
    {
      "path": "asset_packs/misc/led_ring.obj",
      "rotate": [{"angle": -1.57, "axis": [1,0,0]}],
      "scale": 0.5,
      "translate": [0, 0.5, 0],
      "diffuse": [0, 0, 0],
      "emittance": [0, 1, 0],
      "metallicRoughness": [0, 0, 0],
      "normals": "flat"
    }
  ]
}

led-0

http://.../?scene=wave&res=512