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

Optimize Outline rendering of MMD #9472

Merged
merged 2 commits into from
Aug 19, 2016

Conversation

takahirox
Copy link
Collaborator

In outline rendering pass, I set visible = false for the objects not to be needed rendering outline
like the stage of webgl_loader_mmd_audio example.

@mrdoob
Copy link
Owner

mrdoob commented Aug 8, 2016

Have you considered using Object3D's layer?

@takahirox
Copy link
Collaborator Author

Not yet.
Should I use layers rather than set/restore visible for the good design or smt?

@mrdoob
Copy link
Owner

mrdoob commented Aug 9, 2016

Yes. I haven't looked at it in detail, but usually these visible hacks can be done with layers instead.

@takahirox
Copy link
Collaborator Author

I see, I'll try with layers.

@takahirox
Copy link
Collaborator Author

Updated.

I'm feeling like I want the following functions
(the names should be renamed with the appropriate ones tho)
in Layers

enable2: function ( layers ) {

    this.mask |= layers.mask;

},

disable2: function ( layers ) {

    this.mask &= ~ layers.mask;

},

@mrdoob
Copy link
Owner

mrdoob commented Aug 17, 2016

What are those functions for?

@takahirox
Copy link
Collaborator Author

For example, to hide some objects from a certain camera like I do in this change.

To do that with the current enable/disable(), the code would be

object.layers.disable( camera.layers.mask >> 1 )

But it isn't straightforward.

var tmpEnabled = this.renderer.shadowMap.enabled;
this.renderer.shadowMap.enabled = false;
var invisibledObjects = [];
var setInvisible;
Copy link
Owner

Choose a reason for hiding this comment

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

Why don't you directly create the setVisible and restoreVisible functions here?

Copy link
Collaborator Author

@takahirox takahirox Aug 17, 2016

Choose a reason for hiding this comment

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

Because I couldn't point MMDHelper by using this here.
And to use camera passed to this method.

Copy link
Owner

Choose a reason for hiding this comment

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

setInvisible( this, object )? 😊

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

callback function for traverse doesn't accept any arguments except for object :(

Copy link
Owner

Choose a reason for hiding this comment

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

I see I see!

@mrdoob mrdoob merged commit 501f2da into mrdoob:dev Aug 19, 2016
@mrdoob
Copy link
Owner

mrdoob commented Aug 19, 2016

Thanks!

@takahirox takahirox deleted the MMDLoaderOutlineOptimization branch August 19, 2016 02:56
aardgoose pushed a commit to aardgoose/three.js that referenced this pull request Oct 7, 2016
* Optimize Outline rendering of MMD

* Use Layers instead of visible for MMDHelper.renderOutline() optimization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants