Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


alpha test objects at distance


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 belfegor   Crossbones+   -  Reputation: 2716

Like
0Likes
Like

Posted 07 February 2013 - 05:32 PM


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


Sponsor:

#2 MJP   Moderators   -  Reputation: 11736

Like
3Likes
Like

Posted 07 February 2013 - 06:06 PM

This is a problem common  with alpha testing using mipmapped textures. You can read through this article for more info.



#3 belfegor   Crossbones+   -  Reputation: 2716

Like
0Likes
Like

Posted 13 February 2013 - 08:25 AM

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, 13 February 2013 - 09:11 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS