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

RayPortalMaterialData: Use albedo texture as portal mask #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xoxor4d
Copy link
Contributor

@xoxor4d xoxor4d commented Oct 28, 2024

This small change allows the usage of the albedo texture to define the rayportal shape when creating a rayportal material via the remixApi.

Background:
The shape of the portal gets estimated if MaskTexture2 is unset.
This results in a perfect circle but that might not always be the desired shape.
In case of portal 2, I actually need square portals for room/area connecting portals that are placed within sliding doors or similar.
Using a blank white texture results in just that. Not setting an albedo means that the portal shape will be estimated just like before.

Note:
I think it might be beneficial to expose that setting to usd/toolkit. From what I can tell it's already hooked up in code .. just unused:

#define LIST_PORTAL_MATERIAL_TEXTURES(X) \
  /*Parameter Name, USD Token String,       Type,       UNUSED...   Default Value */ \
  X(MaskTexture,    emissive_mask_texture,  TextureRef, void, void, {}) \
  X(MaskTexture2,   unused_in_usd_so_dont,  TextureRef, void, void, {})

trackTexture(ctx, rayPortalMaterialData.getMaskTexture2(), maskTextureIndex2, hasTexcoords, false);

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.

1 participant