Z-shading in edit mode

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Thu Jul 07, 2005 5:01 pm

Here is the link to the stuff that I have been working on. The code is extremely inefficient and there are some drawing errors, but you can get the basic idea from it.

http://www.ericmforsythe.com/Blender/De ... bject.html

coelurus
Posts: 0
Joined: Sat Jun 18, 2005 9:21 pm

Post by coelurus » Fri Jul 08, 2005 12:22 am

Sorry for the absent of replies, we've been a little busy...

Seems like you've got a couple of good ideas, just don't make this feature overdone :) . We got the idea for this patch after seeing the effect in Maya for wireframe models and it really is a great help when one has to edit complex meshes. It will probably even speed up low-poly modeling because it takes way more than double the time to figure out in what depth a vertex is in with only polygon binding information. I can't see a reason to why this would not be a good feature, it's pretty quick even with a huge heap of monkey heads in the viewport...
We'll have a look at the patch as soon as we can.

EDIT: Btw, have you had a look at the selection-problem?

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Fri Jul 08, 2005 4:56 pm

Seems like you've got a couple of good ideas, just don't make this feature overdone
:D I completely agree. I am just brainstorming and trying out as many ideas as I can. I think that my current patch is too overdone. It is definitely way too CPU intensive.

Some other ideas that I had involved letting the user have more control of how the vertices are shaded.

1. Let the user mark a vertex and then shade all the vertices in a certain radius around that vertex. Maybe even the vertices that fall outside the sphere's radius would be culled away.

2. Have a moveable plane (in viewspace) that allows the user to divide the vertices however they want.

I am not trying to change focus. I think that your original idea is pretty good. I am just throwing a lot of different ideas out there to see if it sparks an idea in some one else.

Do you have any screen shots of this feature in Maya? Maybe I will just download the Learning Edition and check it out myself.
EDIT: Btw, have you had a look at the selection-problem?
No, sorry. I might have some free time in a day or two. I'll take a look at it then and let you know if I find anything.

malCanDo
Posts: 1
Joined: Mon Oct 21, 2002 1:44 pm
Location: Ireland
Contact:

Post by malCanDo » Mon Jul 11, 2005 10:51 am

It's looking good!

As you're working on features for the Edit Mode, could you look into how difficult it would be to show the polygon textures ( if in potato mode ) when editing the mesh, just like it looks when in non-edit mode?

Regards...
Mal

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Mon Jul 11, 2005 9:19 pm

It's looking good!

As you're working on features for the Edit Mode, could you look into how difficult it would be to show the polygon textures ( if in potato mode ) when editing the mesh, just like it looks when in non-edit mode?

Regards...
Mal

Mal, I reposted your comments under the new topic (Textures in Edit Mode) so things don't get offtrack here. My reply is there also.

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Thu Jul 21, 2005 5:56 pm

Just an update on the stuff that I have been working on...

I scrapped the "size" approach and went back to just using color and alpha for the depth cues. I could not figure out an efficient way to render the primitives. Also, the "size" approach only looks cool if the edges are spaced apart somewhat. It can be a pain when working with meshes that have edges that are close together. Blender already uses thicker lines for drawing seams. I don't think that I will be heading down that path any further.

I also simplified and "Blenderized" my original patch.

http://www.ericmforsythe.com/Blender/De ... bject.html

-efbie-
Posts: 0
Joined: Wed Oct 27, 2004 9:47 pm

Post by -efbie- » Thu Jul 21, 2005 6:44 pm

I just tried your patch, and it _rocks_
But, there is a few things to fix :
(maybe those bugs are related to the fact that there were some problems applying the patch (on latest CVS version)
- edge selections are hidden by the new shading
- the dots of face selections should also be shaded.
- when going from solid to wire, the faces are still shown, and you must rotate the viewport before seeing the wire.
- that shading doesn't work in vertex mode.

Suggestions.
Here is a few suggestions :)
- It would fit better in the interface if your method didn't changed the wire color but just it's luminosity. that way it would look nice wathever theme you have.

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Fri Jul 22, 2005 12:53 am

Thanks for looking at the patch, -efbie-!

Yeah, the patch has ALL kinds of problems. :lol: Currently, I'm just experimenting with different depth cues. Once I am done there, I am going to fix all the bugs, pull some of coelurus ideas into the patch, and finish it off with a user interface.
- the dots of face selections should also be shaded.
I'll try it out.
- It would fit better in the interface if your method didn't changed the wire color but just it's luminosity. that way it would look nice wathever theme you have.
I'll end up doing either that or let the user specify the shading colors.

coelurus
Posts: 0
Joined: Sat Jun 18, 2005 9:21 pm

Post by coelurus » Sat Jul 23, 2005 11:55 pm

Glad to hear you skipped the variable primitive-sizes ;) Only decent and really expensive cards handle lines, regular gfx acc let sw render lines iirc. Quads would work, but... naw.

The major problem with this little addon right now is that the user must choose the 3d view background and the wire colors carefully to make it effective. Maybe let the user select one wire color and then interpolate halfway between that color and the background to set the far color? If that would work, the next problem would be the 3d grid...

Btw, what kind of interface are you thinking about?

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Sun Jul 24, 2005 5:27 am

Glad to hear you skipped the variable primitive-sizes
In the end, it just wasn't the right solution for this problem. :-)

Yeah, the user's choice for colors will have a big impact on how well this idea works. For that reason, I think that it would be best to have a simple one toggle button interface without separate color selection for the shading.

