[UPDATE 27-Sep-08 Cavity Mask attempt] Z-Brush similar material for GLSL

This is a new update trying to mimic the Cavity Mask effect and also with some retouches to the previous shader. Be aware that the cavity mask doesn’t work well in all circumstances, the object must be in the center of the “viewport center of rotation” (NumPad point key).

It came out of trial and error more than technical knowledge of how normals work. My first intention was to blur the normal colors and then compare them in some way (add, substract, etc.) with the original version to obtain a value for the normals that is not “view dependent” and that shows how the normals of each face compares with the ones surrounding it, thus knowing how concave is that area. But still don’t know if this is possible, or if it would work. But after seeking that, I stumbled upon this solution.

Video demo at Vimeo: http://www.vimeo.com/1825379

DOWNLOAD: http://www.4shared.com/file/64698833/c11055a3/red_wax_cavity_v1_final.html

Some screenshots:
http://www.uploadgeek.com/uploads456/0/cavity_screenshots_GLSL.png

Nodes setup:
http://www.uploadgeek.com/uploads456/0/cavity_nodes.png

.

Now that new one is looking sweet!

Also, makes me feel the need of a new video card. :frowning:

And to think the GLSL in Blender was designed for the game engine.

I’m using GLSL in the BGE just to note, but I’m seeing it can be useful outside of games too.

really cool shaders.

and just as I was beginning to forget about the existence of nodes

thanks for the reminder!!

You making it better an better Eclectiel. The last on id great indeed :slight_smile:

Thanks guys for the kind comments. I’m really close to make a much better (and stable) Cavity Mask, faking AO with a few lamps, although I need soft shadows and I’m getting only sharp shadows. In the preview renders looks like a very promising solution. If anyone knows how to get soft shadows with GLSL or if it is possible with current implementation, please let me know.

Thanks.
.

Some screenshots with the new technique I’m trying for Cavity Mask. These screenshots were made with Blender Internal renderer, but is not far from what is possible with GLSL. I think it’s pretty much what Z-brush does, and doesn’t have the limitations of my previous attempt.

The latest build I got from SVN trunk has soft shadows, which helps a lot for this ‘fake AO’ technique. The only thing that is missing in GLSL right now to achieve similar results is the ability to make a group of lamps exclusively affect one material.

Anyway, if this feature is not included in GLSL at least we can render with shaders that use cavity mask.

If anyone knows how to make an object always face the viewport, please let me know. This will help keep low the amount of needed lamps for the fake AO (now 4).

http://www.uploadgeek.com/uploads456/0/cavity_mask_fake_AO.png
[image]

.

Make my day :slight_smile: It´s prefect for my students, a nice visualization when sculp

But I can´t downlad de file, Broken links?

Jur!

Make my day :slight_smile: It´s prefect for my students, a nice visualization when sculp

But I can´t downlad de file, Broken links?

Jur!
:slight_smile: Glad you did like. Seems like the files were deleted. I will make a ZIP with all them in the next days. So many things I would like to do, so little time…

I’m thinking on doing a Pynode for the cavity mask. The first attempt for cavity mask (27-Sept-08) has some limitations.
The second attempt (the screenshot in post #28), I think is better, based on few lights to fake AO, but I didn’t post it yet since it uses some features for lights and shadows not available yet in GLSL (they were available in a SVN build, but not in actual). It has less limitations but may have some.

For the Pynode attempt I’m asking for help with the PyNodes API in the scripts forum. The idea is to make a face darker (dirtier) as the adjacent faces have sharper angles. And I need to know how to get the angles of the adjacent faces with respect to any face.

That black/white mask can be used then as in the screenshots above, with nodes, to mix/blend two materials… one for the dark zones of the mask, which blends to the other in the brighter zones.

Not sure if I’ll be able to do it, but would like to try.

The mask should look like:
http://www.pixologic.com/zbrush/paint/images/cavitymasking.jpg

.

Pynodes don’t work with GLSL do they?

You’re right, anyway it would be fun to try it even if it’s for render time, and if it’s possible to do it (and I can figure out how), have it already when Pynodes are supported by GLSL.

.