Jump to content
  • Advertisement
Sign in to follow this  
ChickenMcOwnage

Cel-shade outline for heightmap problem

This topic is 4843 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

The game I'm working on is a side-scrolling shooter, where the backgrounds are terrain heightmaps. The game is very cartoony, so the heightmap will be textured with bright cartoony textures. I'm also adding an Outline effect to the heightmap, just like the outline used when cel-shading. Okay, so I've only seen one way to produce said outline effect, and that is to draw your object, then switch the face culled and draw the object with a thick wireframe. It works, but there are many problems with the way it looks: http://img.photobucket.com/albums/v407/KungFuSich/cartoon_terrain.jpg So you can see in the picture that there are a lot of defects. Lines are't connected, multiple lines in places where there should be one, some of the hills in the far-off distance don't even have outlines, etc. In addition, when the camera scrolls right, outlines pop in and out instead of smoothly transitioning. I can live with a few little defects here and there especially when I add textures and trees and stuff to the terrain, but as of right now it looks pretty ridiculous. Here's the relevent code:
        //---draw the temporarily blue landscape----
	glPolygonMode(GL_BACK, GL_FILL);
	glCullFace(GL_BACK);
	glDepthFunc(GL_LESS);

	glColor3f(0.6f, 0.6f, 1.0f);
	glBegin(GL_QUADS);
	for (x=0; x<MAP_SIZE-1; x++)
		for (y=0; y<MAP_SIZE-1; y++) {
			glVertex3f(x, heightMap[x][y], y);
			glVertex3f(x, heightMap[x][y+1], y+1);
			glVertex3f(x+1, heightMap[x+1][y+1], y+1);
			glVertex3f(x+1, heightMap[x+1][y], y);
		}
	glEnd();		

        //---now draw the outlines------------------
	glPolygonMode(GL_BACK, GL_LINE);	
	glLineWidth(10);
	glCullFace(GL_FRONT);
	glDepthFunc(GL_LEQUAL);

	glColor3f(1.0f, 1.0f, 1.0f);
	glBegin(GL_QUADS);
	for (x=0; x<MAP_SIZE-1; x++)
		for (y=0; y<MAP_SIZE-1; y++) {
			glVertex3f(x, heightMap[x][y], y);
			glVertex3f(x, heightMap[x][y+1], y+1);
			glVertex3f(x+1, heightMap[x+1][y+1], y+1);
		        glVertex3f(x+1, heightMap[x+1][y], y);
	}
	glEnd();
So I was wondering if anybody has any good experience with outlining, or any suggestions on how to minimize the amount of defects on the terrain. Anything will be helpful. Thank you so much for your time! ~Mark [Edited by - ChickenMcOwnage on August 14, 2005 11:04:07 PM]

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!