Error Outputting Splatmaps

   418   7   2
User Avatar
Member
153 posts
Joined: April 2014
Offline
We're sending a processed heightfield from H to U (via HE and PDG) and we've weighted all our layers in such a way so that they don't overlap and they are either 1 or 0.

So if the top layer has a value, then it's set to 1 and the rest are set to 0, and so on. So there is NO overlap.

We checked this to make sure it working and it is.

We then assign a terrain layer material to it via a unity_hf_terrainlayer_file attribute.



When bringing them into Unity (via PDG), all the materials get assigned BUT only one is rendered on the WHOLE terrain. It's the “layer_base” material (yellow).

This is odd because the layer (“layer_base” below) DOES NOT cover everything. We should be seeing the other layers.




We created a debug session and inside that session all layers are represented correctly, just like inside the original H project.

We get these errors in the U console.



We're not sure what the “Texture rectangle is out of bound” means.

How would we go about debugging this?

Using H 17.5 (293)

Thank you.
Edited by firefly9000 - Sept. 3, 2019 09:55:28

Attachments:
h2.png (233.3 KB)
h5.JPG (93.0 KB)
h6.JPG (27.4 KB)
h7.JPG (26.9 KB)

Winter is coming!
User Avatar
Staff
472 posts
Joined: May 2017
Offline
The error sounds like a sizing issue with one or more of the terrain layers. Could you isolate the layers and try them out one by one, if you are using different sizes?

Note that there has been quite a bit of changes to the Unity terrain generation as logged here: https://www.sidefx.com/changelog/?journal=&categories=25&body=&version=&build_0=&build_1=&show_versions=on&show_compatibility=on&items_per_page= [www.sidefx.com]
Especially 17.5.302 onwards.

If you are able to, I suggest you move up to the latest 17.5 builds to keep up improvements and fixes. It might require some changes to your HDA. But the improvements have been based on feedback that is better aligned with desired production workflows.

At the least, you can try out the latest changes in a separate empty project to see if it makes sense for you.
User Avatar
Member
153 posts
Joined: April 2014
Offline
seelan
The error sounds like a sizing issue with one or more of the terrain layers. Could you isolate the layers and try them out one by one, if you are using different sizes?

Note that there has been quite a bit of changes to the Unity terrain generation as logged here: https://www.sidefx.com/changelog/?journal=&categories=25&body=&version=&build_0=&build_1=&show_versions=on&show_compatibility=on&items_per_page= [www.sidefx.com]
Especially 17.5.302 onwards.

If you are able to, I suggest you move up to the latest 17.5 builds to keep up improvements and fixes. It might require some changes to your HDA. But the improvements have been based on feedback that is better aligned with desired production workflows.

At the least, you can try out the latest changes in a separate empty project to see if it makes sense for you.


Hello Seelan,

Thank you for the help.

We did as you suggested: Upgraded (360) and then tried to see where the problem stems from. Just to make things clear, there are absolutely no issues in H. However, in order to eliminate possible issues we removed all relative links. So the sizing is now hardcoded in at 4097 (with 1 being the resolution).



The issues is that we don't really know what problem we're looking for or how it is logged.

When you say “The error sounds like a sizing issue” do you base this on the Unity console message that says “Texture rectangle is out of bounds”?


That message pops up from our first HDA in the chain even after we've set the terrain size so there are no discrepancies (note: there weren't any discrepancies before either). I should note that the heightfield comes through just fine in U.

Could you please explain what steps to debug this. In H everything is fine and the U console doesn't give too much info. For example: not sure what those warnings are all about, what is Part with id 1 etc?

Thank you.
Edited by firefly9000 - Sept. 3, 2019 16:33:22

Attachments:
h8.JPG (21.4 KB)
h6.JPG (27.4 KB)

Winter is coming!
User Avatar
Staff
472 posts
Joined: May 2017
Offline
If you are getting this issue with the PDG workflow (using PDGAssetLink), then I suggest trying with the regular (non-PDG) path to rule out bugs with just the PDG workflow. The regular terrain generation differs from the PDG generation so it is possible for bugs (or missing features) to exist in one case, but not the other.

