White polygon faces with black edges?

26 views
Skip to first unread message

Benjamin Drucker

unread,
Oct 18, 2011, 1:45:10 AM10/18/11
to sce...@googlegroups.com
I'm trying to show some shapes with a base color of white (easy) but with black lines on all triangle edges.  I saw how to get wireframes, at least with v0.8, but I want opaque sides.  Any ideas?

Rehno Lindeque

unread,
Oct 18, 2011, 5:18:48 AM10/18/11
to sce...@googlegroups.com
Probably you'll need to add the geometry twice - once for the faces and once for the wireframe. Be cautious of z-fighting though, might need to use a shader to add some bias to the z-component there.

Rehno Lindeque

unread,
Oct 18, 2011, 5:24:02 AM10/18/11
to sce...@googlegroups.com
PS actually come to think of it webgl doesn't allow you to write to the fragment depth, you'll need to add the bias in the vertex shader.

Benjamin Drucker

unread,
Oct 18, 2011, 12:50:21 PM10/18/11
to sce...@googlegroups.com
Rehno, that sounds perfectly plausible. However, I am too noob to
understand what you said.

I have read through about half of the lessons at learningwebgl
(http://learningwebgl.com/blog/?page_id=1217) and that's about all I
know of webgl. I'll dive in to it a bit further, but if you know of
an example of doing something related to what I'm targeting, I'd
appreciate a link.

Cheers!
Ben

Lindsay Kay

unread,
Oct 18, 2011, 12:57:19 PM10/18/11
to sce...@googlegroups.com
I think Rehno's just talking about how the solid faces and the
edgeshave to be separate geometries, and how you'll want to ensure
thatthey don't clobber each other's pixels in the Z depth buffer
(depthfighting), so you'd want to have the edges offset a little bit
fromthe face extents.
On 18 October 2011 18:50, Benjamin Drucker

Benjamin Drucker

unread,
Feb 16, 2012, 7:02:11 PM2/16/12
to sce...@googlegroups.com
I was hoping to do this with a fancy custom shader.  I need to do this in an automated way for any model I get.
Reply all
Reply to author
Forward
0 new messages