Page 1 of 1

Some screens

Posted: 14 Jun 2009, 23:21
by Argh
New uses of precipitation GLSL. Currently just WIP.

Better snow. Multiple snowflake types, better blending method for a bit more visual "fuzz"... and more-varied vectors:
Image

Rain that has wind directions (it doesn't currently obey the "real" wind vector or velocity, but I don't have time right now):
Image

Sandstorm (again, doesn't obey wind vectors yet, and you can't really see the motion in the screen, but it's quite striking):
Image

Re: Some screens

Posted: 14 Jun 2009, 23:29
by thesleepless
cool, but those snowflakes look way too big and distracting

Re: Some screens

Posted: 14 Jun 2009, 23:30
by Argh
It's not so bad, when they're falling past the POV really fast. You hardly see the close ones.

There really isn't any cure for that, anyhow, other than maybe forcing all nearby point objects to clear and making a bubble around the camera. Maybe I'll write that, dunno.

I need to write a shader to handle snow on top surfaces of things, for things that are supposed to be snow-covered. It's wasteful to do that kind of thing with endless variations of models, imo.

Re: Some screens

Posted: 14 Jun 2009, 23:36
by thesleepless
can you modify the different mip levels in a DDS? the nearest mip level could be blurry.

Re: Some screens

Posted: 14 Jun 2009, 23:40
by Jazcash
Cool stuff. All the first picture needs now is loads of lights on the trees.

Re: Some screens

Posted: 14 Jun 2009, 23:40
by Beherith
Really like sandstorm, is it a combo of precip and fog?

Re: Some screens

Posted: 15 Jun 2009, 00:09
by smoth
so we are seeing?

I also thought spring did not really have a real wind direction.

Re: Some screens

Posted: 15 Jun 2009, 00:13
by lurker
It has a full velocity; you can see some particles move in it.

Re: Some screens

Posted: 15 Jun 2009, 00:15
by MidKnight
Does it work on ATi cards?

Re: Some screens

Posted: 15 Jun 2009, 00:26
by Argh
1. It's all variations on the precipitation Widget, just minor changes to GLSL and a few things I thought up.

I haven't screwed around with this stuff for months, since I first cleaned up User's simple plane fog and wrote the first weather particle system besides Trepan's (which was simple and terribly CPU-eating). Thought I'd add these things as final touches on some new maps I'm doing, since it looks like this precipitation code works a bit better.

2. See Spring.GetWind. I just don't have time to turn that back into offsets xyz and figure out the scalar stuff right now, and then there's the fact that to do it right, you'd have to do a gusting algorithm, so that it didn't look really lame- IRL, you'd see some particles pick up the wind first, etc., and that's very messy unless particles are actually clouds of points, instead of individuals. That gets into a bunch of complex stuff that I don't want to touch atm, the last time I messed with it I wasn't ever happy with it.

3. I have no idea whether it works on ATi cards, but it's using the same GLSL base as the precipitation shader that Behirith used on that snowy map, which you reported was working for you.

4. I just wrote a cube around the POV that clears particles away, to prevent "over-large" particles. I may even extend that idea, it has other uses.

Oh, and I also fixed the code for the fog, so that it no longer overdraws UI elements, period.

I apologize for not having time to make a movie of these. It's kinda silly seeing them in stills, as they're basically all about building better dynamic motion, but I figured people could get the gist of it from my text.

The total effect is quite striking, though- the sand storm, for example, whooshes rapidly across the screen, the rain obeys the "wind" but different drops have slightly different vectors, the snow still uses sine-curve motions to drift, but is clearly also being carried by "wind", etc. It's all really simple stuff that makes this shader behave a lot more like what we see in the real world, basically.

Re: Some screens

Posted: 15 Jun 2009, 07:19
by CarRepairer

Re: Some screens

Posted: 15 Jun 2009, 13:01
by Argh
They're point objects ;)

Here are a couple of shots, showing the effect of the cube fix in action:
Image
Image

Re: Some screens

Posted: 16 Jun 2009, 01:29
by 1v0ry_k1ng
it dosnt look good in stills.. post a video clip of the three?

Re: Some screens

Posted: 18 Jun 2009, 23:21
by smartie
That looks pretty nice. The snow looks like it might be distracting thou. I wonder if there's some way you could soften the effect

Post Videos! :-)

