Christmas in Spring

Christmas in Spring

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

Moderator: Moderators

trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Christmas in Spring

Post by trepan »

I've added GLSL shaders, multi-texturing, and point sprites to the
Lua GL interface. Here's a quick example of what a simpe vertex
shader coupled with point sprites and a 64K random vertex display
list can do:

(4.4 Mbyte AVI video, weird codec...)
http://trepan.bzflag.bz/spring/video/sn ... shader.avi
- the particles rest on the water when they hit it, and fade
- the speed, range, and density are all easily configured

The most important thing to note about this feature is that not all
clients will support it. For those clients that do not, the associated
lua gl.XXX() calls are set to nil, and will cause widget/gadget errors
if you attempt to use them. The onus is on the scripter to provide a
backup rendering technique if one is required.

The user can also set "LuaShaders=0" to disable all lua shaders.
This should also come in handy when scriptors are trying to make
sure that their scripts are compatible with non-shader clients.

Some things that this could be used for:
- normal mapping (and parallax, and relief mapping)
- precipication (rain, snow, fire storm, volcanoes)
- fancy shield rendering (ex: slap a shader on the cloak shield)
- h/w skinning (would require a lot of work to substitute a unit with it)

Screenshot for the video impaired:
Image
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Christmas in Spring

Post by KDR_11k »

trepan wrote:- h/w skinning (would require a lot of work to substitute a unit with it)
Would that require more than "just" drawing a model through Lua, e.g. altered collision or mouseclick handling or something?
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

HORAY!
User avatar
LathanStanley
Posts: 1429
Joined: 20 Jun 2005, 05:16

Post by LathanStanley »

very, very, cool! :shock:

how do I add it to maps? :!:
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Do we have a mechanism for setting preferences via lua so that these can be added as options in settings.exe or whatever tool outside spring?
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

Someone has to have a play around with rain and make a gloomy, foggy, raining map... *Drools*

Of course, I realise that for the moment this is just eyecandy; but how far potentially would we be from being able to have weather impact on the game, similar to the Total War series? (ie: rain slowing tanks down, fog reducing LOS, etc, etc)
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

AF
The user can also set "LuaShaders=0" to disable all lua shaders.
This is the .springrc format, the same applies to the registry.
It's all or nothing at the moment. LuaUI widgets can use the
config call-outs to get user configuration data, or use the widget
config routines for local storage.

I may add a config call-out for the synced scripts (to be used on
their unsynced side). On that note, I may also be adding a call-out
for the synced side of synced scripts that provides limited access
to the GameSetup data (unsynced data would naturally have to be
excluded).
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Is it possible to use this from LuaGaia?
Also considering precipitation, can explosion generators be executed from lua? Might be useful for fallback, and because lots of people are already familiar with that.
Agorm's tree map would work well with some fog between the trees...
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

It's possible from all the lua scripts, except the older start-scripts.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Warlord Zsinj wrote:Someone has to have a play around with rain and make a gloomy, foggy, raining map... *Drools*

Of course, I realise that for the moment this is just eyecandy; but how far potentially would we be from being able to have weather impact on the game, similar to the Total War series? (ie: rain slowing tanks down, fog reducing LOS, etc, etc)
Rain + Agorm's tree map = WIN!
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Post by LOrDo »

Looks quite cool. Does this make the view worse from overhead camera view at all? Does it impact framerate significantly?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

My FPS goes from 156 to 154 (at 64K vertices). I've got a 7800GS.
It will depend on how it's configured, as well as your setup.

This doesn't use a shader, but it's fun anyways:
Image
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

That distortion thing could be cool if made to ignore the GUI. Using it sparingly and minimally could create some interesting haze effects for aircraft with exhausts, around big explosions, flamethrowers, etc.
NightfallGemini
Posts: 59
Joined: 07 May 2005, 23:48

Post by NightfallGemini »

Warlord Zsinj wrote:Someone has to have a play around with rain and make a gloomy, foggy, raining map... *Drools*

Of course, I realise that for the moment this is just eyecandy; but how far potentially would we be from being able to have weather impact on the game, similar to the Total War series? (ie: rain slowing tanks down, fog reducing LOS, etc, etc)
I second the notion for a gloomy, foggy, and rainy map. Have it be urban. XD

Also, I'm not certain, but I doubt Spring supports on-the-fly terrain speed switches like that, aside from making things steep or deep with explosions. Someone correct me if I'm wrong. D:
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

No but you can change the speed of a unit easily.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

3.5MByte video:
http://trepan.bzflag.bz/spring/video/warp.avi

The warping is done using a lua generated texture and gl.CopyToTexture().
It also use a 32x32 quad strip array display list with non-linear texcoords to
produce the warping. There are (16 x 12 = 192) small warps, and one big
fullscreen warp.

The spinning commander-in-a-quad is done using a lua generated texture and
gl.RenderToTexture(). Having this call means that you can create your own
textures dynamically in-game (you could also do it with gl.CopyToTexture(),
but it's slower and messier).
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Warlord Zsinj wrote:That distortion thing could be cool if made to ignore the GUI. Using it sparingly and minimally could create some interesting haze effects for aircraft with exhausts, around big explosions, flamethrowers, etc.
AS long as it stays that way, I would be happy.. Brings back the memories of CNC3 :|

This is awesome, good job! :twisted:
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

Yeah, I could see this being overused too, but if it was used very carefully and just in the right amount, it could look really really cool.
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

so..

Post by Noruas »

How hard would it be by next version use the white snow (fallout cough) after the like a huge nuke explosion? I think i can just particle it.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

The lua scripts can now use the vertex displacement rendering technique.

Here's how this image was produced:
1. Created a RGBA32F vertex texture with an FBO attachment
2. Used gl.RenderToTexture() to initialized the vertex texture with "armsilo1.bmp"
3. Drew a quadstrip field with a vertex shader that used the vertex texture's
luminance to offset the Z coordinate.

Image

P.S. This probably won't make much sense to the average forum reader.
GPU/shader fans will recognize what this means though, it allows for a slew
of cool effects to be done. For example, the dynamic water effect is done
using the vertex displacement technique.
Post Reply

Return to “Lua Scripts”