• Advertisement
Sign in to follow this  

alpha test objects at distance

This topic is 1800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


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);

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement