aframevr / aframevr/aframe

Default text looks poor in front of planes. Have render-order component?

Open
#4,160 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
17.6k
Forks
4.4k
PR merge metrics
No merged PRs in 30d

Description

Description:

Without render-order:

Screen Shot 2019-05-08 at 2 55 56 AM

Controlling render-order:

Screen Shot 2019-05-08 at 3 01 19 AM

AFRAME.registerSystem('render-order', {
  schema: {type: 'array'},

  init: function () {
    this.el.renderer.sortObjects = true;
  },

  update: function () {
    this.order = {};
    for (i = 0; i < this.data.length; i++) {
      this.order[this.data[i]] = i;
    }
  }
});

Example render order component:

```js
AFRAME.registerComponent('render-order', {
  schema: {type: 'string'},

  init: function () {
    this.set = this.set.bind(this);
    this.el.addEventListener('object3dset', evt => {
      evt.detail.object.traverse(this.set);
    });
  },

  update: function () {
    this.el.object3D.traverse(this.set);
  },

  set: function (node) {
    // String (named order).
    if (isNaN(this.data)) {
      node.renderOrder = this.system.order[this.data];
    } else {
      node.renderOrder = parseFloat(this.data);
    }
  }
});
<a-scene render-order="background, menu, menutext">
  <a-entity render-order="menu" geometry></a-entity>
  <a-entity render-order="menutext" text></a-entity>
  <a-entity render-order="2.5"></a-entity>
</a-scene>
  • A-Frame Version:
  • Platform / Device:
  • Reproducible Code Snippet or URL:

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

No repository file or test is named. Start with the supplied render-order system and component examples, then inspect how A-Frame exposes the renderer and object3D behavior. Done means a render-order component can control text placement relative to planes and reproduces the improved result shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, web-dev
Issue type
Feature
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.