Matcap shader for Softimage

Plugins linking to this thread: (hide)

Matcap shader for SoftimageAuthor: Andy Moorer
[..] I've banged together a Matcap shader (aka litsphere) in metaSL which works in the Softimage High Quality viewport. You know how in Zbrush models look kind of like clay or other materials as you work on them? That's Matcap shading.

It's provided "as-is" but since its metaSL it should work for everyone regardless of graphics card as well as look the same in HQ/real time, and mental ray. That's the theory, anyway.


local backup: litsphere_packaged.xsiaddon"

Discussions regarding Materials, Material-Compounds or Shaders, etc.
Matic
Posts: 70
Joined: 18 Jun 2009, 19:58

Re: Matcap shader for Softimage

Post by Matic » 20 Feb 2013, 03:32

Not sure why you are experiencing crashes, but I suspect it has to do with graphics card issues, I have a machine which has crashed with the shader a fair bit, using an AMD card, while others with nVidia cards seem solid.

The texture you see there is just a stand-in texture I pointed at since everyone should have it (I should make it the noicon img.... There are no matcap textures included and I didn't want to package this as an addon just to install one. You'll need to DL one and replace the texture, or use one from this forum. :)

It's perfectly ok to use the matcap in the diffuse slot of a material like a constant, if that is stable for you. It should still look right, and you can then do interesting stuff like make the surface reflective, which might look cool. Or you can use it with other combinations, the shader is just outputting color.

So the image you show may be working right, and only need a matcap image instead of that one. That's all a matcap really is, it's a texture of a particular type, mapped to the object according to the relationship between the surface normals and the camera. That's why it is such a good choice for tools like zBrush which have to shade millions of polygons in real time - they can make meshes look like they have cool lighting with almost no processing cost.

I hope that helps a little!

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Matcap shader for Softimage

Post by Daniel Brassard » 20 Feb 2013, 21:29

Hi Andy, thanks for the shader.

You forgot to mention your previous blog on this subject which is very interesting too so to put them together:

http://andy.moonbase.net/archives/1037
http://andy.moonbase.net/archives/651

Always liked your blog. Keep it coming!

Cheers!

Dan
$ifndef "Softimage"
set "Softimage" "true"
$endif

Falam

Re: Matcap shader for Softimage

Post by Falam » 21 Feb 2013, 06:52

Matic wrote:Not sure why you are experiencing crashes, but I suspect it has to do with graphics card issues, I have a machine which has crashed with the shader a fair bit, using an AMD card, while others with nVidia cards seem solid.

The texture you see there is just a stand-in texture I pointed at since everyone should have it (I should make it the noicon img.... There are no matcap textures included and I didn't want to package this as an addon just to install one. You'll need to DL one and replace the texture, or use one from this forum. :)

It's perfectly ok to use the matcap in the diffuse slot of a material like a constant, if that is stable for you. It should still look right, and you can then do interesting stuff like make the surface reflective, which might look cool. Or you can use it with other combinations, the shader is just outputting color.

So the image you show may be working right, and only need a matcap image instead of that one. That's all a matcap really is, it's a texture of a particular type, mapped to the object according to the relationship between the surface normals and the camera. That's why it is such a good choice for tools like zBrush which have to shade millions of polygons in real time - they can make meshes look like they have cool lighting with almost no processing cost.

