WasVisible: query visibility of scenes and shapes, RobustNegativeScale: support lighting with negative scales

Detect visibility
  1. You can easily query whether the scene or shape was (potentially, at least partially) visible in the last rendering event. This accounts for both frustum culling and occlusion culling.

    Use TCastleScene.WasVisible, TAbstractShapeNode.WasVisible for this.

    Demo is in examples/viewport_and_scenes/test_was_visible.

    See forum thread for history behind this feature.

  2. You can use TCastleRenderOptions.RobustNegativeScale to make lighting work correctly even when combined with negative scale. By default, using negative scale causes trouble for lit objects (as the normal vectors are not coming from the right side) and backface culling. Using the RobustNegativeScale makes them reliable (at a small cost at rendering time).

1 Like