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

Clipping primitive; two ClippingBoxes at the same time #385

Open
DreVinciCode opened this issue Jul 22, 2021 · 4 comments
Open

Clipping primitive; two ClippingBoxes at the same time #385

DreVinciCode opened this issue Jul 22, 2021 · 4 comments

Comments

@DreVinciCode
Copy link

DreVinciCode commented Jul 22, 2021

Hello,

I tried following these instructions to add a second ClippingBox to a renderer. I had some of issues that came up:

  1. The MonoBehaviour script SecondClippingBox does not reference the variable clipBoxSizeID, and the script requires including the namespace Microsoft.MixedReality.Toolkit.Utilities. I commented out the clipBoxSizeID and included the namespace to the script.

  2. Modifying the MRTK/Core/StandardAssets/Shaders/MixedRealityStandard.shader in step 5 for #if defined(_CLIPPING_BOX2). I changed the code to include variables clipBoxSide2 and clipBoxInverseTransform2 to match the format of #if defined(_CLIPPING_BOX). I also removed the argument _ClipBoxSize2.xyz from PointVsBox().

Making these changes worked for me :) I included some screenshots.
SecondClippingBox
_Clipping_Box2
TwoClippingBoxes


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@typride
Copy link
Collaborator

typride commented Nov 16, 2022

@qianw211 assigning to you as you were listed as a contributor. Feel free to close or remedy based on your opinion.

@keveleigh
Copy link
Contributor

@Cameron-Micka, any insight?

@Cameron-Micka
Copy link
Contributor

@keveleigh ah yes, we need to update these docs to reflect some PRs that have gone in over the years. (I think this bugcalls this out too.)

I did recently update the steps in MRTK3, so they should be correct: https://learn.microsoft.com/en-us/windows/mixed-reality/mrtk-unity/mrtk3-graphicstools/features/clipping-primitive#advanced-usage

@Ruiyang19
Copy link

Ruiyang19 commented Jun 15, 2023

@DreVinciCode Hi, I also have a problem following the instruction. I looked into your screenshot, but still the second box is not clipping my model.

I wonder what is wrong and here are the codes I changed according to the instruction and your answer.

Step 1:

Step 2:

Step 3:

Step 4:

Step 5:

Finally, here are the clipping boxes in the scene.

Weixin Image_20230615142232
Weixin Image_20230615142311

I am using MRTK 2 and created a new material with the altered standard shader. I would really appreciate it if someone can have a look at my settings. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants