Sign in to follow this  
Followers 0
belfegor

alpha test objects at distance

2 posts in this topic


I am using instancing to render grass on my terrain, but distant grass objects sort of disappear especially if they are with thin leaves.
What is the common way to handle this problem?

Currently i do this in gbuffer pixel shader:

static const float maxDist    = 7.0f;// max dist from cam
    static const float aRefRange  = 0.392f;
    static const float aRefToAdd  = 0.47f;
    float dstTo      = length(posVS); //cam is at 0,0,0
    dstTo            = clamp(dstTo, 0.0f, maxDist);
    float inRange    = (1.0f - (dstTo / maxDist)) * aRefRange;
    float aRefVal    = inRange + aRefToAdd;
    clip(diff.w - aRefVal);
0

Share this post


Link to post
Share on other sites

I finally managed to compile nvcompress utility from code sample from article you have provided.
Result is amazing. Thank you greatly MJP.

Before:
bad.png

After:
ok.png

Edited by belfegor
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0