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

MMDLoader: set material type to 'MMDToonMaterial' #25117

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

WestLangley
Copy link
Collaborator

...as we do elsewhere to provide a unique name to the ShaderMaterial.

@WestLangley WestLangley added this to the r148 milestone Dec 12, 2022
@WestLangley
Copy link
Collaborator Author

@takahirox Is it intended that MMDToonMaterial supports environment maps?

I am trying to determine if the env map shader chunks are necessary...

@takahirox
Copy link
Collaborator

takahirox commented Dec 12, 2022

@takahirox Is it intended that MMDToonMaterial supports environment maps?

Yes, it is intentional. MMD material needs envmap.

https://sites.google.com/site/mikumikubeat/tutorials/pmdedit/05

@WestLangley
Copy link
Collaborator Author

Do we need an example?

@takahirox
Copy link
Collaborator

Hm, not really.

@WestLangley
Copy link
Collaborator Author

I thought matcaps were used for the environment and material.envMap is never set...

@takahirox
Copy link
Collaborator

takahirox commented Dec 12, 2022

Ah I had forgotten matcap. MMD envmap might be able to be rewritten with matcap.

Update: Already part of them has be rewritten

params.matcap = this._loadTexture(
data.textures[ material.envTextureIndex ],
textures
);
// Same as color map above, keep file name in userData for further usage.
params.userData.MMD.matcapFileName = data.textures[ material.envTextureIndex ];
params.matcapCombine = material.envFlag === 1
? MultiplyOperation
: AddOperation;

But other part seems to be overlooked.

if ( material.fileName ) {
const fileName = material.fileName;
const fileNames = fileName.split( '*' );
// fileNames[ 0 ]: mapFileName
// fileNames[ 1 ]: envMapFileName( optional )
params.map = this._loadTexture( fileNames[ 0 ], textures );
if ( fileNames.length > 1 ) {
const extension = fileNames[ 1 ].slice( - 4 ).toLowerCase();
params.envMap = this._loadTexture(
fileNames[ 1 ],
textures
);
params.combine = extension === '.sph'
? MultiplyOperation
: AddOperation;
}

Perhaps we can remove the envmap chunk from MMD material if we rewrite the latter one.

@WestLangley
Copy link
Collaborator Author

But other part seems to be overlooked.

OK, good. I thought something didn't seem right...

I was expecting to be able to remove the envMap_* shader chunks from MMDToonMaterial. I'd be grateful if you would be willing to have a look.

@Mugen87 Mugen87 merged commit 780bb1b into mrdoob:dev Dec 12, 2022
@WestLangley WestLangley deleted the dev-mmd_toon branch December 12, 2022 15:38
@0b5vr 0b5vr mentioned this pull request Dec 23, 2022
10 tasks
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.

None yet

3 participants