maliput / delphyne

Scenario and search based Ego/Ado Car traffic simulations
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Agent shadows are casted through road lanes #590

Closed hidmic closed 5 years ago

hidmic commented 5 years ago

Description

In road networks were some lanes pass above others, shadows for agents passing by the upper lanes are casted through said lane and onto the lower lane, as if the former was transparent. This can be seen in demos like delphyne-city.

Definition of Done

BMarchi commented 5 years ago

After looking at the code for some days, I concluded that the problem is caused because roads don't have depth at all. We can 'attack' this problem like this:

  1. Remove culling for some materials: https://bitbucket.org/ignitionrobotics/ign-rendering/pull-requests/91/add-material-culling-mode/diff Use this PR, which solves the issue partially. Lanes will have double-side rendering, shadow will not project to other lanes, but we would have this: shadow. This will make the rendering phase a little bit more heavier.
  2. Modify Drake's algorithm to generate roads so we can add some depth to the mesh and render shadows properly (we are going to waste ton of days with this). It will imply to add more triangles to the mesh, since we are going to clone the roads.
  3. Ignore the issue: Shadows don't affect the simulation at all and this only happens with planes. The first solution isn't a complete fix and adds some complexity to the render phase. The second one requires to waste too much days for something that probably is not that significant .
clalancette commented 5 years ago

I'm concerned about making the rendering more heavyweight; we are already pretty slow in that city demo (mostly due to MOBIL cars). While it would be nice to get rid of the shadows, I don't think it is hugely important, so I'd opt for ignoring the issue (solution 3). @stonier , thoughts?

hidmic commented 5 years ago

@clalancette Just to put things in the right context, these are some of the small bugs that Brian's weeding out while we get ready for M4. Thus, and to answer your implied question @BMarchi, in the interest of time I'd like to see whether we can get away with just culling. Is double sided rendering being applied to the road meshes only?

BMarchi commented 5 years ago

We can apply double sided rendering to road meshes if and only if road's material is used by them only, cause culling is applied to the material

BMarchi commented 5 years ago

Made a further investigation. I used this pr https://bitbucket.org/ignitionrobotics/ign-rendering/pull-requests/91/add-material-culling-mode/diff and added another circuit a little bit below than the main one. The first one was configured like this:

  1. Top road has culling deactivated
  2. Middle road has back face culling. shadow_issue1 We can see the shadow in the street, but at least it doesn't project the shadow to lower lanes.

Second case was enabling back face culling for all roads: shadow_2 The car's shadow is getting projected infinitely on every road below.