Jump to content
  • Advertisement
Sign in to follow this  
Norman Barrows

Meshes that adjust to the heightmap

This topic is 659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In both  skyrim SE, and cryengine  tutorials  related to grass, i've seen meshes (groups of plants or rocks - low poly, all same texture) that seem to automatically adjust to the height of the ground, so each rock and plant is at ground level.   Is their level editor simply applying the fixup when they place the mesh in a level? or is it done in shader code? or what? i suspect some of these are single meshes containing multiple rocks and plants, not just a spraypaint tool using individual plant or rock meshes.  The cryengine video referred to a batching option of some sort - which i assume would do the same fixup - somewhere - somehow.

I'm currently experimenting with low poly plant meshes for low ground cover - an almost flat pyramid or dome mesh that sticks out of the ground just a little, with a see-through plant / grass texture of some sort.  but on hilly terrian, the edges stick out of the slope. easy to fix, just tilt them with the heighmap:

plant is at x,z...
y0 = heightmap(x,z)
y1 = heightmap(x,z+1)
xr = -atan(y1-y0)
y2 = heightmap(x+1,z)
zr = atan(y2-y0)

only problem is i also have plant.yr=grass_rotation(x,z),  which is based off a random pattern map (essentially a noise function). and the rotation order currently used for drawing all chunks is x,y,z. to keep yr from messing up the tilt, the order would have to be y,x,z. and the only way to tell if its a plant that tilts is by the mesh or texture ID, unless i add data. Note that the Zdrawinfo struct used to store the drawing info has a small array of generic data variables for just such occasions, so adding a flag value: "i tilt, use y,x,z rotation order" of some sort should be easy.

But I think a mesh that adjusts to the heighmap would be even better. thus my question.

Edited by Norman Barrows

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!