Jump to content

[SOLVED] ObjectBillboards's LOD setting should work as ObjectGrass


photo

Recommended Posts

https://developer.unigine.com/forum/topic/1335-how-to-handle-this-kind-of-billboard-atlas

 

I've created a topic to ask how to use speedtree's billboard atlas, finally, I have to modify the source to to this, but after I successfully modified the source to accept the billboard atlas, I found the LOD setting of ObjectBillboards works like normal ObjectMesh, that's unacceptable, It should work like ObjectGrass, LOD fading some billboards at some distance.

 

I'm using this because some trees in our scene have fixed position, not random generated with ObjectClutter, so if I use ObjectGrass, uv are one big problem, but another bigger problem is that I can not control position of each grass blade, so the billboard will be different position with it's tree.

 

Hope this can be fixed in next version of SDK.

Link to comment
  • 3 weeks later...
  • 3 weeks later...

Our developers gave it a go, but it did not go well. The trick is grass is rendered in cells (step parameter is just for that). In this case fading is not a problem. Billboards are rendered in one rendering pass, all at once, that's why they are so performance-friendly. But it also means fading is a problem. Nevertheless, our developers promised to see what they can do. Will keep you posted.

 

There is good and transparent solution to your case: try to create one ObjectBillboards per tree. Then you can flexibly set up tree leaves fading with a distance.

Link to comment

how about using shader to control this, if the billboards's distance beyond the range, just set the output position of vertext to world center (0, 0, 0), then this will partly solve this problem.

 

Doing this on GPU side might be a much more simpler way.

 

And create one ObjectBillboards per tree will lose the advantage of ObjectBillboards, in one of my big scene, there are totally 140000 trees.

Link to comment

well, I've just modified the material added a near_cutoff shader parameter, and modified the shader's code to add:

float dist = length(vertex.xyz - s_camera_position);

   if(abs(dist) < near_cutoff)
  	 vertex.xyz = float3(0.0f, 0.0f, 0.0f);
   else {
  	 vertex.xyz += (tangent * angle_cos - binormal * angle_sin) * width;
  	 vertex.xyz += (tangent * angle_sin + binormal * angle_cos) * height;
   }

 

so far it works extremely fine.

Link to comment
×
×
  • Create New...