Multishader layers driven by user data ?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 10 October 2012   #1
Multishader layers driven by user data ?

hi everybody !
Maybe you could help me, I have a mograph multishader with 4 cards (or more ) in layers but I need just one clone to display the texture which is controlled by user data ( linklist cycle button ).

I did this little file who match my need but not exactly what I'm looking for, I would prefer to preserve the 4 differents layers in my multishader...

Please have a look and tell me what I'm doing wrong or if it is a better solution !

Thanks, here's my file, use the user data "Cartes" on the "Cartes Texture controleur" Null object to change the texture... As you can see, it works but not in a convenient way.

Thanks for any advice !

Frenchcinema4D Moderator
my website :
Kamigaz® Project on : Pinterest
Old 10 October 2012   #2
You can use a Color's Greyscale Value in a Shader Effector to control which Layer of a MultiShader to display (if you set your MultiShader back to Color Brightness)

Then you can have your User Data control the Shader Effector's color value

If you have 4 cards you could do something like this :
if User Data == 0 display color value V of 0%
if User Data == 1 display color value V of 26%
if User Data == 2 display color value V of 51%
if User Data == 0 display color value V of 76%

probably simpler ways to do this, but that's the first thing that comes to mind.
hope that helps.

Old 10 October 2012   #3
Forgot to add :
You need to render to view the effect.
The Viewport doesn't play along nicely with the Multishader
Old 10 October 2012   #4
Hi Aurety,

Im sorry but I really do not understand what you want to do :(

maybe you want to have a easy way to change a texfile with userdata?

the easiest way would be to rename the textures to 0.png , 1.png , 2.png
and trigger them with a integer value. you can add the ".png" with the math node switched to string I think.
that way it doesn't matter if you have 4 or 1000 texture files. you don't have to change anything in the xpresso.

best regards
Old 10 October 2012   #5
made a quick example.

used this Formula : User Data * (255/number of cards) + 1
so if you add cards, just increase the number of cards value.

Old 10 October 2012   #6
Thanks for the answers, nice approachs both.

Douwe, I will probably add more cards, in fact I don't know how much.. And Jops, it's a really good idea but my idea is to make a tutorial for a french guy on our forum to build various 2D ( no morphs ) lips or eyes synching approaches.

The first method I used was to build a large picture with 200 px for each expression ( with alpha mask ) then used a driven data to offset the picture in step mode. Nice results but I would prefer a individual picture by expression. But it works nice

2nd approach, I used one material for each expression and add a link list node to switch betwwen them. Work nice too...

third, I tried to use the multishader approach, to link all the various expressions in one time then find a way to driven theses. that's all but with your answers, I will have ton investigate further more :-)
Frenchcinema4D Moderator
my website :
Kamigaz® Project on : Pinterest
Old 10 October 2012   #7
pfff ! Douwe... simple as that ! as always... I would like to have your brain... thanks !
perfect, i will try with that.
Frenchcinema4D Moderator
my website :
Kamigaz® Project on : Pinterest
Old 10 October 2012   #8
Glad I could help you out.
Sounds like an interesting setup you're working on.

final remark :
There's no need for that Range Mapper i put in there.
You can skip it by dividing the outcome of that formula by 255

(user data*(255/number of cards)+1)/255


Edit : Oops.

Last edited by douwe : 10 October 2012 at 08:42 PM.
Old 10 October 2012   #9
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:56 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.