Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi Everyone,
Good Morning,
Can anyone help me out in how to use inbuilt planar cut and flow shader which has been recently introduce in Vuforia Studio 9.25.6.0.
Thanks in advance.
Regards,
Aditya Gupta
From "Help Center":
Hi @VladimirN ,
Thank you for your response.
I tried but was not able to deploy the planar cut, I am not aware how to bring the plane as shown in the below video link.
Also, had one more doubt does the flow shader requires uv mapped cad model?
Thnaks & Best Regards,
Aditya Gupta
Hi @Aditya1702 ,
regarding your question for the planer shader according to https://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2FModelShaders.html
-> required is the center of the cut plane and a normal vector which defines the direction /normal to the cut plane.
Example of js code which will set at begin the shader and then on change of the slider will move the position of the plane e.g along x:
$scope.init = function() {
$scope.app.planarCutModel=$scope.view.wdg['model-1'];
$scope.app.planar_cut_str = 'planar_cut; clipCenterX f '+$scope.app.params.clipCenterX+
'; clipCenterY f ' +$scope.app.params.clipCenterY+
'; clipCenterZ f ' +$scope.app.params.clipCenterZ+
'; clipAxisX f '+$scope.app.params.clipAxisX+
'; clipAxisY f '+$scope.app.params.clipAxisY+
'; clipAxisZ f '+$scope.app.params.clipAxisZ+
'; clipLineWidth f '+$scope.app.params.clipLineWidth+';';
$scope.app.planarCutModel.shader = $scope.app.planar_cut_str;
$scope.$applyAsync();
};
angular.element(window.document.body).ready($scope.init);
//===========================
$scope.app.updateShaders=()=>{
$scope.app.planar_cut_str = 'planar_cut; clipCenterX f '+$scope.app.params.clipCenterX+
'; clipCenterY f ' +$scope.app.params.clipCenterY+
'; clipCenterZ f ' +$scope.app.params.clipCenterZ+
'; clipAxisX f '+$scope.app.params.clipAxisX+
'; clipAxisY f '+$scope.app.params.clipAxisY+
'; clipAxisZ f '+$scope.app.params.clipAxisZ+
'; clipLineWidth f '+$scope.app.params.clipLineWidth+';';
$scope.app.planarCutModel.shader = $scope.app.planar_cut_str;
$scope.$applyAsync();
}
here I used parameter which I could bind to the widget value - e.g. the clipCenerX with the slider 2d widget. There to fit the value some filter in the slider binding like that:
So the clipLineWith is the with of the white clipLine
So far I know it does not require UV mapping. Mostly shaders which use a texture will require such UV mapping to map the texture correctly . Here it calculates only the values of the cut surface.
sample project attached