Skip to content

Fade nametags towards screen border#4316

Merged
thojkooi merged 4 commits intomasterfrom
nametags-fading
Sep 4, 2016
Merged

Fade nametags towards screen border#4316
thojkooi merged 4 commits intomasterfrom
nametags-fading

Conversation

@BaerMitUmlaut
Copy link
Copy Markdown
Member

When merged this pull request will:

  • Make nametags fade depending on distance to the screens center

20160901212255_1

PS: This component needs some cleanup.

@BaerMitUmlaut BaerMitUmlaut added the kind/enhancement Release Notes: **IMPROVED:** label Sep 1, 2016
@BaerMitUmlaut BaerMitUmlaut added this to the 3.7.0 milestone Sep 1, 2016
@jonpas
Copy link
Copy Markdown
Member

jonpas commented Sep 1, 2016

This should be an option.

@nicolasbadano
Copy link
Copy Markdown
Contributor

Three comments:
1 - I like it; in fact I remember programming this in the past; probably for AGM. It somehow got lost along the way,

2 - IMO it should be optional, as @jonpas said

3 - I'd like to see the compared perf of this, e.g. when 20 units are in sight. I took quite a bit of effort optimizing that loop on the last cleanup and it made quite a difference; that code can be called well over 1000 times per second when a lot of units are nearby.

private _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy));

private _screenPos = worldToScreen (_target modelToWorld (_target selectionPosition "head"));
if (_screenPos isEqualTo []) then {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why continue the render process? this is wased time. if the Nametag is not on screen.

@PabstMirror
Copy link
Copy Markdown
Contributor

@esteldunedain - I guess I'm the one who removed the old fading. 😭 I don't think it was intentional because I left the unused _projDist var.
ebeba23#diff-8f5258d40c7670f6b1e6ae7f2f2ccbabL100

Old way did this to do edge fading.

 _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy));
_alpha = ((1 - 0.2 * (_distance - _maxDistance)) min (1 - 0.15 * (_projDist * 5 - _distance - 3)) min 1) * GVAR(PlayerNamesMaxAlpha);

Not sure if that's any better than new?

@jonpas
Copy link
Copy Markdown
Member

jonpas commented Sep 4, 2016

Haha, in that case I'd still prefer a setting and make fading default.

@BaerMitUmlaut
Copy link
Copy Markdown
Member Author

Performance test with 20 AI:

Before:

After:

Now optional, I ordered it in between just show and show on cursor in the module, but to keep backwards compat I couldn't do that in the ACE settings.

@thojkooi
Copy link
Copy Markdown
Contributor

thojkooi commented Sep 4, 2016

lgtm

@thojkooi thojkooi merged commit 8a47d7a into master Sep 4, 2016
@thojkooi thojkooi deleted the nametags-fading branch September 4, 2016 18:50
@nicolasbadano
Copy link
Copy Markdown
Contributor

👍 Nice job @BaerMitUmlaut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Release Notes: **IMPROVED:**

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants