Itoo Software Forum

Author Topic: Some Surfaces Getting Skipped  (Read 1005 times)

Shawn Olson

  • Jr. Member
  • **
  • Posts: 75
  • Wall Worm
    • Wall Worm
Some Surfaces Getting Skipped
« on: May 03, 2017, 04:05:40 PM »
My co-worker came to me this week with a problem where a forest was skipping some specific Surface Nodes in a forest. After investigating and isolating the problem, I could not find a solution.

I've attached a sample scene that includes one forest node and two Surface nodes in the Forest surface area. In the example scene, trees spawn on $WW_Displacement_009 but will not spawn on $WW_Displacement_200 . In the scene this is happening, there were dozens of working surfaces and 5 surfaces not working, and I could not find a reason for the missing surfaces. Note that UV mode works, but we are using XY for this specific scenario as we need to be able to paint exclusion areas.

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1547
Re: Some Surfaces Getting Skipped
« Reply #1 on: May 03, 2017, 04:53:14 PM »
Hi Shawn,

From the scene itself it's not clear how that issue arose, but in similar cases Reset XForm - Reset Selected > Convert to Editable Poly applied on used surface (to "reset" its local coordinates) fixes it. Attaching modified scene.

Generally, if you are using an imported surface, usually it's handy to apply the Reset XForm utility on it to "reset" it's local coordinates before creating the Forest object creation.

When using a surface to always check it's coordinates (your surface coordinates should correspond with intended Forest object orientation). For example a plane created in Front view will work differently with Forest objects as another one created in Perspective / Top view. Please feel free to check our "Scattering on Vertical Surfaces" tutorial, where you can find several useful tips regarding this topic.

Best regards,

Shawn Olson

  • Jr. Member
  • **
  • Posts: 75
  • Wall Worm
    • Wall Worm
Re: Some Surfaces Getting Skipped
« Reply #2 on: May 04, 2017, 12:22:07 AM »
Thanks for the hint and info. There must have been a problem in the original scene because using Reset XForm was one of the first things I tried, but there was no result in the original scene. However, in this separate scene, reset xform did work. (I hadn't tested that once I created this simple file as it had failed in original scene).

So at least I know I wasn't going crazy. Now to find out why the original scene failed to be fixed with that.

Shawn Olson

  • Jr. Member
  • **
  • Posts: 75
  • Wall Worm
    • Wall Worm
Re: Some Surfaces Getting Skipped
« Reply #3 on: May 10, 2017, 03:41:59 PM »
SO I wanted to return to this topic because we are still running into some issues with this specific case. We have a large surface that is composed of hundreds of smaller surfaces. These surfaces often are not aligned with the Forest node, which is the initial problem. However, have found that using Reset XForm does not actually fix the problem in all cases. It fixed the simple scene I sent, but when I apply these steps to multiple objects at a time, it just fails.

Would it be possible to add a new option that internally enforces the surfaces to work as if they were aligned to the forest node?

Shawn Olson

  • Jr. Member
  • **
  • Posts: 75
  • Wall Worm
    • Wall Worm
Re: Some Surfaces Getting Skipped
« Reply #4 on: May 12, 2017, 04:30:46 PM »
Just to shed some new light on why I would like a Forest option to ignore node transformations and just use the Forest transform on the surfaces:

ResetXForm has a bug. Notice this results from MAScript Listerner tests:

Code: [Select]
for obj in selection do (resetXForm obj; convertToPoly obj; format "%\n" obj.transform)

(matrix3 [0,1,0] [0,0,1] [1,0,0] [-512,-256,-192])
(matrix3 [1,0,0] [0,-1.62921e-007,-1] [0,1,-1.62921e-007] [-256,-1024,-192])
(matrix3 [0,1,0] [0,0,1] [1,0,0] [-512,256,-192])
(matrix3 [0,1,0] [-1,0,0] [0,0,1] [-256,-768,-256])
(matrix3 [0,1,0] [-1,0,0] [0,0,1] [-768,-768,-128])
(matrix3 [0,1,0] [0,0,1] [1,0,0] [-512,-768,-192])
(matrix3 [0,1,0] [-1,0,0] [0,0,1] [384,-768,-256])
(matrix3 [0,1,0] [-1,0,0] [0,0,1] [-768,-256,-128])
(matrix3 [0,1,0] [-1,0,0] [0,0,1] [-712,-1160,-128])
(matrix3 [0,1,0] [-1,0,0] [0,0,1] [-256,-256,-256])
(matrix3 [1,0,0] [0,0,1] [0,-1,0] [384,-512,-192])
(matrix3 [-1,0,3.49691e-007] [-3.49691e-007,1.62921e-007,-1] [0,-1,-1.62921e-007] [-256,512,-192])
(matrix3 [0,1,0] [1.62921e-007,0,-1] [-1,0,-1.62921e-007] [768,-768,-192])
(matrix3 [0,1,0] [-1,0,0] [0,0,1] [-768,256,-128])
(matrix3 [1,0,0] [0,-1.62921e-007,-1] [0,1,-1.62921e-007] [384,-1024,-192])
Any of the nodes that resetXForm generates tiny values for will cause Forest to fail using it as a surface. And you can see that ResetXFrom failed.

GM6800

  • Newbie
  • *
  • Posts: 1
Re: Some Surfaces Getting Skipped
« Reply #5 on: May 12, 2017, 04:33:29 PM »
I am also experiencing this bug, where I can't use XY mode to exclude areas due to displacement conversion errors.

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1547
Re: Some Surfaces Getting Skipped
« Reply #6 on: May 17, 2017, 10:43:33 AM »
Hi,

Big thanks for all further feedback. We've been looking into this issue and another possible option to avoid similar troubles might be to export problematic surface as .obj (without affecting the Z-axis as on attached screen-shot) and importing it back, which will reset its coordinates too. Hope that helps.

Best regards,
« Last Edit: May 17, 2017, 10:46:34 AM by Michal Karmazín »

Shawn Olson

  • Jr. Member
  • **
  • Posts: 75
  • Wall Worm
    • Wall Worm
Re: Some Surfaces Getting Skipped
« Reply #7 on: May 17, 2017, 03:03:54 PM »
Thanks for the info Michal.

There are two challenges for me on this.

First is that the objects in question are part of larger constructs with a bunch of data bound to custom attributes and event handlers to deal with them. This means that export/import would be very laborious and take testing to make sure it doesn't break the data. So I'd consider this a last resort since this is going to be a problem in many scenes that sometimes have a few thousand objects that could be involved.

The second is that the script Autodesk provided (mentioned in my private email) isn't working 100% as expected. I've tested it on larger scenes with the Forest Surfaces and the transforms are still not all reset correctly (and Forest continues to ignore them with XY mode). I will continue to dig into that and see if AD can help with a solution to why the script might fail.

For my end, if Forest just had a checkbox to enforce the Forest transform--it would magically make this problem go away :)
« Last Edit: May 17, 2017, 05:28:21 PM by Shawn Olson »

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3319
    • iToo Software
