As long as the two objects are visually overlapping and one right up against the other, the problem may persist, indeed.
It does seem as though my guess may be correct, then.
I do have a question: Is the brown object supposed to be transparent?
If not, perhaps try turning on transparency-detection (by setting “show-transparency 1” in your prc file). If the brown object flashes, then it’s erroneously been identified as “transparent” (perhaps due to a texture with an alpha channel included), and fixing this may fix your problem.
If it is meant to be transparent, then read on!
It’s pretty straightforward. You can look to this manual page for details, but the short version is this:
Panda has a number of “bins” that it uses for rendering, going through one bin then the next in a set sequence. Aside from this broad-scale ordering of object-rendering–earlier bins before later–each bin controls what, if any, ordering is used per object.
By default, transparent objects are automatically placed into particular bin, simply labelled “transparent”. It renders after opaque objects, and sorts its objects from furthest to nearest. As a result, opaque objects can appear behind transparent objects, and for many purposes transparent objects render as one might expect.
In your case, however, we want to ensure that the objects render in a specific order: the brown object first, and the red object after (if I have it correctly).
To do this, we put our objects into another bin, the “fixed” bin, which, well, renders things in a fixed order. (And which is also rendered after standard opaque objects.) This is achieved by calling “setBin” on the NodePaths in question, passing in the name of the desired bin (in this case “fixed”), and a draw-order.
If I recall correctly, lower draw-orders render first, meaning that we would presumably want the brown object to have a lower draw-order than the red object. However, it’s possible that I have that the wrong way around, so if it fails, try swapping their draw-orders!
(If you’re modelling this in Blender 2.7, then I think that you can specify this binning via logic-properties applied to the relevant objects, too.)