secondlife / secondlife/viewer

Mirror sometimes doesn't reflect the scene even when using current building best practices

Open
#1,833 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug stale team:viewer
Dominant language
C++
Stars
299
Forks
146
Avg merge
1d 9h
Merged PRs (30d)
88

Description

Description

I investigated the two rightmost of three large mirrors at this area in Rumpus Room 2048: secondlife://Aditi/secondlife/Rumpus%20Room%202048/38/154/23 .

The mirror probes appear to be oriented in a similar direction, verified via two methods via debugging:

  • Rotations of the prim, according to selection tool code (see LLViewerWindow::renderSelections)
  • Rotations used directly by the hero probe (mNearestHero->mDrawable->getWorldRotation()), which appear to be roughly the same orientation but are very different quaternions. See also this third-party quaternion visualization tool (Note: This visualization tool rotates (1,0,0), not (0,0,1) which is the mirror probe vector we care about).
    • Working probe quaternion xyzw: {-0.299080938, -0.640742242, 0.328631878, 0.626099885}
    • Broken probe quaternion xyzw: {0.653281450, 0.270598054, 0.653281569, 0.270597905}

The "broken" mirror probe shows nothing but void, neither objects nor terrain. The "working" mirror probe shows correct reflections. Due to them having nearly the same orientation, one would expect the behavior to be similar. Something breaks in the math surrounding the hero probe normal. It's either the quaternion math or something a bit later. clipPlane and clipSign have bad values in the shader as a result, causing mirrorClip to discard the reflected objects.

It's currently hard to create a new mirror to attempt to reproduce this bug from scratch, due to current bugs with mirror creation. For this reason, I recommend the SLURL testing location.

This ticket is prior to implementation of https://github.com/secondlife/viewer/issues/1012 .

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the Rumpus Room 2048 SLURL to compare the working and broken probes, then start with the hero-probe rotation from mNearestHero->mDrawable->getWorldRotation() and the selection rotation in LLViewerWindow::renderSelections. Trace how the hero probe normal produces clipPlane and clipSign in the shader. Done means the affected mirror reflects objects and terrain instead of having mirrorClip discard them.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.