Page 1 of 3

Christmas in Spring

Posted: 21 May 2007, 09:00
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

Re: Christmas in Spring

Posted: 21 May 2007, 10:33
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?

Posted: 21 May 2007, 14:22
by 1v0ry_k1ng
HORAY!

Posted: 21 May 2007, 16:20
by LathanStanley
very, very, cool! :shock:

how do I add it to maps? :!:

Posted: 21 May 2007, 16:46
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?

Posted: 21 May 2007, 16:54
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)

Posted: 21 May 2007, 17:05
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).

Posted: 21 May 2007, 17:40
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...

Posted: 21 May 2007, 17:51
by trepan
It's possible from all the lua scripts, except the older start-scripts.

Posted: 21 May 2007, 17:52
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!

Posted: 21 May 2007, 23:15
by LOrDo
Looks quite cool. Does this make the view worse from overhead camera view at all? Does it impact framerate significantly?

Posted: 21 May 2007, 23:27
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

Posted: 22 May 2007, 01:59
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.

Posted: 22 May 2007, 07:25
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:

Posted: 22 May 2007, 08:22
by KDR_11k
No but you can change the speed of a unit easily.

Posted: 23 May 2007, 02:10
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).

Posted: 23 May 2007, 05:11
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:

Posted: 23 May 2007, 05:23
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.

so..

Posted: 24 May 2007, 02:36
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.

Posted: 24 May 2007, 06:31
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.