Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

antialias by default on desktop too #2455

Merged
merged 1 commit into from
May 11, 2017
Merged

antialias by default on desktop too #2455

merged 1 commit into from
May 11, 2017

Conversation

ngokevin
Copy link
Member

@ngokevin ngokevin commented Mar 4, 2017

Description:

Anti-aliasing is desirable for VR. If we're targeting room scale, enabling it makes sense as the default.

@@ -344,10 +344,10 @@ module.exports = registerElement('a-scene', {
var canvas = this.canvas;
// Set at startup. To enable/disable antialias
// at runttime we would have to recreate the whole context
var antialias = this.getAttribute('antialias') === 'true';
var antialias = this.getAttribute('antialias') !== 'false';
Copy link
Member

Choose a reason for hiding this comment

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

We can enable antialias by default only on desktop

@ngokevin
Copy link
Member Author

Updated, with tests. Logic is (explicitly enabled or disabled) or (has native webvr or is not mobile)

@ngokevin ngokevin added this to the 0.6.0 milestone Mar 30, 2017
@ngokevin
Copy link
Member Author

@dmarcos r?

*/
function shouldAntiAlias (sceneEl) {
// Explicitly set.
if (sceneEl.getAttribute('antialias') === 'true') { return true; }
Copy link
Member

@dmarcos dmarcos Apr 12, 2017

Choose a reason for hiding this comment

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

Can we do

 if (sceneEl.getAttribute('antialias') !== null) { return sceneEl.getAttribute('antialias') === 'true'; }

if (sceneEl.getAttribute('antialias') === 'false') { return false; }

// Has WebVR or is desktop.
return window.hasNativeWebVRImplementation || !sceneEl.isMobile;
Copy link
Contributor

Choose a reason for hiding this comment

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

this will match Daydream, FYI

Copy link
Contributor

Choose a reason for hiding this comment

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

this okay?

canvas: canvas,
antialias: antialias || window.hasNativeWebVRImplementation,
canvas: this.canvas,
antialias: shouldAntiAlias(this),
Copy link
Contributor

Choose a reason for hiding this comment

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

could this instead by exposed as an antialias component on <a-scene>? that way folks can force enable/disable it if they want.

Copy link
Member

Choose a reason for hiding this comment

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

antialias cannot be disabled once the context has been created. You would have to create a new one and resubmit all textures and buffers (http://stackoverflow.com/questions/27554969/dynamically-turn-on-off-antialiasing-and-shadows-in-webglrenderer).

Copy link
Member Author

Choose a reason for hiding this comment

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

There's a code quality issue to make a renderer component to be configurable, antialias would be part of that.

Copy link
Member

Choose a reason for hiding this comment

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

I still don't think it's could be modifiable at runtime. You would invalidate all the components that have submitted textures / buffers to the GPU.

Copy link
Member

Choose a reason for hiding this comment

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

I pretty elaborated machinery could be implemented to make antialias dynamic but that's something you don't want to do in 99.9999999% of the cases. We can revisit in the future if there's a very good reason

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I agree, it cannot be configurable at runtime. I just mean configurable at init time.


/**
* Determines if renderer anti-aliasing should be enabled.
* Enabled by default if has native WebVR or is desktop.
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be mentioned in the Docs? (especially if you go the antialias component route)

@dmarcos
Copy link
Member

dmarcos commented May 11, 2017

Thanks!

@dmarcos dmarcos merged commit 1476fda into aframevr:master May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants