Game Development Community

Outline Shading Issue

by Demolishun · in Torque Game Engine · 04/15/2006 (5:46 pm) · 14 replies

I have been trying to implement this:

www.garagegames.com/mg/forums/result.thread.php?qt=10936

But I am getting this:

www.demolishun.com/images/orc_outline_issue.png
The player DTS is the only one that does this. Can anyone tell me why?

About the author

I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67


#1
04/15/2006 (6:38 pm)
Looks like environment mapping is turned on. You'll have to turn it off by disabling the second texture channel, or by disabling texturing altogether is a glDisable(GL_TEXTURE); call when doing the lines.

Brian "bzztbomb" Richardson -- Knowhere Studios
#2
04/15/2006 (7:04 pm)
Or you could just turn off the environment mapping on the player... since I'd just doubt youl'd use environment mapping with outline effects. I found that method to be sketchy at best anyways and just went with inverted model mapping to get outlines.
#3
04/15/2006 (7:31 pm)
I tried this:
glDisable(GL_TEXTURE); 
glDisable(GL_TEXTURE_2D);

It did not help. Which is really wierd since it should have.

Paul,
I agree that the method used for the DTS and DIF objects really does not work that well. I was going to look into this:

nehe.gamedev.net/data/lessons/lesson.asp?lesson=37

This is really nice work. Download one of the examples and play with it. I downloaded the Linux SDL version and it rocks.
#4
04/16/2006 (8:43 pm)
Frank, thats the same method that the outline code is using.

The code that you want to use is in this resource
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5426
Its the edge detection code in the debugging section.

I havnt gotten around to doing it yet, probaly never will as im busy with other projects.
#5
04/16/2006 (8:47 pm)
I have seen that happen when I put the outlining code *before* the render code in TSMesh::render(). In other words, the outlining should be the second loop through the mesh primitives, not the first.

-David

PS Has anyone found a *different* outlining approach? (Besides double-your-polys or vertex shaders.) This one seems to be a bit flakey, and prone to odd lines on more complex objects.

PPS Edit - Just saw the comment about stencil shadows. Worth checking out.
#6
04/23/2006 (11:06 pm)
OK...I checked out the stencil shadows resource and was able to strip it down to be just an outline render. Took most of the afternoon and evening today, but I achieved a notable result:

www.ascendantmoon.com/images/pbn-06-04-23-001b.jpg
The bad news is:

1. It takes a noticeable amount of time to find the edges of the mesh the first time you load an object.

2. This is because I can't just use the vertex indices to find edges. It seems that vertices are duplicated within the polys. I don't know *why*...I only report the facts. Thus, I have to engage in some time-consuming dual 3-floating-point-value vertex comparisons instead a couple of integer (indices) comparisons.

The good news, though, is that I think I could use this method to render "textured strokes" for the outline, instead of just drawing a black line. I would have to expand the silhouette render to use more than just 2 vertices, but the end result might be worth it.

The other good news is that finding silhouette to draw the outline is actually pretty snappy. I did notice a performance hit with the outlining. On the other hand, I've done nothing to optimize it yet (except use glDrawElements).

So...whither hence? Is it worth pursuing black outlines? I'm not sure.

Anyone else have any thoughts on this?

-David

PS Yes, I'll share the code...though it would probably not be before next weekend.
#7
04/24/2006 (6:14 pm)
I think it's the best cel-shading we could hope for in TGE. Outlines look really clean and well formed even on the crazy gun model there. All this stuff should be easy enough to make toggles for yeah? So you may aswell have it, and then experiment with settings to find what looks best.
#8
04/24/2006 (7:00 pm)
Looks very good!
#9
04/24/2006 (7:29 pm)
The most valuable resource #2 this year!

Steven
#10
04/24/2006 (7:32 pm)
Very impressive, David!
#11
04/24/2006 (7:32 pm)
The most valuable resource #2!

Steven
#12
04/26/2006 (6:12 pm)
Sweet, good job.
I can cross this off my future todo list.
#13
04/30/2006 (1:06 am)
I posted the outline code as a resource:

Shape Outlining in TGE

-David
#14
04/30/2006 (11:54 am)
Thank you very much!
You are awesome!