I agree with -efbie- suggestion:
It would fit better in the interface if your method didn't changed the wire color but just it's luminosity. that way it would look nice wathever theme you have.
Also, that the user should be able to turn on/off this feature rather easily. Does anybody think that this feature should always be on?

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Tue Aug 02, 2005 2:06 pm

Here's the latest and greatest. There is a now a toggle button that can be used to turn on/off the depth effect. I also included some of -efbie- suggestions. The line color, vertex colors, and vertex size are all user defined. The points are also shaded now. This looks nicer, but it makes it harder to see what vertices you have selected in the back of the mesh. Any ideas?

I wanted to use the mesh's Bounding Box to find the min/max Z values instead of looping through the entire list of vertices. The problem is that the data doesn't always appear to be good so I have to rebuild the bounding box each time I draw mesh. Does anyone know what is going on?

http://www.ericmforsythe.com/Blender/De ... bject.html

coelurus
Posts: 0
Joined: Sat Jun 18, 2005 9:21 pm

Post by coelurus » Thu Aug 04, 2005 11:15 am

I'd keep away from using a bounding box even if it's correctly computed, spheres for example won't be well represented and lead to bad ranges in shading in certain orientations of objects. Unless of course you compute the bounding box in view space :wink: .
You should consider the tricky little boundary-determining routine in the original z-shade patch, it takes care of small groups of vertices pulled out from an object which can destroy the shading for the majority of the vertices. I tried a 100 dup spun monkey-head on my A64 3000+ and it was still useable.
There's a way to easen up on the computations; compute z-dist data when the actual rendering takes place and store that information for the next frame. Use last-frame info to calculate colors. The downside here is that the first time a mesh is drawn in mesh mode, it must either be drawn twice or an extra pre-process function must be called, but the vertex-list traversal will only happen once for both rendering and computing z-shading.

EDIT: About shaded vertices; please no :) Maybe it'll look nice but the sole purpose of z-shading is to make vertex selection trivial, shading the verts simply makes them harder to quickly focus on. Line connectivity is enough to determine where the vertices are and how they are connected.

-efbie-
Posts: 0
Joined: Wed Oct 27, 2004 9:47 pm

Post by -efbie- » Thu Aug 04, 2005 1:34 pm

yeah, amazing !
Some feedback :)
- Bugs :
* I can't see the selected edges
* face centers aren't displayed
* vertex of backfaces are drawn over edges of front faces, (duplicate a monkey, the back monkey vertex appear in front)
*if you activate subsurf and optimal drawing in the modifier stack, when the z-shading is applied, it segfaults.

the fact that selected vertices are shaded make them in deed difficult to see, but regular shaded vertex are really nice. Is it possible to enable shading only on unselected vertex/edges/etc... ?

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post by eric.m.forsythe » Thu Aug 04, 2005 4:50 pm

Thanks for the feedback. It helps out a lot! :)
the fact that selected vertices are shaded make them in deed difficult to see, but regular shaded vertex are really nice. Is it possible to enable shading only on unselected vertex/edges/etc... ?
Yeah, that definitely can be done. Checking the previous posts, Coelurus doesn't think shading the vertices is a good idea. That may be. Do you definitely think that this is an improvement, -efbie-? I am currently on the fence about the whole thing, but I think that your idea is worth trying out. I will implement it this weekend and go from there.
I'd keep away from using a bounding box even if it's correctly computed, spheres for example won't be well represented and lead to bad ranges in shading in certain orientations of objects. Unless of course you compute the bounding box in view space
Yeah, I think that the bounding box is going away. Even if you compute the bounding box in view space there are still problems. For example, say you are currently looking at the corner of a bounding box surrounding
a sphere. You waste a significant amout of color inbetween the corner of the box and front surface of the sphere. Of course, this also happens on the back side of the sphere/box.
You should consider the tricky little boundary-determining routine in the original z-shade patch
Definitely! The current shading scheme is too naive and is just serving as a place holder for the moment. Your original patch is more advanced in this respect.
There's a way to easen up on the computations; compute z-dist data when the actual rendering takes place and store that information for the next frame. Use last-frame info to calculate colors. The downside here is that the first time a mesh is drawn in mesh mode, it must either be drawn twice or an extra pre-process function must be called, but the vertex-list traversal will only happen once for both rendering and computing z-shading.
The problem I see with this is that user can make a sudden large angle changes with the Numpad keys 1, 3, 7, ctrl-1, ctrl-3, ctrl-7. The z-dist data would be completely wrong in these cases.

-efbie-
Posts: 0
Joined: Wed Oct 27, 2004 9:47 pm

Post by -efbie- » Thu Aug 04, 2005 5:48 pm

eric.m.forsythe wrote:Thanks for the feedback. It helps out a lot! :)
the fact that selected vertices are shaded make them in deed difficult to see, but regular shaded vertex are really nice. Is it possible to enable shading only on unselected vertex/edges/etc... ?
Yeah, that definitely can be done. Checking the previous posts, Coelurus doesn't think shading the vertices is a good idea. That may be. Do you definitely think that this is an improvement, -efbie-? I am currently on the fence about the whole thing, but I think that your idea is worth trying out. I will implement it this weekend and go from there.
Compromise here won't be easy. shading unselected vertex is more pleasant to the eye and give a IMHO a better volume effect, but it makes background vertices harder to see. I think you should ask for other advices in IRC, forums or ask matt Ebb who designs blender interface.
Another way would be to let the user choose the BG and FG brightness so that it doesn't blend with the background.

You could also investigate the way other programs do it, they surely spent a lot of money thinking on this issue :)

Post Reply