Re: Some screens

Posted: 19 Jun 2009, 00:25
by thesleepless
a bit of a blur on the snow textures should do it i think.

Re: Some screens

Posted: 20 Jun 2009, 08:09
by Argh
Built a much better version of my lightning / thunder gadget, to go along with the GLSL rain.

Here's sourcecode. I figure that this is something people will want to use for various things- amongst other things, remove the graphical stuff, and voila, you have a simplistic ambient-sound generator.

This requires the LUPS Module or 100% compatible to use as written (i.e., it'll work CA for sure) but I'm sure it could use CEGs instead with very little effort.

Code: Select all

function gadget:GetInfo()
  return {
    name      = "Thunder Gadget",
    desc      = "Lightning and Thunder.  Requires LUPS Module or 100% compatible",
    author    = "Argh",
    date      = "June 22, 2009",
    license   = "GNU GPL, v2 or later",
    layer     = 0,
    enabled   = true  --  loaded by default?
  }
end

math_rand = math.random
local MaxSizeX = Game.mapSizeX
local MaxSizeZ = Game.mapSizeZ
local randomTime = 0
local randomFlashes = 0
local randomX, randomZ

if (gadgetHandler:IsSyncedCode()) then

function gadget:GameFrame(f)
	--Spring.Echo(f,randomTime)
	if f == randomTime then
		randomX = math_rand(0,MaxSizeX)
		randomZ = math_rand(0,MaxSizeZ)
		randomSound = math_rand(1,5)
		if randomSound == 1 then
			Spring.PlaySoundFile("sounds/thunder05.wav", 30, randomX, 1000, randomZ)
		end
		if randomSound == 2 then
			Spring.PlaySoundFile("sounds/thunder06.wav", 30, randomX, 1000, randomZ)
		end
		if randomSound == 3 then
			Spring.PlaySoundFile("sounds/thunder07.wav", 30, randomX, 1000, randomZ)
		end
		if randomSound == 4 then
			Spring.PlaySoundFile("sounds/thunder08.wav", 30, randomX, 1000, randomZ)
		end
		if randomSound == 5 then
			Spring.PlaySoundFile("sounds/thunder09.wav", 30, randomX, 1000, randomZ)
		end
	end

	if f >= randomTime and randomFlashes > 0 then
		SendToUnsynced("lups_lightning", randomX, randomZ)
		randomFlashes = randomFlashes - 1
		return
	end

	if f >= randomTime and randomFlashes <=0 then
		randomTime = f + math_rand(300,500)
		randomFlashes = math_rand(10,30)
		return 
	end
end

else

local mySize, myLife, randomT, randomA1, randomA2
local randomTexture = 'bitmaps/lightning1.tga'

local function SpawnLightning(_, randomX, randomZ)
	local Lups = GG['Lups']
	randomX = randomX + math_rand(-1024,1024)
	randomZ = randomZ + math_rand(-1024,1024)
	mySize = math_rand(512,1536)
	myLife = math_rand(10,30)
	
	randomA1 = math_rand(0.5,1.0)
	randomA2 = math_rand(0.3,1.0)

	randomT = math_rand(1,3)
	if randomT == 1 then
		randomTexture = 'bitmaps/lightning1.tga'
	end
	if randomT == 2 then
		randomTexture = 'bitmaps/lightning2.tga'
	end
	if randomT == 3 then
		randomTexture = 'bitmaps/lightning3.tga'
	end
    	
	Lups.AddParticles('GroundFlash',{
		texture = randomTexture,
		layer=-40,
		pos={randomX,Spring.GetGroundHeight(randomX,randomZ),randomZ},
		life = myLife,
		size = mySize,
		sizeGrowth = -12,
		colormap = {{0.9, 0.9, 1.0, randomA1},{0.5, 0.5, 1.0, 0.1},{0.9, 0.9, 1.0, randomA2},{0.5, 0.5, 1.0, 0},},
		repeatEffect=false,
	})
end

function gadget:Initialize()
	gadgetHandler:AddSyncAction("lups_lightning", SpawnLightning)
end

function gadget:Shutdown()
	gadgetHandler.RemoveSyncAction("lups_lightning")
end

end