Patch for GroundDecals.fp

Patch for GroundDecals.fp

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

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

Patch for GroundDecals.fp

Post by Argh »

I've fixed the fragment shader for GroundDecals, so that they no longer glow when shadows are turned on and behave correctly. Tested, working correctly in all tests. Only affects GroundDecals, and works properly with shadows- no black.

Please commit this. Here's how it looks in-game, on a night map:

Image

And on day maps, it is also behaving correctly.
Attachments
grounddecals.zip
(743 Bytes) Downloaded 21 times
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Patch for GroundDecals.fp

Post by Beherith »

That looks real sweet. Is it auto placed by your world builder? Does it need to have ground decals enabled to be visible?

I recall doing the buildings ground decals baked on to the textures... That was a massive pain.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Patch for GroundDecals.fp

Post by Warlord Zsinj »

argh's features are spawned using worldbuilder and belong to the gaia side, iirc. So they aren't 'features' in the classic sense, but more like actual buildings and units.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Patch for GroundDecals.fp

Post by Peet »

I suggest you submit this as a .diff if it has not already been committed.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Patch for GroundDecals.fp

Post by lurker »

Nah, it's just a single couple-hundred byte text file. I would commit but I'm unable to test it and don't understand the algorithm.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Patch for GroundDecals.fp

Post by Argh »

To test it... just replace current springcontent.sdz with this one. Sorry, I didn't realize that most of you guys don't ever mess with the fragment programs (which is a "duh", because they're not much fun to mess with).

It's not a very complex program- all it does is get the texture, get the light value for groundSunColor, and apply the shadow texture, which is colored groundAmbientColor, and uses an alpha value of groundShadowDensity, IIRC. Ground Decals use alpha, but they don't do reflectivity or blinn stuff, so it was Easy Enough for Argh® - really, it was just monkey work, figuring out how the parts interrelated, and the only confusing part is that groundFPshadow.fp, which I based it on, uses slightly different math for the end, because of the funky texture system for unit trails.

In fact... hey... why don't we replace groundFPshadow with this, and then we can finally have unit Footprints that are in full color, and use a normal alpha channel?

Previously, it wasn't applying the light value first, and the previous version had some comment about how they'd left it that way because otherwise the shadows were black, which was because it wasn't correctly applying the alpha or color. I figured out where they'd gone wrong, and fixed it, by comparing with groundFPshadow.fp, so it's quite similar now.

At any rate, I'd appreciate it if somebody could find the time to test and commit this, it fixes a "minor bug" that's actually pretty important in terms of look-and-feel, and I can't see how there could be any serious bugs associated with it- fragment programs either run or crash, there really isn't a lot of wiggle-room.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Patch for GroundDecals.fp

Post by lurker »

I'm perfectly capable of making a zip; this laptop can't do shadows.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Patch for GroundDecals.fp

Post by Argh »

Er, that wasn't what I was trying to imply. Just that other people might want to test it, so I packed it up so it'd be easy to verify my results...
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Patch for GroundDecals.fp

Post by lurker »

You can take a joke better than that.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Patch for GroundDecals.fp

Post by Argh »

Not when I'm in the middle of making 80-some-odd new buildpics :P
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Patch for GroundDecals.fp

Post by zerver »

Real sweet... night maps, we need more of those imo.
User avatar
Hoi
Posts: 2917
Joined: 13 May 2008, 16:51

Re: Patch for GroundDecals.fp

Post by Hoi »

zerver wrote:Real sweet... night maps, we need more of those imo.
I think he has the night widget on.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Patch for GroundDecals.fp

Post by Kloot »

It looks like all you did was remove

Code: Select all

MOV shadeTex, {1, 1, 1, 1};
so that the linear interpolation between shadeTex and groundAmbientColor
(shadeColr = shadow.x * shadeTex + (1 - shadow.x) * groundAmbientColor)
does not start fully saturated. I don't see the connection to groundSunColor
(which isn't even passed to the shader, nor does it need to be), but that line
was indeed bogus.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Patch for GroundDecals.fp

Post by Argh »

I don't see the connection to groundSunColor
(which isn't even passed to the shader, nor does it need to be)
Oh. My bad, I thought that was the value being passed. Anyhow, it works.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Patch for GroundDecals.fp

Post by smoth »

zerver wrote:Real sweet... night maps, we need more of those imo.
after christmas I resume work on a tweaked version of islands at war. Then I am making a desert night map.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Patch for GroundDecals.fp

Post by Argh »

Yay, it's been applied. Thank goodness, it makes a huge difference.
Post Reply

Return to “Engine”