breaking the light barrier... 8

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
xskinyx
Posts: 25
Joined: Fri Dec 29, 2006 3:28 am

breaking the light barrier... 8

Post by xskinyx »

ok here is my situation-
im creating a 3rd person game and im using gtkradiant for map editing. i load in light data from the bsp. i want to use vertex lighting (from the lights i loaded in) for everything except the bsp geometry (which will be using the lightmap).

the problem im running into-
i can only have so many lights (i believe its 8) on at one time. if i load in more, they dont affect the vertex lighting at all.

here are my proposed solutions-
#1. use software lighting:
pros - no funny business
cons - its a little slower and i have no idea how to do it.

#2. use the 8 or so most relevant lights (usually the closest) to the player:
pros - fast
cons - map objects will be lit incorrectly, especially in the distance

#3. sort the 8 most relevant lights for each model node, then render the node. rinse and repeat for each model node:
pros - fast for static objects
cons - each moving node's lightlist needs to be computed realtime. also i dont know how to (or if) i can render nodes at my own discretion like that.


it seems to me like the most ideal solution is #3 if its possible. unfortunately vertex lighting isnt the focus of my project and i dont have too much time to spend dealing with it. if #1 can be done quicker (and there isnt a huge slow down for < 100 lights) i would rather use it. #2 is a last resort because i know it will work. it will just look fugly :(.

any suggestions? does anyone know how to implement software lighting? is it possible for me to render nodes in any order i want? i would like this to run on many different cards... do most cards support 8 lights?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

I've submitted a patch that enables custom light management that allows an arbitrary number of lights per scene (i.e. the limit is now per scene node, not per scene). A description of it with a visual example can be found here.

Not to get overly cynical, but like most submitted patches, it's currently languishing and rotting away in the Tracker, so I don't promise that it still works, or that it'll ever be incorporated into the core.

Good luck.
xskinyx
Posts: 25
Joined: Fri Dec 29, 2006 3:28 am

Post by xskinyx »

so your suggestion is #3?

how exactly do you control the node drawing order?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Sorry, I missed your reply.

With my patch, you get a call to the light manager prior to and after each node (as well as at the start and end of each rendering phase), so you can turn your lights on and off at that point.

I'm pretty sure it will do what you want. There's a sample application with it that demonstrates the usage.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
burningreggae
Posts: 66
Joined: Wed Oct 04, 2006 2:07 pm

Post by burningreggae »

even outdated.

Irrlicht and dynamic lighting

Per Scene
1) Lights are sorted by distance to camera. (intensity is missing)
2) The driver is asked how many light it can render. (n)
3) n lights are passed to the driver.

so if use more lights than the driver support in one visible frustum, it will be dropped. ( may result in color-flickering)

for a software solution look at burnings-video, how i do vertex-lighting.
(OpenGL 1.2 specular lighting)
You can even use burning-video just for vertex-lighting and render the secne twice with a hardware-driver.

regards
burningwater
burningreggae
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

You are too cunning to be understood.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply