Jump to content
The Dark Mod Forums

Spherical lights


Farsead

Recommended Posts

Note that the standard light entity is not a cube - it is displayed that way in the editor but its light is cast like a chunky 6-pointed star with pyramids pointing outwards to the centres of the sides of the cube. This is a compromise for performance and roughly simulates how a sphere of light is cast. Try creating a light in the middle of a room and somewhat bigger than the room. It's light is brightest in the centre of the walls, floor and ceiling and darkest in the corners - just like a sphere would be. And its faster than calculating a sphere of light.

Link to comment
Share on other sites

The light volume of a point light IS a cube. It projects a texture in all 6 directions and the intensity changes with the distance from the origin (falloff). It's spherical because of this falloff (the texture also affects this) but the affected geometry is determined by the cubic volume.

Please correct me I'm mistaken somewhere. :)

Link to comment
Share on other sites

I found the old post in one of the internal forums. I was asking the same sort of question as you. I'm not sure I got it exactly right:

 

The default light is not a sphere, but a fading square (like a pyramid viewed from above).

 

The image posted is like a pyramid on top of an inverted pyramid. I think also it ought to be rotated 45 degrees. So it's like a diamond with 6 points rather than a star with its points in the centre of each side of the cube volume. I think this is probably right. Someone will confirm or correct no doubt.

 

[EDIT] Otherwise, why do we want a spherical light if the falloff is already perfectly spherical?

Link to comment
Share on other sites

You're both kind of right actually -- the light volume as considered by the game is a cube, but the default falloff textures are linear in each dimension which means that the illuminated area will be a sort of eight-sided diamond shape (like two pyramids on top of each other, one pointing up and the other down).

 

Of course this depends on the texture you choose; with biground1 the shape is more like two cones on top of each other (possibly two rounded cones, or even an actual sphere; I haven't checked the Z falloff texture it uses).

Link to comment
Share on other sites

In the XY plane, yes, it's just a lookup in the light texture, though it's a 2D lookup.

 

However, to calculate the intensity in the entire volume another value is read from a separate z falloff image (presumably it just gets multiplied) - that's what you specify by lightFalloffImage in the material.

Link to comment
Share on other sites

Yes exactly, the XY planar texture is multiplied by the value from the Z falloff texture to produce the final value. If the XY texture is a gradient (as most are), the Z falloff will cause it to "shrink" to a point as you go further from the center, with the gradient in the Z falloff determining the rate of shrinkage.

Link to comment
Share on other sites

the Z falloff image defaults to makeIntensity(lights/squarelight1a)
It's in the "lights/defaultPointLight" material in "lights.mtr".

 

So the 2D falloff texture is the projected texture and lightFalloffImage is the 1D falloff?

Link to comment
Share on other sites

Can't be sure - there's lots of stuff I don't know about the D3 engine, so maybe it has actually some use. Z-Falloff images are 2D textures too, so maybe they got some cool effect out of it by using a special pattern there?

Link to comment
Share on other sites

I guess they figured it was easier for an artist to use a 2D texture, rather than having to create a 1D texture. Also this approach means that you can use the same texture for both XY and Z falloffs, for example you could use the lights/biground1 image as a Z falloff if you didn't want it to be linear.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...