GP32 Cel-shading In Gp32


LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
Hi, I'm working in a cel-shading renderer for the gp32.

It's almost done, but I'm having a problem when drawing the outlines. If anyone here knows about Opengl can be of a lot of help.

To draw the border I render the same figure in black and with inverted culling. To determine the width of the borders, I move the vertices of the black model by the vertex normal. The normal is the same for each vertex, even if this vertex is shared by more than one polygon.

The problem, as you can see, is that the polygons of the black model don't change their size, only their position.

Any ideas?

cel_shading_0.2.png
 

Attachments

  • cel_shading_0.2.png
    cel_shading_0.2.png
    13.6 KB · Views: 113

mithris

Certified Guru
Joined
Mar 7, 2003
Messages
190
Age
42
Hi, when i added cel-shading to my gp32 engine, i did it the ogl way, with a zbuffer and rendering the backfaces black, but also offseting Z for the backface rendering, what will cause the backface polys to intersect with the frontfacing ones and create nice looking outlines.

---
mithris
 

Inopia

Certified Guru
Joined
Jan 15, 2003
Messages
264
Keep a list of edges in your model.

When rendering, just render the model like you always do. To add the outlines, check your edges list for edges where one of the polygons that uses that edge is culled, and one other is not. Draw that edge with a thick, black line. Also draw edges that only have one polygon using them.

done :)
 

LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
Yeah, I tried that but Klimt (the opengl |es open source version ported to gp32) doesn't have the glLineWidth function, so all lines are one pixel width and nearly invisible.

Here is part of the code:

Code:
glBegin (GL_TRIANGLES);
	for (i=0; i<model.polyNum; i++)
	{
  for (j=0; j<3; j++)
  {
  	glVertex3f((model.vertexData[model.polyData[i].Verts[j]].Pos.X - (2 * model.vertexData[model.polyData[i].Verts[j]].Nor.X)),
    (model.vertexData[model.polyData[i].Verts[j]].Pos.Y - (2 * model.vertexData[model.polyData[i].Verts[j]].Nor.Y)),
    (model.vertexData[model.polyData[i].Verts[j]].Pos.Z - (2 * model.vertexData[model.polyData[i].Verts[j]].Nor.Z)));
  }
	}
glEnd();

Thx anyway ;)
 

skeezix

Internal Development
Joined
Mar 11, 2003
Messages
8,064
Website
www.codejedi.com
How fast is klimt anyway? I've been debating porting it to Zot so it works on multiple platforms easier for me; does it run fast enough on gp32 to be useful for a simple 3d game?

jeff
 

LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
Klimt is slow indeed. You can see the current speed of the code in MGS from the 16 days compo, although that code can be easily improved, but I didn't have the time.

BTW, Klimt is OpenGL, so It can run in all plataforms with OpenGL or OpenGL|ES support.
 

dr.no

It is gigantic.
Joined
Feb 28, 2004
Messages
269
Website
Visit site
From an artistical point of view, the screenshot you posted looks very, very cool though. Like a "sketchy! version of Cell-Shading. I'd like to see one of those models animated.
 

LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
Yeah, a lot of people have told me the same thing . Maybe I'll leave it as it is now, but I would like to find the problem anyway... just to be able to do it again! xD
 

Inopia

Certified Guru
Joined
Jan 15, 2003
Messages
264
Why not just write your own 3D engine? Or at least your own polyfiller code? Should speed things up a bit ?
 

LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
Right now I dont have the skills to make a 3D engine better than Klimt, but I will try in the future, I'm really interested in learning how the whole thing works.

BTW, about speed, this demo has 1000 polys in it, more or less the same than a full MGS level. It runs at twice the speed (even with lighting enabled) and can be improved even more. My objective is getting a whole game based on this engine to run at 15fps. I think it would be enough for you, speed fans :D
 

LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
OMFG!! :blink:

If only I had the skills to make something as impressive as that...

Is the whole demo written in assembly?
 

Inopia

Certified Guru
Joined
Jan 15, 2003
Messages
264
Nah, the polygon routine is mostly asm, but still some C. Rest of the demo is mostly C, with some asm code for the effects.

You can have the polyfiller code if you like :)
 

LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
Woah, that would be really great! I'm sure that I don't have the skills to include it into my project, but I'm willing to learn from some real code. (just in case I can understand the algorithms :p ) The mail is locke.cole AT gmail DOT com

Are you aardbei? In that case really good job. I didn't tought the gp32 could handle such complex 3D...
 

LockeCole

Still Fresh
Joined
Jun 12, 2004
Messages
21
Thx, I'll do.

I'm starting to learn software rendering today. Let's see if it worths the extra work... :)
 
Top