Jump to content

Softened alpha for plants ?


YouGroove
 Share

Recommended Posts

I tested Nobiax plant , and the alpha of plants seems like jagged edges or not smooth compared to anti aliasing on rocks for example.

plants.jpg

 

But the original diffuse is pretty soft without edges jaggies.

It is some way to have alphas for plants better like below? Or it is only a shader solution with some softening or cut out functionnality ?

 

Some example of clean alpha rendering :

plant_01_Caps.jpg

Stop toying and make games

Link to comment
Share on other sites

Looks like 1 bit alpha testing - but that's a thing from dem olden days if I were to guess I'd say the shader looked at the alpha value and did something like if alpha > X then 1 else 0.

 

What shader are you using?

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

The shader has a cutoff value of 0.5 hard-coded in the fragment shader. I don't have Leadwerks access right now, but it should read something like

 

if (color.a < 0.5) discard;

 

You could lower that value to see if it gives better results (maybe first saving a copy of the shader). Also, do the leaf textures use color bleed, meaning the leaf edges are smeared or surrounded by some green color? That helps with some artifacts you might get with alpha testing and mipmapping.

Link to comment
Share on other sites

Yes we have that :

//Modulate blend with diffuse map
outcolor *= texture(texture0,ex_texcoords0);
if (outcolor.a<0.5) discard;

Changing to 1 or 0.01 it changes thge amount of border , the outlines have always some jaggy effect; i just thaught it was other techniques.

 

@Gamecreator:

I have same settings.

Stop toying and make games

Link to comment
Share on other sites

Alpha discard is typically used today in games for vegetation. Alpha blending used to look better on the low-res textures back in the day, but today alpha discard is faster and doesn't suffer from z-fighting.

 

You can enable multisample antialias to prevent jagged edges, and make sure your textures are high-resolution enough that they don't look odd.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

In that case, I think what you're seeing is just normal screen aliasing. Turning MSAA on will eliminate this but retain crisp sharp edges. At higher levels, it will look identical to the cg renders you posted above.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...