If you are specifying an existing TerrainLayer, I suggest trying another TerrainLayer with different size or properties. My gut feeling is that the SetAlphamaps error is a clue that not all is right in the internal terrain state. Note that since you are specifying an existing TerrainLayer, the plugin will just assign it to the TerrainData, and won't check if its compatible. Additionally, it might set some properties on the TerrainLayer if you have specified them via attributes.

Are you able to generate a TerrainLayer (via a new heightfield layer in H), and use that instead? If that works, then check that the sizes match between the existing and generated TerrainLayers.

If you can attach an HDA, I can take a look as well.
User Avatar
Member
153 posts
Joined: April 2014
Offline
seelan
If you are getting this issue with the PDG workflow (using PDGAssetLink), then I suggest trying with the regular (non-PDG) path to rule out bugs with just the PDG workflow. The regular terrain generation differs from the PDG generation so it is possible for bugs (or missing features) to exist in one case, but not the other.

If you are specifying an existing TerrainLayer, I suggest trying another TerrainLayer with different size or properties. My gut feeling is that the SetAlphamaps error is a clue that not all is right in the internal terrain state. Note that since you are specifying an existing TerrainLayer, the plugin will just assign it to the TerrainData, and won't check if its compatible. Additionally, it might set some properties on the TerrainLayer if you have specified them via attributes.

Are you able to generate a TerrainLayer (via a new heightfield layer in H), and use that instead? If that works, then check that the sizes match between the existing and generated TerrainLayers.

If you can attach an HDA, I can take a look as well.


Hello Seelan,

Thanks for the help.

So as per your advice we broke apart everything and tested it individually, NOT through PDG.

Turns out the U console error is from the very first HDA from a heightfield erode node and the layers it puts out (bedrock, debris, water etc)



So if we delete those with a blast, the error goes away BUT then we cannot process the chain later on. So the error disappears but then the texturing HDA doesn't seem to work properly with the input that's coming in that's missing those layers. (see attached initial hda - though I doubt it will be useful)

It's hard to debug this because in Houdini everything works perfectly. Even in the piped debug session.

Other things we tried: updating to HE 364.

One question that we are asking ourselves is if there is a problem with HDA's that contain both ‘regular’ geometry and heightfields?

Is there a way to get what node is problematic and a more specific error message? Read the debugging page (https://www.sidefx.com/docs/unity/_debugging.html) but again, since our problem does not show up in Houdini itself, but rather in Unity, it doesn't give us any insight.

Thanks
Edited by firefly9000 - Sept. 6, 2019 16:32:30

Attachments:
desert__dunes__1_0.hda (79.4 KB)
h6.JPG (27.4 KB)

Winter is coming!
User Avatar
Staff
472 posts
Joined: May 2017
Offline
It is odd to hear that it works over a debug session. This leads me to question whether it might be an environment or pathing issue? There shouldn't be any difference between a normal session in Unity, and one connected as a debug session. Check that the file paths are indeed as expected.

With the PDG path, each HDA generates a bgeo file which is loaded by the next HDA. Can you find out which bgeo is problematic and send that to me (over DM or via our support if you need to). This bgeo is loaded by a HEU_GeoSync script component. You can replicate the same behaviour by going into menu in Unity -> HoudiniEngine > Load Geo File and selecting the bgeo that was exported.

The reason this is hard to debug might be because it is only a Unity error when loading the data into a terrain component. You'll need to find out which layer (if any) is causing the terrain generation to fail, or any other terrain-specific data you are providing. You can also send me the generated terrain as a prefab exported as an Unity asset and I can take a look.
User Avatar
Staff
472 posts
Joined: May 2017
Offline
Hi, could you please test with tomorrow's build (17.5.381)? I fixed another similar error when calling TerrainData.SetAlphamaps in this build.
User Avatar
Member
27 posts
Joined: March 2015
Offline
Hi,

It looks like a splatmap resolution issue. In Unity, Splatmaps max resolution is 2048, so if your heightfield and all layers coming with it are 4097, then Unity will complain.

You need to make sure to resize your splatmaps in a (16, 2048) range, so in your case you can add a Volume Resample and set the resolution to 2048 for example on all layers except the height layer.



I hope it helps!

Alex

Attachments:
Splatmap_Resample.png (51.7 KB)

  • Quick Links