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

Various issues with transparent materials #361

Open
AlexECX opened this issue Aug 30, 2024 · 6 comments
Open

Various issues with transparent materials #361

AlexECX opened this issue Aug 30, 2024 · 6 comments

Comments

@AlexECX
Copy link

AlexECX commented Aug 30, 2024

Describe the bug

1. Transparent material with Alpha=1 in PMX, but isn't loaded as transparent in DanceXR

This one is not too bad to workaround, but it would be nice if it worked without tweaks.

These glasses are set to opaque in PMX while still being transparent when rendered in the editor, but are opaque in DanceXR:

image

The current workaround is to set Materials->Transparent Materials to On, manually select the glasses, and set
Transparent Materials->Options->Transparent: Force Transparent.

Zip with the problematic component:
zipp.zip

Screenshots of transparency in the PMX editor:

image
image

2. Material that is transparent in PMX and loaded as transparent in DanceXR, but turns opaque right after loading

Similar to the previous case, except in DanceXR the texture is transparent during the loading animation, but quickly turns opaque right after. This usually happens with materials meant to be hidden/shown using a morph that either changes the opacity or in this case moves it into place. These materials often come with empty space/texture around them that should be transparent.

Untitled.video2.mp4

Zip with the problematic component:
stockings.zip

The current workaround is the same as for the previous case, force as transparent.

3. When 2 variation of the same clothing/material refer to the same texture, one with Alpha=1 (regular underwear) and one with Alpha=0 (the hidden variation).

image
image

Zip of the problematic files:
dual underwear.zip

This new case has 2 problems:

  • the regular underwear has an outline that should be transparent but is rendered black, workaround is to force opaque or transparent.
  • the variation creates an outline on the regular underwear that can only be solved by setting the variation to force opaque (so it can still be used later) and manually set to Alpha=0
Untitled.video3.mp4

Expected behavior
The transparent part of the materials should be transparent by default

Desktop (please complete the following information):

  • OS: Windows 11 Version 23H2 Build 22631.4317
  • DanceXR: Pro version 2024.11.1434 in desktop mode
@AlexECX
Copy link
Author

AlexECX commented Aug 31, 2024

RIP deleted my comment by accident, this will be shorter.

TLDR material that use the same texture but with diff parameters is the problem maybe?

In the case of #2 stockings, the texture is first referred to with no additional parameters (probably what is moved by the UV morph) and then referred to with additional parameters (probably to render only the foot fishnet):

image
image

In a new case #3 I'm working with 2 variation of the same clothing/material refer to the same texture, first with Alpha=1 (regular underwear) then Alpha=0 (the hidden variation).

image
image

Zip of the problematic files:
dual underwear.zip

This new case has 2 problems:

  • the regular underwear has an outline that should be transparent but is rendered black, workaround is to force opaque or transparent.
  • the variation creates an outline on the regular underwear that can only be solved by setting the variation to force opaque (so it can still be used later) and manually set to Alpha=0
Untitled.video3.mp4

@alloystorm
Copy link
Owner

Thanks for the upload we'll take a look.

For transparency, the PMX format doesn't really specify which texture is transparent, so we can only rely on the alpha value and the material name to "guess" if a material is suppose to be transparent. That's why when you set opaque to 1 it's not transparent at all. We believe MMD simply treat all materials as transparent, but we don't have that option because in unity transparent materials needs to be sorted properly to appear correct (MMD must have its own rendering technique that does some sort of auto sorting).
So currently for some models you need to manually go to the material list to change their transparency mode if the model doesn't look right.

@AlexECX
Copy link
Author

AlexECX commented Sep 3, 2024

For transparency, the PMX format doesn't really specify which texture is transparent, so we can only rely on the alpha value and the material name to "guess" if a material is suppose to be transparent.

Yes and I think for #1 having to manually change the sunglasses to an opacity lower than 1 is fair, I'm not even sure how PMXE does it internally. For #3 tho the material is set to opaque 0, but my guess is since the texture has already been refered to by a different material that is set to opaque 1 it just sets both to opaque?

@AlexECX
Copy link
Author

AlexECX commented Sep 3, 2024

For #3, I tried:

  1. Inverting the order of the materials in the PMX. It did put the alternative underwear on top but still not transparent (even with opacity 0 in PMX)
  2. Deleting the standard underwear material in the PMX. The alternative underwear is still visible with opacity 0, so it seems opacity is secondary to some other parameter.

To try and make sure there is no funny business with the cache between tests, I reset settings, unload the model, empty cache, restart DanceXR, then "Load As External"

@AlexECX
Copy link
Author

AlexECX commented Sep 5, 2024

Updated to version 2024.9

@AlexECX
Copy link
Author

AlexECX commented Nov 2, 2024

Updated to 2024.11 and added case #3 to main post.

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

No branches or pull requests

2 participants