Light Sources?

Light Sources?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Light Sources?

Post by Argh »

Can we create, destroy, and manipulate a point-source of light, using the LUA interface tools? If so, how?
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

*Drools..*

Hehehe, I hope so...

If I can run it on my 6600, and my 3200+ single core, everybody else can, too.. :twisted:
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

You'd have to implement light mapping via lua to do that. The necessary shaders and openGL calls to do it appear to be in place but I have never implemented it before so ask trepan or jelmer.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

If this were possible, would it be limited for large single lightsources, such as having a moving sun or perhaps multiple suns (tattooine? ;) ), or would it be something that could be used (perhaps it's a lightsource with a decay?) for dynamic lighting on explosions, muzzleflashes, etc?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Imagine turning shadow mapping on and off, and the performance difference.

Then, factor in a 5-10% performance decrease for lua speed and inexperience.

Then place 1 extra light point other than the sun.

You now have 2 shadow maps to handle and a lightmap.

Add a third light point.

2 lightmaps, and 3 shadowmaps.

Now imagine that this was implemented per map. It wasnt in settings.exe. Imagine the user outrage.

Stuff like dynamic lighting is not something that people should implement in lua using the tools currently provided. Its possible, and you could probably get away with a few tricks here and there rather than full dynamic lighting. But the lighting effects would need to be mod absed not map based save for features, I'm thinking street lamps on dark maps, light houses, fires.
User avatar
AlfaSub
Posts: 17
Joined: 07 Feb 2006, 20:28

Post by AlfaSub »

AF, it wouldn't be too hard to add a setting like "MAX # of shadowmaps" to the settings dialog. Then it would be user-configurable. The only thing that concerns me is if this many shadowmaps would be too large of a performance hit to create a good coolness/performance ratio.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

This kind of lighting requires knowledge of the light when drawing all stuff.. so it's basically impossible without touching all the drawing code. TBH it should be done in C++ if done at all, you want to be able to quickly check which lights are worth enabling etc..
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

btw argh, are you trying todo some funky dnyamic light stuff? (explosion effects, on-unit lights, etc?
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Snipawolf wrote:If I can run it on my 6600, and my 3200+ single core, I'm gonna spend some dollars so everybody else can too.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

chance of it not running on that rig if implemented in lua:

99%
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Is it just me, or every time I start to talk about ideas here, it becomes an irrelevant argument :roll:

Ok, so JC, you're saying "don't do this, you fool, because it would all have to be routed through all the drawing calls, and doing it through LUA would take too darn long". Good enough. I figured that was the answer, because of the way that the map formats are all tied into the rendering system, but I wanted to be sure. TBH, I didn't really know where I was going with this, because custom GroundFlashes and other nifty things are in the next Spring anyhow, and I don't think I'll actually need it.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

I'm saying it can't be done, with lua all you can do is draw more things, not change existing drawing code (such as map rendering).
Post Reply

Return to “Lua Scripts”