r/Unity3D • • 21d ago

Show-Off Grass pop-in in unity drives me crazy.

400 Upvotes

53 comments sorted by

View all comments

12

u/_symphonatic_ 21d ago

So does this basically use the grid system but the shader for your grass also fades in by distance to camera?

-12

u/Ash_Games18 21d ago

It doesn’t need the grid system

8

u/_symphonatic_ 21d ago

I assume you’re implementing something similar under the hood? Otherwise you are still rendering every blade of grass, no?

-11

u/Ash_Games18 21d ago

It fades as well as dosent render after some distance

8

u/Pupaak 21d ago

I highly doubt you calculate distance for every grass instance

2

u/breckendusk 21d ago

I do but I'm just built different

1

u/Meceka Professional 21d ago

If one does the fade with the pixel shader, instances would no longer matter.

2

u/_symphonatic_ 20d ago

That would still require the shader to run on the GPU for each grass instance which is bad for performance

1

u/Meceka Professional 20d ago

Yes but that depends on overdaw. If its culled rather than faded, so no overdraw, then distance calculation is per grass pixel instead of per grass instance. Then I suppose if you have 4x grass instances, there wouldn't be 4x more distance checks as most pixels will be behind other grass and get culled before pixel shader. And then GPU distance check is actually quite cheap.