question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect plane slice with non uniform scale

See original GitHub issue

If the object is not scaled in a uniform way (e.g scaleX, scaleY, and scaleZ are different) then the slicing is not correct.

How to reproduce:

  1. Open SliceDebugScene from https://github.com/DavidArayan/EzySlice-Example-Scenes
  2. Change scale of ObjectToSlice in the editor from (10, 10, 10) to (10, 50, 10) for example
  3. Set the SlicerPlane field and click Cut Object
  4. Inspect the resulting objects (Lower_Hull and Upper_Hull)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
DavidArayancommented, Oct 20, 2019

In order to solve this issue the cut will need to happen in world space. This means transforming all vertices into world space, performing the cut operation and transforming the resulting points back into object space. This results in a fairly heavy computation cost so instead of “fixing” the current method, i’d probably add in an option to slice non uniform scaled objects separately at the cost of additional computation/time.

My apologies for not communicating this sooner. At the moment i’m slowly investigating moving the slicer into Unity Job System that would allow slices to be performing drastically faster. The new redesign would allow me to fix lingering issues such as these much easier.

1reaction
DavidArayancommented, Feb 2, 2021

Hello,

As of the latest commit b98da2a this issue should be resolved and can finally be closed. I’ve modified the SlicerExtensions.cs code so the Plane direction vector is properly transformed into the object local space before slicing.

Unfortunately this also means that the old method of using Transform.InverseTransformDirection or Transform.InverseTransformVector are incorrect. Unity should be using the Transpose Inverse Matrix to transform direction vectors for correct results. Maybe this is something that can be brought up with the Unity3D engineering team directly as a bug report. As a work around, i’m transposing and inverting the matrix manually for the correct results.

I will now close this issue. Thanks everyone!

Edit: See correct results after cutting a non-uniformly scaled object from following screenshot.

Screen Shot 2021-02-02 at 5 11 28 pm
Read more comments on GitHub >

github_iconTop Results From Across the Web

Non-Uniform Scaling during UV unwrap. What is this?
1 Answer. It's because your object has been scaled on some axes more than others in object mode. It should be fine, but...
Read more >
Fix "Object has non-uniform scale, sculpting may be ...
An easier fix for that issue, is in Object Mode, press Ctrl+A and and choose Scale (the equivalent of using Object>Apply>Scale). Upvote 9...
Read more >
UV Unwrap in Blender - How to Fix the Non-Uniform Error ...
In this demo, I show my class how to fix objects that unwrap badlyand throw the " Non -Unifor" error. This simple fix...
Read more >
Scaling along an arbitrary axis (Dealing with non-uniform ...
The problem happens whenever I try to rotate this scaled box. The shape itself becomes distorted and it appears as though the Scale...
Read more >
FPS drops when scale object. How fix? Unity Android
The problem may be due to the fact that more pixels is rendered (fragment shader is executed for every one) when the object...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found