Notifications
Clear all

[Closed] Generating height field?

Hey guys, here’s my problem:

I have a plane with lots of vertices of varied heights (imagine a plane with a noise modifier on it).

I need to measure the height of the plane at an even distribution of points in order to construct an elevation image. Now, just sampling the position of the vertices won’t give me enough information…I need to construct a 512×512 map of the elevation and the plane only has around 40×40 verts.

My first idea was to apply a gradient material to the object, with the gradient going from top to bottom, then rendering a top-down view of the object. That works fine (it’s the current solution I’m using)…but it’s slow (more than a second per frame takes a long time when calculating the height field for 500 frames)

My second idea was to use the maxscript intersectray function, shooing rays down at the object from a uniform grid of points. This works but it is slow as **** (512×512 map = 250k+ rays)

My third idea was to use the SDK to do the same thing. This is faster than maxscript, but still slow (slower than simply doing the rendering option mentioned above).

So…is there any other fast way to accomplish this? Even though the rendering solution is fairly robust, I imagine there’s a lot of overhead calculations being performed by the renderer that aren’t needed simply to calculate the height values…I tried looking into how gradient/falloff shaders are calculated by the scanline renderer but didn’t come up with anything.

Any help (for a maxscript or SDK solution) is appreciated!

4 Replies

What about vertex colors? Set the color by the height via maxscript? I’m not sure of how to set vert colors on a per frame basis, but I’m sure there’s a way… just a thought. Also not sure if it’d be smooth enough either, but it will interpolate at least… maybe it’s worth a shot.

Rendering a Z-Depth will do this.
Check out MAXScript Reference, How To … Access the Z-Depth Channel.
There is no faster way, IntersectRay is just too slow for this.

Ah thanks Bobo! That works great

another solution might be to render HeightMap using projection modifier without gizmo. It’s not faster then Z-buffer render but it’s has to be more accurate.