Re: Some Surfaces Getting Skipped
« Reply #8 on: May 18, 2017, 09:08:05 AM »
For my end, if Forest just had a checkbox to enforce the Forest transform--it would magically make this problem go away :)

Sorry, but i don't understand what do you mean about to use the Forest transform. That is what it does actually: the surface is transformed to the local coordinates of the Forest object.
But in Max each node have several transformation matrices, not only one (node local, object offset, parent, modifiers, world modifiers, etc).

In this case, may be is something wrong with the calculation of the final transform, or the problem is in something else, i don't know.
We logged this issue in our to-do list, to check it with more time. Meanwhile, i'm afraid only the workarounds suggested above can help.

Carlos Quintero
iToo Software

Shawn Olson

  • Jr. Member
  • **
  • Posts: 75
  • Wall Worm
    • Wall Worm
Re: Some Surfaces Getting Skipped
« Reply #9 on: May 18, 2017, 04:15:05 PM »
Sorry, but i don't understand what do you mean about to use the Forest transform. That is what it does actually: the surface is transformed to the local coordinates of the Forest object.
But in Max each node have several transformation matrices, not only one (node local, object offset, parent, modifiers, world modifiers, etc).

Sorry if I did not explain it better. I had always assumed that any faces on an object facing in the direction of the Forest's Z axis would automatically work with Forest in XY mode. But it's apparent now that if an object's transform isn't aligned in specific ways, this isn't the case. What I meant was to use a transformation matrix for each surface node that will cancel out any transformations so that it's transforms are essentially irrelevant and all expected faces will be used regardless of node transform.

We logged this issue in our to-do list, to check it with more time. Meanwhile, i'm afraid only the workarounds suggested above can help.
Thanks for the info.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3319
    • iToo Software
Re: Some Surfaces Getting Skipped
« Reply #10 on: May 18, 2017, 05:07:57 PM »
Sorry if I did not explain it better. I had always assumed that any faces on an object facing in the direction of the Forest's Z axis would automatically work with Forest in XY mode. But it's apparent now that if an object's transform isn't aligned in specific ways, this isn't the case. What I meant was to use a transformation matrix for each surface node that will cancel out any transformations so that it's transforms are essentially irrelevant and all expected faces will be used regardless of node transform.

Not exactly. What you see in the viewport is the surface in world coordinates, once applied all its transformations.
But internally the original mesh without transform may be scaled, moved, flipped or in any other state respect to the scene and Forest.

What Forest does is to apply all surface transformations to get a mesh in world coordinates, and then this is transformed to the local Forest axis (lets say that everything must be in a same coordinates system before using it).
So, really both Forest and Reset XForm does what you expect: they convert the surface to world coordinates and remove all transformations.

Checking all posts again, i see the problem would not be in the Reset XForm but in something else (may be normals ?).
Because although some transform values are not zero, those infinitesimal values should not cause problems with Forest (-1.62921e-007 is esentially zero).

If possible, please try to reproduce the problem in a stripped scene and send it to us (i mean surfaces that Reset XForm cannot fix). Hopefully we can find what it's happening exactly.

Thanks,
Carlos Quintero
iToo Software

Shawn Olson

  • Jr. Member
  • **
  • Posts: 75
  • Wall Worm
    • Wall Worm
Re: Some Surfaces Getting Skipped
« Reply #11 on: May 20, 2017, 05:54:36 AM »
Thanks.

I will send you files this weekend or early next week. What I do know is this: the problem manifests in many nodes that were created, initially, with transforms derived from the surface normal of other nodes. For example, if I take a mesh and create an exploded mesh of it's surface polygons where each polygon has a transformation aligned from the normal of the original mesh. I will send the exact formula for generating that with samples. Many of those nodes will both fail to work with Forest AND will have problems having their transforms aligned to the world with Max's Reset Xform.

This is potentially a deeper bug in Max itself than in just Forest because in some tests, simply saving a scene and re-opening seems to fix some of the nodes to work in Forest. Some of my tests showed that using reset Xform transformations recorded after running did not match the same node transforms after re-opening the scene. How that is all related to the Forest issue isn't clear, but I'm sure there is a link.

EDIT: And to answer your specific question, the normal direction isn't the issue here. It was one of the things I tested originally with this issue along with Reset XForm.
« Last Edit: May 20, 2017, 05:56:35 AM by Shawn Olson »