ros-visualization / rviz

ROS 3D Robot Visualizer
BSD 3-Clause "New" or "Revised" License
847 stars 463 forks source link

Rendering of Cube vs CubeList in RViz (ros-pkg ticket #4265) #333

Closed hershwg closed 12 years ago

hershwg commented 12 years ago

CubeList markers are rendered in a way that makes the structure of the scene indistiguishable because there is no lighting / shading applied. Single Cubes render fine (properly shaded), but cannot be used for large environments.

"Fake" lighting applied from a fixed directional light helps already to distinguish the structure of the scene (see attached screenshots).

In addition, when there are many small cube markers to be displayed, their (usually helpful) borders create ugly moire patterns (also see screenshots).

Applies to ROS 1.0 and 1.1.

Details are in a recent discussion at ros-users: http://ros-users.122217.n3.nabble.com/Rendering-of-Cube-vs-CubeList-in-RViz-td200626.html#a200626

trac data:

hershwg commented 12 years ago

[jfaust] Doing that kind of shading per cube when there are tens or hundreds of thousands of them is too slow for some lower-end graphics cards unfortunately (including the one in my computer), which is why it's currently not being done. I'm working on a deferred shading system for the next major version of rviz that should let us do this kind of shading nicely (and uniformly with the rest of the scene).

hershwg commented 12 years ago

[jfaust] The moire pattern should be easy to get rid of, we just need to remove the borders when the cubes become small enough on-screen.

hershwg commented 12 years ago

[ahornung] OK, so consider this more like a Feature Request then.

In OpenGL directly, the rendering of many cubes can be sped up by batch-rendering their sides as QuadArray (which I assume the MarkerArray is doing). Since their sides are all parallel, only a total number of 6 normals have to be defined, first all quads facing up are rendered, then left etc. I assume that this also speeds up shading, but I don't know if that can be applied to OGRE.

The moire pattern could (in general, not just for this case) be lessened by some sort of antialiasing / subsampling, but I assume that also comes at additional rendering costs.

hershwg commented 12 years ago

[hersh] I would like to apply the fake-light patch, possibly with a bit of extra work to make the lighting consistent with the rest of rviz. I'd like to get this done by Fuerte. Lowering priority.

hershwg commented 12 years ago

[hersh] Fixed in rev 38909. I added faked shading to the fragment program as suggested by Josh Faust, though I adjusted the values a bit.

I am leaving the borders in for now. I'm not willing to eliminate them entirely because some users like them. Perhaps an option to turn on anti-aliasing can be added separately.