mkrebser / GPUInstance

Instancing & Animation library for Unity3D
Other
228 stars 44 forks source link

Changing render distance of instances #9

Closed projectBreakableAccAPI closed 1 year ago

projectBreakableAccAPI commented 1 year ago

I scoured the codebase for info on this but the closest thing I could find was UniformCullingDistance and FrustumCullingType both of which seem to have no effect on the instance's render distance. Perhaps I'm assigning it incorrectly or something, but I can't figure it out so my question is, how do I change the culling distance of the instances the right way?

projectBreakableAccAPI commented 1 year ago

So I did more experimenting and found that the UniformCullingDistance seems to be linked to the graphics setting. So now I ask, how am I supposed to address it through a script?

mkrebser commented 1 year ago

set the radius of your instances- the bigger the radius, the longer it stays rendered

mkrebser commented 1 year ago

from code guide: "The radius is used for culling & LOD. This library uses radius aware LOD & culling. Objects with larger radius will change LOD and be culled at greater distances from the camera."

projectBreakableAccAPI commented 1 year ago

Well, that'll do it! Thank you very much, to be honest, I didn't even know that existed until now, my bad :)

projectBreakableAccAPI commented 1 year ago

I hate to open this again, but is there a way to set the actual render distance of the instances rather than their radiuses? Right now, even if the radius is zero, the instances render from ~1000 meters away.

mkrebser commented 1 year ago

This is all impacted by lodBias, go to your quality settings and adjust the bias. Higher bias = instances will be distance culled sooner.

Lower bias = instances culled later.