Grass with Alpha Blending

Feedback on past, current, and future development.
Post Reply
User avatar
PeterBitt
Posts: 144
Joined: 25 Mar 2013, 18:49
Location: Berlin
Contact:

Grass with Alpha Blending

Post by PeterBitt »

Will it be possible to have grass in OpenMW wich uses Alpha Blending for the textures, instead of the Alpha Testing that MGE uses?
I like to have slightly transparent grass for my texture replacer less game:
http://i.imgur.com/M9141A2.jpg
http://i.imgur.com/yhdL8C1.jpg
http://i.imgur.com/I8hvnYj.jpg

Most games I know seem to have that sharp alpha testing grass, I only remember far cry 1 to have this slightly transparent grass with soft edges. Will this be possible in OpenMW?
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Grass with Alpha Blending

Post by Chris »

PeterBitt wrote:Will it be possible to have grass in OpenMW wich uses Alpha Blending for the textures, instead of the Alpha Testing that MGE uses?
I don't see why it wouldn't technically be possible, although it'll be less than ideal. Alpha blending would enforce strict ordering which would make it less efficient to render. Given the non-uniform placement of grass, you'd have cases where bits would be rendered in improper order (causing visible glitching). Plus, many modern rendering effects don't work well with translucent surfaces -- they won't cast shadows, for instance, or affect the sun glare. Sun rays will ignore it (when we implement those), and it will require a slower lighting technique when we do deferred shading.

Alpha testing (without blending), by contrast, fixes these problems. Either the pixel is skipped entirely (no depth or visual component), or it's rendered opaquely so it can be put into the depth buffer, allowing it to be batched and rendered somewhat out of order (but still sort correctly), which also means it can be seen by the shadow map and block the sun.

Personally though, I'd like to see a more procedural technique for grass like Outerra uses: https://www.youtube.com/watch?v=pdMaFWGLxKE (more info here). It severely cuts down on the patchy nature inherent with patch models, and blends nicely with the underlying texture as it goes into the distance. It handles my biggest gripe with grass in games, that you can make out individual clumps and see it's just composed of a few flat intersecting triangles with a blurry texture.
User avatar
PeterBitt
Posts: 144
Joined: 25 Mar 2013, 18:49
Location: Berlin
Contact:

Re: Grass with Alpha Blending

Post by PeterBitt »

Thank you very much for these informations! I wasnt aware of those technical limitations.
Did I understand correctly that the problems with overlapping alphas when using blending in MW is actually not an engine limitation, but is generally a problem of alpha blending? Will our alpha-blending textures still disapear in OMW, when viewed through the water surface? I am not a fan of alpha testing in MW, it doesnt go well with the vanilla look.
I dont know the technical stuff, is there another way to have smooth (or blurry) alphas than alpha blending?

Yes Outerra has the best grass I have ever seen, if you manage something like this it would be really great. Thinking about Outerra ... the greatest feature are the procedural created rock "textures" in full 3d with collisions and stuff. I guess its a bit to much to add to OMW as the two Outerra guys worked for years on this, but it would be just to great to get rid of the smooth mountains in MW.

EDIT: You said alpha blending cant cast shadows and is ignored by sunrays, I am wondering why the tree leaves wich have alpha blending enabled do all this properly in MGEXE?
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Grass with Alpha Blending

Post by scrawl »

PeterBitt wrote:Will it be possible to have grass in OpenMW wich uses Alpha Blending for the textures, instead of the Alpha Testing that MGE uses?
Yes, but it will be extremely inefficient. You need to place each grass blade individually (and the number of batches to render explodes), otherwise the engine doesn't know that they need to be sorted.
EDIT: You said alpha blending cant cast shadows and is ignored by sunrays, I am wondering why the tree leaves wich have alpha blending enabled do all this properly in MGEXE?
Shadows are possible by combining alpha testing and blending (the shadows won't have alpha blending, but that's probably unnoticable). But anything that's half-translucent will cast 100% shadow.
God rays are not an issue I believe, it can use a half-translucent mask just fine.
But, depth-based effects, such as SSAO and Deferred Shading are not possible.

What we can do to improve the look of alpha testing would be to enable alpha-to-coverage if available.
http://www.stevestreeting.com/wp-conten ... verage.jpg
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Grass with Alpha Blending

Post by Chris »

scrawl wrote:God rays are not an issue I believe, it can use a half-translucent mask just fine.
I believe it depends on how exactly they're implemented. The basic method uses a screen-space directional blur, which I suppose would work with translucency. This method has a problem though: the light source must be on-screen, so you can't have rays streaming in from off-screen or from behind an obstruction, as the intensity is (in part) determined by how much of the sun is on screen.

Another method I've heard about (but unfortunately don't know the details of) is basically to use a shadow map. This lets the light source be anywhere in world space, and still generate rays from the light hitting misty air. Of course, this means it has the same limitations as regular shadow mapping.
Tarius
Posts: 574
Joined: 24 Oct 2011, 19:29

Re: Grass with Alpha Blending

Post by Tarius »

Hmm, perhaps would it be possible to have the engine deal with grass in a unique way? For the most part, light shining on to grass comes from above, ie. the sky. So it will usually be known there will be a small shadow "layer" in it. With other light sources, anything horizontal etc, some sort of lighting effect could be added that wouldnt be a shadow per se, but would mimic the effect?
Post Reply