I hope that helps a little!
It worked beautifully on a sphere using one of the MetCap images that firebird had uploaded. It failed on every other object, rather Softimage crashed. I loaded a character mesh, made sure the Subdivide level was at zero, applied the shader, high quality viewport was on, Softimage crashes. All this on a nVidia card, makes no sense, ATi, yes, not nVidia :-l X( =((

User avatar
Firebird
Posts: 81
Joined: 04 Jun 2009, 12:08
Location: Vienna
Contact:

Re: Matcap shader for Softimage

Post by Firebird » 21 Feb 2013, 08:59

Hirazi Blue
Perhaps - I haven't tested this however - equivalent/analogous to the workgroup location of (unsupported legacy) cgfx files in a new folder "[workgroup]\Application\msl\".
Spoiler alert: THIS IS HOWEVER PURELY GUESSWORK
Thanks Hirazi that worked.

Sadly I also got some random crashes with the shader.
Didn't had much time to test when and why, the HQV worked most of the time (sometimes I got a crash when changing the texture image, but I think thats HQV relatet) but the mr render failed (renders black, or crash to Desktop).
Also on Nvidia here. 580GTX.

Matic
Posts: 70
Joined: 18 Jun 2009, 19:58

Re: Matcap shader for Softimage

Post by Matic » 22 Feb 2013, 06:31

@daniel thanks for the kind words!

Re: crashes

:(

I'll look into it. As far as I can tell I'm not doing anything I shouldn't in the shader, which is pretty tiny. But clearly there's an issue somewhere.

I planned on a better version eventually with a bit more to it - maybe I'll avoid metaSL entirely, I'm wondering if its crashing during the compilation phase. It would be nice if we could have matcaps in a normal shaded/texture view, too... I hate waiting for the HQ viewport when you first enter it.

User avatar
ActionArt
Posts: 853
Joined: 25 Nov 2010, 18:23
Location: Canada

Re: Matcap shader for Softimage

Post by ActionArt » 22 Feb 2013, 15:47

I also have regular crashes when I go to render in MR. Not every time but about half the time. It gives and error, I'll record it next time. Also noticed the texture mapping is not the same in MR as in the viewport. I'll get some samples.

This shader has really made the viewport far easier to work with in the modeling phase, It actually made the HQV useful :)

If possible it would be nice to have it in the other modes as well (because of the HQV delay) but overall I really like this shader.

User avatar
ActionArt
Posts: 853
Joined: 25 Nov 2010, 18:23
Location: Canada

Re: Matcap shader for Softimage

Post by ActionArt » 22 Feb 2013, 15:58

I don't know if this helps but I get this error with the render region:

// WARNING : SHDB 0.2 7 MB warn 732777: W216 C:\Program Files\Autodesk\Softimage 2013 SP1\Application\phenolib\msl\litsphere.msl(16): warning: useless explicit cast to "float"
// WARNING : SHDB 0.2 7 MB warn 732777: W216 C:\Program Files\Autodesk\Softimage 2013 SP1\Application\phenolib\msl\litsphere.msl(16): warning: useless explicit cast to "float"
// ERROR : API 0.2 7 MB error 301099: while defining texture "MI_default_texture_relief_map_1_height.dds": failed to open texture file relief_map_1_height.dds

Here's a couple renders as well, MR and viewport (bottom). The texture projection is definitely different somehow. Perhaps something isn't translating there.
Attachments
T1.jpg
T2.jpg

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Matcap shader for Softimage

Post by Daniel Brassard » 22 Feb 2013, 17:00

I don't know if this helps but I get this error with the render region:

// WARNING : SHDB 0.2 7 MB warn 732777: W216 C:\Program Files\Autodesk\Softimage 2013 SP1\Application\phenolib\msl\litsphere.msl(16): warning: useless explicit cast to "float"
// WARNING : SHDB 0.2 7 MB warn 732777: W216 C:\Program Files\Autodesk\Softimage 2013 SP1\Application\phenolib\msl\litsphere.msl(16): warning: useless explicit cast to "float"
// ERROR : API 0.2 7 MB error 301099: while defining texture "MI_default_texture_relief_map_1_height.dds": failed to open texture file relief_map_1_height.dds
The errors ring a bell ....

MetaSL specification.

http://www.nvidia-arc.com/fileadmin/use ... ar2011.pdf

For those interested in coding MetaSL shaders, here is a resource site

http://www.metasl.org/

MetaSL Shaders Library

http://materials.mentalimages.com/

@Matic

I'll have a look at your code.
$ifndef "Softimage"
set "Softimage" "true"
$endif

Falam

Re: Matcap shader for Softimage

Post by Falam » 22 Feb 2013, 18:23

The crashes are annoying, one thing I noticed MetaSL shaders don't respond to light reaction. X(

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Matcap shader for Softimage

Post by Daniel Brassard » 22 Feb 2013, 20:34

@ ActionArt and Matic,

I modified the program a bit, try this one and let me know how it work. Modification made:
  • Removed the hardcoded texture "relief_map_1_height.dds".
    Modify the soft_range parameter by removing the float type inside the parenthesis
    some cleanup of the code.
Matic, hope you didn't mind me muddling with your code.

@ Falam

Correct, the light interaction will have little influence on the Matcap, this is intended and the correct behaviour. See it as a baked light texture.

The shader is intended for use in modeling/sculpting ala Mudbox/ZBrush.
Attachments
litsphere_v1_1.zip
(783 Bytes) Downloaded 160 times
Last edited by Daniel Brassard on 22 Feb 2013, 22:45, edited 1 time in total.
$ifndef "Softimage"
set "Softimage" "true"
$endif

Falam

Re: Matcap shader for Softimage

Post by Falam » 22 Feb 2013, 22:27

Daniel Brassard wrote:@ ActionArt and Matic,

I modified the program a bit, try this one and let me know how it work. Modification made:
  • Removed the hardcoded texture "relief_map_1_height.dds".
    Modify the soft_range parameter by removing the float type inside the parenthesis
    some cleanup of the code.
Matic, hope you didn't mind me muddling with your code.

@ Falam

Correct, the light interaction will have little influence on the Matcap, this is intended and the correct behaviour. See it as a baked light texture.

The shader is intended for use in modeling/sculpting ala Mudbox/ZBrush.
If only it didn't crash Softimage with HQV it would be nice to model with it. It would be better if it could respond to light, for example in Mudbox which I use extensively, I can move the lights around on a clay material, then again Mudbox is relying on the GPU while Softimage is suppose to be relying on the GPU with HQV.

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Matcap shader for Softimage

Post by Daniel Brassard » 22 Feb 2013, 22:35

If only it didn't crash Softimage with HQV it would be nice to model with it.
So version 1.1 crash Softimage?
$ifndef "Softimage"
set "Softimage" "true"
$endif

Falam

Re: Matcap shader for Softimage

Post by Falam » 22 Feb 2013, 23:06

Daniel Brassard wrote:
If only it didn't crash Softimage with HQV it would be nice to model with it.
So version 1.1 crash Softimage?
I never tried your modified one, let me get back to you :)

User avatar
ActionArt
Posts: 853
Joined: 25 Nov 2010, 18:23
Location: Canada

Re: Matcap shader for Softimage

Post by ActionArt » 22 Feb 2013, 23:16

Daniel Brassard wrote:@ ActionArt and Matic,

I modified the program a bit, try this one and let me know how it works.
Thanks!! Will give it a try this weekend.

User avatar
ActionArt
Posts: 853
Joined: 25 Nov 2010, 18:23
Location: Canada

Re: Matcap shader for Softimage

Post by ActionArt » 22 Feb 2013, 23:46

Just gave it a quick try. So far, works great! No mapping differences, no errors, no crashes (yet).

Awesome! Thanks!!! :D

Falam

Re: Matcap shader for Softimage

Post by Falam » 23 Feb 2013, 00:10

Mathaeus wrote:Just for info, there is a custom Mental Ray "MatCap" shader for a long time, by Stefan Minning. However there's question, how to incorporate it into standard lighting system - as it actually ignores any kind of light, direct or indirect.
At least, that's reason I never tried to cook something in ICE, along this line, especially with 3delight - as it already have it's own subsurface scattering.
You are limited with the type of SSS nodes you can use with 3D Delight :( It isn't too bad though considering the NPR you achieve from 3Delight :) Where is there Renderman shaders, where ? :)

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests