MeshLab Shaders Collection

cybero's picture

The release yesterday, the 16th of February , of Mesh Lab version 1.3, prompted me to return to a back burnered project to port the shaders used in MeshLab into Quartz Composer.

All but ambient occlusion proved to be capable of porting and were a pretty trivial task too.

Utilising the v002 Model Importer to import and render .ply meshes and all those colours and such came to life more vivdly and easily than was achievable with the use of .dae.

A really amazing plugin, the v002 Model Importer; I'm just beginning to be captious of its full potential. I'm looking forward to getting some sweet animations done.

I've packaged up the results of my work, including the .dae , .ply , .mlp and .gts files to run the project [.mlp] from within MeshLab, an incredibly useful program.

One really wonderful thing about the v002 Model Importer plugin is that meshes can be rendered from so many formats, without having to use .dae .

The shader collection is as follows:-

SEM

Gooch

Toon

PolkaDot3D

Hatch

BuiTuongPhong

CookTorranceReflectant

DepthMap

Dimple

Lattice

Minnaert

NormalMap

OrenNayer

RelexionLines

Stripes

X-Ray

I'd be interested to know if these also work well on 10.5.x. I think they should, but perhaps I'm not apprehending some lack of backwards compatibility. They don't test to Leopard runtime correctly.

Much thanks and appreciation to vade and also to the MeshLab development team, especially Massimiliano Corsini.

I'm also pretty delighted to discover how well Quartz Composer snapshots with transparency to.png, hithertofore most of my rendering snapshots have been of full area renders :-).

[who knew that?] - yeah, you! [who didn't know that?] - yeah, me! [who else..]

PreviewAttachmentSize
MeshLabQuartzComposerPorts.zip240.19 KB
MeshLabShadersv002SEM.png
MeshLabShadersv002SEM.png136.39 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

photonal's picture
Re: MeshLab Shaders Collection

This wasn't working for me at first - I had a slightly older beta version of the import plugin. Nice work.

Thanks for sharing!

toneburst's picture
Re: MeshLab Shaders Collection

Excellent!

a|x

cybero's picture
Re: MeshLab Shaders Collection

MeshLab is a truly excellent program and as for the v002 Model Importer, really useful.

Cheers

dust's picture
Re: MeshLab Shaders Collection

exciting I'm slowly making the transition to using alternative softwares to the standards like switching from adobe Photoshop to pixelmator has been pretty sweet. went from Maya to cheetah 3d. now I open cheetah way more. I have yet to make the leap to complete open source like blender and mesh lab. this looks promising. does anybody know the best way to get a .mesh file made on a Mac. cinder uses this format in a few examples ?

cybero's picture
Re: MeshLab Shaders Collection

funnily enough, not MeshLab, despite the eponymy involved •~

Medit is a program for visualizing scientific models reads .mesh files, but it is an elusive download, despite being the only program mentioned on http://www.fileinfo.com/extension/mesh as using / generating files of such extension.

It looks like it is a dead link .

However, the doughty GMSH does do that kind of job, with glee and a whole load of relevant options & parameters .

see attached example files generated by GMSH - loving it.

PreviewAttachmentSize
medit-meshes.zip408 bytes

dust's picture
Re: MeshLab Shaders Collection

thanks cybero, i will check it out when i get home. running a search seemed elusive to me as well.

cybero's picture
Re: MeshLab Shaders Collection

& a full set of Ogre XML .mesh exporters and converters for a variety of modelling applications Ogre Exporters is also available from Ogre Wiki not all the applications listed below are OS X compatible. They do have an Ogre SDK for both OS X and the iOS

3DS Max [Windows only]

Maya

Softimage/XSI [Windows only]

Blender

Wings 3D

Cinema 4D

DeleD [Windows only]

Gile[s] [Windows only]

FSRad [no working link found]

VRML Converter [3d Studio Max - Windows only]

MilkShape 3D [Windows only]

AC3D

RenderMonkey [Windows only]

Bioware [Windows only]

OGRE

TrueSpace [Windows only]

LightWave

gtoledo3's picture
Re: MeshLab Shaders Collection

That shader for "normals" is sort of cool. It shades objects in a way that puts a gradient on it that can be used to create lighting again, after you render to texture.

I'm rendering a teapot using that shader, placing in RII to render to texture. Then I'm rendering to a 2D glsl grid, inside of a lighting environment, and cwright's "normal map I.qtz" comp.... but with a stylize warp inbetween the texture and final glsl normal map render. I don't know that it's superior to just rendering a lit teapot and warping with an image warp after the fact... but it's interesting to have a different approach at disposal.

The teapot inside of the rii will move around in SL, probably not in Leopard, b/c of weird mouse/trackball rii stuff. Not 100% sure.

PreviewAttachmentSize
deferred_demo.qtz19.46 KB

gtoledo3's picture
Re: MeshLab Shaders Collection

Actually... this is probably worthwhile, b/c it doesn't even register fps.

cybero's picture
Re: MeshLab Shaders Collection

Smooth and twirly :-).

A well optimised composition, [n/a fps].

The Normal Map is a real delight & this is a really sweet employment of that shader.

This is making me wonder about what else could be achieved with the various shaders I ported over using some similar construct.

From my initial experiments along such lines, placing a v002 Model Importer into the initial RII, which initial shader patch is not actually a Normal Map, I do not find that I achieve better than 60 to 74 fps. The 74 fps is inconsistent ..

One thing that I have noticed, when employing Normal Map throughout, however, is that a truly accurate fps result, even when switching to rendering Primitives, like Cube, Cone, Sphere and so forth, cannot be achieved when switching in live render mode, as the Viewer caches the prior fps result, which as mentioned above, when calculated upon the rendering of a 3D object using v002 Model Importer, results in 60 fps or thereabouts.

⌘ + . to stop and ⌘ + R to restart, then, with Primitives, I get a good n/a fps result.

Thanks for sharing. Neat & effective use of the Image Crop.

cybero's picture
Re: MeshLab Shaders Collection

Please do ignore the medit-meshes.zip that I posted upon comment-19022, these do not work in QC.

What had previously seemed to work when running GMSH [definitely worthwhile acquiring] & QC, does not work when run in a fresh QC session. I ran ahead of good working practice on that one point.

I shall revisit that particular program and post a workable set of .mesh files once I've successfully worked out the exact working procedure involved.

transfinite mesh gives no vertices when viewed in Text Wrangler

 MeshVersionFormatted 1
 Dimension
 3
 Vertices
 0
 End

which would seem self explanatory as to why nothing effectively renders from that resource as nothing is there for the v002 Model Importer patch to work with.

whilst

view5.mesh also fails to render despite having Vertices and Quadrilaterals written in its file.

 MeshVersionFormatted 1
 Dimension
 3
 Vertices
 6
                    0                         0                         0      100
                  0.1                         0                         0      100
                  0.1                       0.3                         0      100
                    0                       0.3                         0      100
                    0                      0.15                         0      100
                  0.1                      0.15                         0      100
 Quadrilaterals
 2
 1 2 6 5 100
 5 6 3 4 100
 End

clearly trying to walk before I can even crawl with that program •~

cybero's picture
Re: MeshLab Shaders Collection

wish I'd not posted that .zip of medit type extension meshes that just don't mesh ;-) .

gtoledo3's picture
Re: MeshLab Shaders Collection

I don't know... I didn't happen to see any other shaders off hand that looked like they were meant to be rendered to texture (or whatev) in order to then feed to another shader, save for that one. I didn't give a real exhaustive look either though.

I like the look of the minnaert ... that one is new to me.

Maybe that one that didn't seem to work could be converted/fixed.

vade's picture
Re: MeshLab Shaders Collection

Do you disable VBL sync, because otherwise you are locked to vsync.

gtoledo3's picture
Re: MeshLab Shaders Collection

You disable synch? I did that for awhile but had tearing ssues every so often, and had super weird shit happen w/ mesh/lighting/rii.

cybero's picture
Re: MeshLab Shaders Collection

Quote:
Maybe that one that didn't seem to work could be converted/fixed.

I guess you mean the ambient occlusion shader, GT?

Still to take another close look at that.

I find that most of the shaders work pretty well within the RII to produce an image that can be processed by the Vortex Distortion chain. Especially so when employing Primitive Objects, Sphere, Cube, rather than a v002 Model Importer 3D object, which thus far I'm failing to avoid a certain degree of 'jaggies' when placing within the RII

Minnaert is pretty interesting; I've definitely ended up with a lot of things to revisit later and tweak and 'twirl' with :-)

cybero's picture
Re: MeshLab Shaders Collection

No, I haven't disabled VBL sync.

Just going to give that a try.

Works like a charm :-) .

Thanks for getting me to challenge my heuristic repressions vade.

Now I have smoothly twirling GLSL renders of the v002 Model Importer running through the Vortex Distortion image patch in my re-modellings of gtoledo's recently posted composition.

Cheers.

gtoledo3's picture
Re: MeshLab Shaders Collection

Let me explain what's going on there better, b/c I think maybe it's not obvious to you (or maybe it is). It's not that you can't put something in an rii and then twirl it....

That normal map shader is shading the object in way that it's putting a gradient on it that relates to lighting coordinates. It's not "lit' at that point.

When you render that to texture, you can feed that to another glsl shader that interprets that gradient texture info, grabs lighting info from te lighting environment that the flat glsl grid/shader is inside of, and setup the flat glsl grid to look as though it's a lit 3d object.

When you put something like a twirl or zoomblur in between the rii and final glsl shadaer/lighting/grid, it skews those gradient normals so that they appear to be lit accurately along with whatever the warp/filter does. So, with some stylize warps snd whatnot, you can get some effects that make it look more like and actual 3d object is being warped in 3dimensions, feeling a teeny bit less like a 2d post process.

cybero's picture
Re: MeshLab Shaders Collection

Interesting, another point of view to consider, yes.

I wish we could save variant Alt preference setups for differing rendering outputs, like sometimes to Disable VBL is the way to go [certainly worked like a charm with the Vortex Distortion from the RII when replacing the Normal Map GLSL] and sometimes, as you indicate, it produces problems all of its own.

vade's picture
Re: MeshLab Shaders Collection

Only to benchmark real FPS gains. Otherwise you are clipped at 60Hz, and sometimes can't tell. This is the case with the old Rutt (current). There are some faux optimizations in there that, in the end hurt more than help. Knowing how to profile well (GL Profiler is the key here).

Its just another way to tell real world whats going on.