Topic: How to work with the Custom Intercept?

I've setup a custom intercept and my my delegate is being called. For example, I have a a height resolution of 4047 so I'm getting called 4097x4097 times. My code has height data for 5000m x 5000m so that roughly makes each height position represent a 1.2m square. So I essentially ignore the mx, my and just return the array item based on the ordinal position of the delta of mx or my
To summarize my code it's almost just;
private double? OnGetElevation(double mx, double my)
{
   if (mx.HasChanged) x++
   if (my.HasChanged) y++
   return data[x,y]
}

However, after the 'Start' has completed the terrain heights are only applied to something like 1 quarter of the terrain tile. The heights look correct, i.e. the ground features look correct, but I don't understand why the heights are not being evenly spread over the terrain tile.

Re: How to work with the Custom Intercept?

Hello.

It's hard to tell what is wrong in your case.
Here it is necessary to test what is happening in your script.

I made a simple test script and when Heightmap Resolution is 513, OnGetElevation is called 263169 (513 * 513) times.

If you want, you can send me the complete script + your data, I will try to debug it.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by paulio 2020-11-24 11:11:02)

Re: How to work with the Custom Intercept?

Thanks, see attached zip and readme
https://clearbreezeconsulting-my.sharep … A?e=vgmZgd

Re: How to work with the Custom Intercept?

I tested your code and data and what I see is:
Your code is working correctly.
But your data is pretty weird.
Lines 2-2001 are empty. This is why you have 1/3 of an empty area on Z axis.
Also, the boundaries of your area do not match the boundaries of the data.
See screenshots.

To fix this, you need to do three things:
1. Find data boundaries for which you have values (cut out blank lines).
2. Select the area of generation within the area for which you have values.
3. Find the correct shifts and coefficients to transform the areas.

Post's attachments

Attachment icon img1.png 1.48 mb, 75 downloads since 2020-11-25 

Attachment icon img2.png 1.39 mb, 67 downloads since 2020-11-25 

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by paulio 2020-11-25 14:16:46)

Re: How to work with the Custom Intercept?

Thanks, yes I did spot the data error after I posted. But thanks again for the testing it, I really appreciate it.
The problem was the LIDAR provider I'm using sent me the 5km x 5km data for the specific coords, however what I failed to notice was that when they don't have any LIDAR data for a 1km x 1km tile rather than send a file without any values they just omit the file completely. I.e. I'm expected 25 files (5x5) but they only sent 21 files. Hence my code was off and it caused the strange effects. I've now written some code to create the missing files and the result looks great smile