Sign in to follow this  
crazybach

Generate decal on grid terrain

Recommended Posts

To improve terrain visual quality. i want to support a mesh decal system on my grid based terrain. but i find diffcult to generate a well fitted decal polygon on grid terrain. is there any one know a alogrithm about generating a scalable decal polygon on a grid mesh terrain. i just want the decal polygon always be will fitted even when the polygon edge do not cover a complete grid or grids of terrain. For simplicity, the decal could just be treated as a squard polygon project on the terrain.

Share this post


Link to post
Share on other sites
Project the four corners of the decal quad onto the terrain and determine which terrain quads intersect the decal quad (in 2D). Then assign those terrain quads appropriate texture coordinates, and render them again with the decal texture using those new texture coordinates. Your decal will always be flush with the terrain, and there won't be any Z-fighting either, since you're rendering the exact same geometry with only a different texture.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this