Unity 5 Heighmap Resolution relationship to terrain width / terrain length? - unity3d

Trying to understand how they relate to the final mesh.
As I understand it,
Terrain width and length is simply the shape/size and within that the resolution determine the vector points/wireframe and how many of them?
So, if i have a width of 500 and length of 500. and height map resolution of 257, then there will be a vector every 2m squared ?
Now, finally, I assume detail resolution and detail resolution per patch have no effect on this at all? but simply the rending process and how the mesh is split up into small chucks?

So, if i have a width of 500 and length of 500. and height map
resolution of 257, then there will be a vector every 2m squared ?
Yes, you guessed it right. Width and length is the width and length in units of the terrain, whereas heightmap resolution is in pixels. So essentially one pixel on the heightmap will map to ~4 square units (2^2) on the terrain.
Now, finally, I assume detail resolution and detail resolution per
patch have no effect on this at all?
The detail resolution is the resolution of the splat map which contains the data for placement of detail objects like grass, plants, rocks, etc. and is in no way related to the shape of the terrain. Detail patches are just for optimization and LODGroups of detail objects.

Related

Drawing a shape with dimensions in millimeters

I have dimensions in millimeters (mostly rectangles and squares) and I'm trying to draw them to their size.
Something like so 6.70 x 4.98 x 3.33 mm.
I really won't be using the depth in the object but just threw it in.
New to drawing shapes with my hands ;)
Screens are typically measured in pixels (android) or points (ios). Both amount to the old standard of 72 pts/in. Though, now we have devices with different pixel ratios. To figure out an exact size would mean you need to determine the current device's screen size and it's pixel ratio. Both can be done with WidgetsBinding.instance.window... Then you just do the math from there to convert those measurements to mm.
However, this seems like an odd requirement so you may just be asking how to draw a square of an exact size. You may want to look into the Canvas/Paint API which can be used in conjunction with a CustomPainter. Another option is a Stack with some Position.fromRect or .fromRelativeRect and draw them using that setup.

If a terrain size is larger than the maximum limit (i.e. 1024 tiles) of Navmesh / gridgraph, how to apply grid graph/Navmesh?

When I try to apply a Navmesh graph on the terrain, it says
"tile count: 3025 exceeds maximum limit 1024".
What can I do to increase the maximum limit of 1024, or is there another way in which I can solve this problem?
Increasing the maximum limit is, to the best of my knowledge, not an option. Try increasing the Radius setting of your Navmesh. That should lower the tile count.
If those results are not acceptable, you'd have to consider splitting up your environment into sub-sections I guess.
You may increase Radius in Bake options, but often bake results with big radius are not acceptable. In this case you may remove "Navigation Static" checkmark in Navigation->Object from some big meshes that are not parts of your character walk path. For example remove fields/forest/street or other decoration meshes around your walkable road from navigation static. This will free a lot of navigation mesh tiles for your character's playable area

Unity TerrainData not compatible with absolute elevations?

Is it possible for the Unity TerrainData structure to take absolute elevations? I have a terrain generator that generates absolute elevations, but they are huge. The perlin octave with the highest amplitude is the one that decides what altitude the entire map is at, with an amplitude of 2500 and wavelength 10000. In order for my map to tile properly and transition between altitudes seamlessly, I need to be able to use this system of absolute altitude. I would scale down my generator's output to fit in the limited space (between 0 and 1), and stretch the y scale of the TerrainData, but it will lose too much precision.
What can I do? Is there a way I can use elevations that may vary by as much as 2500 meters?
One thing that might be important is that there will never be that much variation in the space of a single Terrain object, but across many, many Terrain objects, it is possible for the player to traverse that kind of altitude.
I've tested changing different variables, and I've reached the following conclusion...
Heightmap Resolution does not mean precision of data (some people I asked believed it determined the number of possible height values). It means the number of samples per row and column. This, along with size determines how far apart samples are, and effectively how large the polygons of the terrain are. It's my impression that there is no way to improve precision, although I now know how to increase the height of the terrain object. Instead, since I will never have 2500 meters of elevation difference in the same terrain object, each piece of terrain generated by my generator I will put in a terrain object that is positioned and sized to contain all of the data in that square. The data will also have to be converted so that it will fit, but other than that, I see no drawbacks to this method.
Important note: Resolution must be 2^n + 1 where n is any number. If you provide a different value for resolution, the next permitted value down will be selected (always the one below your choice).

pixel to pixel transformation

I am having a problem transferring the position of some objects in still image (RGB image ) into 2D view of the room where the image had been taken.I have the coordinates of about 3 objects in the image (i mean X,y coordinate ) as well as the distance between them and I want to transfer the position of these 3 objects into the plan view .
Any help is much appreciated
You will probably need to clarify your question, but if I'm reading it the right way, it coult be as simple as taking the ratio from one object to another.
For example, if your sensor is 640px wide, and that covers a horizontal length of 10 meters, then you know that every 64 pixels represents one meter in the real world.
Bare in mind that this assumes the objects in the real world are at in the same plane, orthogonal to the lens vector. If objects are in different planes (depths), then you have a bigger problem in your hands.

How to change 3 meter to pixel distance?

I have a 3D object and I need to project it relative to a 2D image, which is captured 3m away with a camera. When I tried to make a projection matrix I found that I need to state the camera position from the object (3m) and the height of the Camera above the ground (1m). Thus, I need to change these values, measured in meters, to pixels so that they can be used in a projection matrix.
I need to do the computation in Matlab. Any pointers?
get(0,'ScreenPixelsPerInch')
Gives you the missing ingredient in Quentin's solution.
1 metre = 39.3700787 inches so dpi * distance_in_meters / 39.3700787
Obviously you will need to know the DPI of the output device.