I have a height map on disk, I loaded it with “HeightField File” node. I set the scale of the height field to 10. I then use “Convert HeightField” with default values and the edges do not line up. The height field clearly goes exactly 5 units out in each direction and lies precisely on a grid line when viewed from the top. When you see the converted height field there is an offset from that edge. In small scenes this isn't bad, but when you are using larger unites 100s of thousands the offset becomes quite large. Is this because the sampling is on voxel centers?
Thoughts? Suggestions for a workaround?
Houdini 16.0.562
Convert HeightField not matching heightfield
4249 6 0- scaron
- Member
- 6 posts
- Joined: March 2014
- Offline
- jlait
- Staff
- 6413 posts
- Joined: July 2005
- Offline
- scaron
- Member
- 6 posts
- Joined: March 2014
- Offline
So shared points on the grid blend samples from at most 4 voxels? In the case of an interior grid point that is.
For me I ended up redoing all the work I had done previously in Houdini's terrain tools because I couldn't work out the way to get the one tile I wanted to do in Houdini to line up with the other tiles done in other programs. BUT even within a pure Houdini terrain workflow, I am still struggling to have a cropped section being up res'd and still lining up with neighboring pieces. For now I am just exporting the high res Houdini terrain as a displacement map and using that to displace a mesh which was generated from converting the whole terrain to a mesh, cutting out the piece I need, and making new uvs for it.
For me I ended up redoing all the work I had done previously in Houdini's terrain tools because I couldn't work out the way to get the one tile I wanted to do in Houdini to line up with the other tiles done in other programs. BUT even within a pure Houdini terrain workflow, I am still struggling to have a cropped section being up res'd and still lining up with neighboring pieces. For now I am just exporting the high res Houdini terrain as a displacement map and using that to displace a mesh which was generated from converting the whole terrain to a mesh, cutting out the piece I need, and making new uvs for it.
Edited by scaron - Aug. 8, 2017 01:55:36
- jlait
- Staff
- 6413 posts
- Joined: July 2005
- Offline
The convert height field, which generates the polygonal mesh, should be what gives the real location of your heightfield samples.
As such, if you import a displacement map you want placed on corners, not on centers, you will have to scale up the height field from file size by one voxel spacing. This will cause the GL visualization to go a bit far, but the convert heightfield should match. This also means the saved texture will have a correspondence that you expect.
As such, if you import a displacement map you want placed on corners, not on centers, you will have to scale up the height field from file size by one voxel spacing. This will cause the GL visualization to go a bit far, but the convert heightfield should match. This also means the saved texture will have a correspondence that you expect.
- scaron
- Member
- 6 posts
- Joined: March 2014
- Offline
I am not sure the best way to do this… scale using the heightfield file node's uniforum scale parameter or a transform node? Also, when you say voxel spacing do mean scale up by a world space size of a voxel? ex. 1024x1024 disp map, with a size of 100 (size method = size of largest axis) a single voxel is ~0.0977 units in world space. scale up by that much then?
Some what related, but how about a tile split has voxel padding option built. Would it make sense to build in a voxel pad when loading heightfield files from other programs?
Thanks for your help!
Some what related, but how about a tile split has voxel padding option built. Would it make sense to build in a voxel pad when loading heightfield files from other programs?
Thanks for your help!
- jlait
- Staff
- 6413 posts
- Joined: July 2005
- Offline
Best to figure out the math with small numbers where the discrepancies are obvious.
If you have a 10x10 texture you want to fit in a 30x30 square, if you set the size to “30” you'll get a voxel size of 3. This seems obvious, but only is such because we store samples in the center.
If you do a height field convert you'll see it generate a 27x27 grid. This is because there are 10x10 points each 3 units apart, but due to the “fence-post problem” you have only 9 spans between points on each side, so only 27 total distance.
To get the points to be 30x30 you need a grid-spacing of
30 / 9
not
30 / 10
So you want to scale the size by (30 / 9) / (30 / 10)
Note the 30's cancel out, leaving 10/9 as the scale. Putting 10/9 in the uniform scale of the heighfield node will thus get the right result.
In the case of heightfield file, please note uniform scale *also* scales the y-axis, so you don't want to do that there. Multiply the size by the conversion factor.
So, in your case the ratio for 1024 is 1024/1023. Change the size to
100 * (1024 / 1023)
then do a heightfield convert. MMB the node and the points should give you a size of 100xYYx100
If you have a 10x10 texture you want to fit in a 30x30 square, if you set the size to “30” you'll get a voxel size of 3. This seems obvious, but only is such because we store samples in the center.
If you do a height field convert you'll see it generate a 27x27 grid. This is because there are 10x10 points each 3 units apart, but due to the “fence-post problem” you have only 9 spans between points on each side, so only 27 total distance.
To get the points to be 30x30 you need a grid-spacing of
30 / 9
not
30 / 10
So you want to scale the size by (30 / 9) / (30 / 10)
Note the 30's cancel out, leaving 10/9 as the scale. Putting 10/9 in the uniform scale of the heighfield node will thus get the right result.
In the case of heightfield file, please note uniform scale *also* scales the y-axis, so you don't want to do that there. Multiply the size by the conversion factor.
So, in your case the ratio for 1024 is 1024/1023. Change the size to
100 * (1024 / 1023)
then do a heightfield convert. MMB the node and the points should give you a size of 100xYYx100
- scaron
- Member
- 6 posts
- Joined: March 2014
- Offline
-
- Quick Links