PDA

View Full Version : shader flow thread


maks
08-31-2003, 09:13 PM
Hi there!

I start this thread so that people can share their problems and findings with the shader and texture workflow in messiah. Beeing used to LWs layers, I sometimes feel confused when trying to figure out how to connect gradients, texture maps and other shaders together with all these input and output parameters. But on the other hand the shader flow is so much more powerful that I really want to understand it better - then again, I'm not a shader pro after all ;)
I currently try to reproduce some basic gradient usages from this LW tutorial: http://www.blochi.com/gfx/gradients_en.html
And here's what I came up with to blend 2 textures together based on the slope input parameter: http://maks.free.fr/Stuff/mstudio_stuff/gradient_slope_textures_blend.jpg
I also posted this scene in the yahoogroups filesection: http://f4.grp.yahoofs.com/v1/oDdSP6WUYvxIQ_TiF9lHlmSEKhnA3FDC4AbdfAA5FL83aaSiqojgmGGkN8ypAzPVOvoE3Tb1sTtZvnuVsWo4aQ5ApXE/Sample_Content_Public/Materials/project%20files/grad_slope_textureblend.mpj

So, feel free to post and discuss your findings, beginners and pros alike, and maybe we can put together a good example vault or maybe even some tutorials :)

cheers! :beer:
M.

P.S.: maybe we can make this therad a sticky one, don't knwo how this works...

Sil3
08-31-2003, 09:41 PM
Iīll second that

This shader and texture stuff might be extremly powerfull, but itīs also extremly complicated to get the gripes with. If we dont know how to use this workflow all itīs power will be lost. :hmm:

I hope that proper tutorials for this in Messiah Studio 1.5 will be available in the Docs, and i mean proper tutorials, not something in the likes of:

"The final stupid-looking shader. I hope you're proud of yourself."

:shame:

maks
08-31-2003, 11:01 PM
Here's another one, from a question some time ago on the yahoo list - color based on the bump input:

http://maks.free.fr/Stuff/mstudio_stuff/color_based_on_bump.jpg

though this may be very simple stuff, it helps to understand the basics :)

M.

maks
08-31-2003, 11:14 PM
bad link in the first post, sorry :shrug:
here's the correct one to the files for these examples:
http://groups.yahoo.com/group/pmGmessiah/files/Sample_Content_Public/Materials/project%20files/

M.

maks
08-31-2003, 11:30 PM
And here's a post on gradients from Lyle some time ago - I though it might be useful to post it here, in case somebody missed it :)


Using Gradient & Fresnel

Gradient & Fresnel is quite arguably one of the most essential shaders. Once you understand how it works, you'll find yourself using it in every shader flow (material). But in order to understand it, it's important to break things down.

The Gradient_&_Fresnel shader, as its name suggests, is actually two shaders in one: a gradient shader and a fresnel shader. They are combined into one because they are most commonly used together. i.e., while fresnel is quite useful all by itself, gradient is useless without some form of input. And since fresnel is the most common input to gradient, they are combined into one for efficiency and to reduce the complexity of the shaderflow.

There isn't much that needs to be understood about the [pure] gradient side of things. On the Gradient block, you add color markers to the color range area, edit them, and you're done. The beginning of the gradient represents 0.0, and the end represents 1.0. The fresnel portion is, of course, more complex. Rather than go into a technical discussion about the various options, I'll just give a brief description.

u

This parameter can be used to cycle through the colors in the gradient. A value of 0.0 is the beginning of the gradient, and 1.0 represents the end.

Light Fresnel

You can control the gradient based on how the light hits the surface. As the spot on the surface receives more light, the color migrates to the end of the gradient; the darker the spot the more the color migrates to the beginning. Note that you can exclude lights by hitting F3, and "unchecking" the lights you want to exclude.

Camera Fresnel

You can control the gradient based on how the camera sees the surface. As the spot on the surface is faces away from the camera, the color migrates to the beginning of the gradient. Conversely, as the spot faces the camera, the color migrates to the end.

Normal Slope

This parameter uses the (world space) normal of the spot on the surface to control the gradient. As the normal faces the ground, the color migrates to the beginning of the gradient; as the normal faces the sky the color migrates to the end.

Output Buffer

This parameter uses the value that's already computed in the attached input on the target node to control the gradient. For example, if you've applied noise and a texture map shaders to the color input on the material, you could use the values that noise and texture map sent to the material's buffer to produce the required 0.0 - 1.0 values. This will, of course, determine the color computed for the gradient. Note: alternatively, you could attach the noise and texture map outputs to the u input on the gradient. This can yield similar effects.

Compute Light & Camera As Specular

There may be times when you want to control the gradient based on specular highlights. The most common example of this is when you need to control the specular color of a material. If you activate Light and Camera Fresnel, you can use this feature to compute the specular value. Use the accompanying Specularity and Glossiness channels to control the specular just as you would on the material.



Putting It All Together

Gradient_&_Fresnel can add a whole new dimension to your images. You'd use the various options to produce real-world materials that are not possible to create otherwise. And keep in mind that the fresnel options aren't exclusive; you can use, say, Normal Slope with Camera Fresnel at the same time.

To see a demonstration of some of the various fresnel options, download this sample image.

http://groups.yahoo.com/group/pmGmessiah/files/MessiahStudioImages/lyle_gradient.JPG

Spheres 1 - 4 have a simple gradient attached to the color of the material. Luminosity is at 1 so you can see the full effect. Spheres 5 & 6 use a combination of gradients and noise to produce real world and not-so-real world effects.

5 uses a specular gradient to create the "undercoat" gloss. Noise is used to distort the glossiness of that gradient. There is a second specular gradient to create the white hotspot (since it's a separate gradient, it doesn't get distorted by the noise. It also has a camera gradient that controls the level of reflectivity.

6 is a bit more complex (but was very easy to create). Compounded noise is used to control u value of a gradient that's attached to the color on the material. It uses a specular gradient to control the level of bump on the surface. That same gradient is used to remove the effects of the first gradient. There is an additional light gradient that provides some extra color layering.

If you'd like to check out the scene file, get it here.

http://groups.yahoo.com/group/AdvanceRelease/files/lyle_gradient_scene.zip

:thumbsup:

lmilton
09-01-2003, 08:26 PM
Originally posted by Sil3
Iīll second that

This shader and texture stuff might be extremly powerfull, but itīs also extremly complicated to get the gripes with. If we dont know how to use this workflow all itīs power will be lost. :hmm:

I hope that proper tutorials for this in Messiah Studio 1.5 will be available in the Docs, and i mean proper tutorials, not something in the likes of:

"The final stupid-looking shader. I hope you're proud of yourself."

:shame:

If you're coming from LW, you're bound to find the shaderflow extremely complex & confusing the first time you see it. This is because LW tends to provide you with a button for virtually every feature you'd need. messiah's shaderflow uses a different paradigm; you'll have to construct whatever you want. It may seem difficult, but the main advantage is that once you learn it, you know virtually everything you'll ever need to know to create some powerful & fantastic looking shaders, no matter how many shaders/features are added to the system.

The interesting thing is, you already know how to use it, but just haven't made the "visual" connection. If you try to visualize working with, say, Photoshop (PS) you'll have a much easier time. Try to visualize each input as a separate PS image.

For example, Marek's original objective was to have one image cover another, but to change the opacity of the "top" image so that the bottom image would show through. I'm betting that no one here would have any problem, in creating this in PS. You'd:

1. load an image
2. load another image and copy/paste it onto that original image
3. change the opacity of that new image/layer


In messiah it's the same principle, but there are more substeps (this is 3D, after all):

1. Choose TextureMap from the Color popup from the Basic Properties block on the Material you'd like to modify
2. Load an image and set your mapping parameters
3. Repeat steps 1 & 2 for the next image
4. Change the opacity level on the second TextureMap node.


When you look at the Color input on the Material in the shaderflow, you'll see 2 TextureMap_#:Color connections. Think of these as the layers that you deal with in PS. The main differences are that the layers flow bottom to top (PS is top to bottom in the Layers view), and the Canvas is not an image, but the surface of your object.

To further Marek's example, he needed more than just a simple opacity setting, he wanted to smoothly vary the opactity (note in his example, he didn't use a smooth fade). In PS you'd:

1. create a mask for the top layer
2. paint a gradient into that mask "layer" with the Gradient tool


In messiah you'd:

1. Choose "Gradient" from the Opactity channel on the second TextureMap node's Shader block
2. Modify the gradient parameters as desired.


So, it should be clear from this that you're not limited to Color, you can attatch any output to any desired input. Again, if you think of each input as an image/document it's almost a direct association with what you do in Photoshop... even down to some of the layer operators. For example, you can choose Multiply in PS, it's the equivalent of using (x) in messiah.

If you've followed all of this as a kind of tutorial, you'll realize that it's not a great deal different from the workflow that you'd use in LW (in principle). Never once did it require that you touch the shaderflow; you could have "closed" the shaderflow port and everything would have worked just fine. The shaderflow provides another view of the data, and allows for direct manipulation of the inputs/outputs & operators.

Let me know if this has clarified things for you.

-lyle

Sil3
09-02-2003, 12:02 AM
Yes it have, thanks Lyle :thumbsup:

Iīm gonna make some tests now hehehe:applause:

lmilton
09-02-2003, 12:15 AM
Originally posted by Sil3
Yes it have, thanks Lyle :thumbsup:

Iīm gonna make some tests now hehehe:applause:

Great:thumbsup:

I'll create a simple material and post here, as well, in a few...

-lyle

lmilton
09-02-2003, 01:17 AM
This is a very quick & simple example of using the shaderflow:

http://www.projectmessiah.com/x2/misc/scaly_test.jpg

As you can see, there are only 3 shaders applied: Multinoise to generate the scales (cellular noise), a gradient to control the color of those scales, and a gradient to control the apparent bump of the scales.

You'll notice that I left in a disabled connection from the noise to the bump input on the material. I originally made this connection but found that I needed more control over the bump value, so I added another gradient which would be controlled by the noise. I left the bypassed connection in to demonstrate that the shaderflow is very forgiving and is designed for experimentation.

If you'd like to test out this material you can get it here:

Scaly Material (http://www.projectmessiah.com/x2/misc/Scaly.mrm)

Just dump it in your materials directory, and it will be available in the materials palette (F5) the next time you start messiah.

Let me know if you find this info useful.

-lyle

Geco
09-02-2003, 01:29 AM
Originally posted by maks
... If you'd like to check out the scene file, get it here.

http://groups.yahoo.com/group/AdvanceRelease/files/lyle_gradient_scene.zip

:thumbsup:
this is what i get:

AdvanceRelease

Sorry, this group is available to members ONLY.
You are not allowed to access this group.

please, could you attach the file to this thread?
btw why is this list still not open to the public?

lmilton
09-02-2003, 01:36 AM
Originally posted by Geco
this is what i get:

AdvanceRelease

Sorry, this group is available to members ONLY.
You are not allowed to access this group.

please, could you attach the file to this thread?
btw why is this list still not open to the public?

AFAIK, that group is no longer available. Further, that scene file will no longer function as it did in (much) older revs of the Advance.

Where you able to download the image?

-lyle

Geco
09-02-2003, 01:40 AM
Originally posted by lmilton
... Where you able to download the image?

-lyle
yes, thanks.

lmilton
09-02-2003, 01:42 AM
Originally posted by Geco
yes, thanks.

Cool.

Are you finding the shaderflow difficult to grasp?

-lyle

Geco
09-02-2003, 01:48 AM
no, i love it.
it's simply brilliant. http://www.geocities.com/kl_aktuell/temp/smile.txt
btw lyle is a www.messiahstudio.com/forum already on your big to-do-list?

lmilton
09-02-2003, 01:53 AM
Originally posted by Geco
no, i love it.
it's simply brilliant. http://www.geocities.com/kl_aktuell/temp/smile.txt
btw lyle is a www.messiahstudio.com/forum already on your big to-do-list?

Great:thumbsup:

Do you feel that a forum on pmG sites is necessary?

-lyle

Geco
09-02-2003, 01:59 AM
not really, but you will have full control. http://geocities.com/kl_aktuell/temp/biggrin.txt
and other 3d company already have it.

lmilton
09-02-2003, 02:03 AM
Originally posted by Geco
not really, but you will have full control. http://geocities.com/kl_aktuell/temp/biggrin.txt
and other 3d company already have it.

The difference is that those other companies have resources devoted to manage it.

Personally, I like the yahoo group and this CGTalk list. It keeps the messiah community from being too fractured.

Agree?

-lyle

Geco
09-02-2003, 02:16 AM
i agree, but things changes and you will get this resources soon. http://geocities.com/kl_aktuell/temp/smile.txt
personally i like this forum, yahoo is buggy, force members to read the advertising every three or four posts, you can't attach images or files to posts, it's slow, ... http://geocities.com/kl_aktuell/temp/sad.txt

lmilton
09-02-2003, 02:33 AM
Originally posted by Geco
i agree, but things changes and you will get this resources soon. http://geocities.com/kl_aktuell/temp/smile.txt
personally i like this forum, yahoo is buggy, force members to read the advertising every three or four posts, you can't attach images or files to posts, it's slow, ... http://geocities.com/kl_aktuell/temp/sad.txt

I'm with you on the ads. However, we tend not to read the messiah yahoo group online. Most of us receive mail. This way we can keep a local record of the posts, and we're not interrupted with the ads.

The CGTalk forum is great because we can have focused discussions and share images.

And yes, we'll get the resources soon;)

-lyle

Geco
09-02-2003, 03:05 AM
Originally posted by lmilton
... The CGTalk forum is great because we can have focused discussions and share images. ...
yes, and this is also why i would like to see another forum like this inside the pmG home.
ok, i'll quit now.
back to the shader flow thread.

maks
09-02-2003, 10:03 AM
Hey Lyle!

Nice to have you in here!
Thanks for your devoted time to give such detailed explanations, you rule! :buttrock:

I played alot with the shader flow lately, and with the help of some tips from you and others on the yahoo list that got me on the track, I already understand the whole thing a lot better now - in fact I felt silly in the first place not even to be able to reproduce a simple material, but it's just a matter of getting used to the logic (I never used any sort of "trees" before ), and once you get the hang of it, you feel so allmighty :D

BTW, one thing that I first had problems with in the whole thing was the opacity setting, I didn't think of it as an alpha channel, and I discovered just recently that in fact it corresponds to the "Mix" channel on the shader block. Now that I think of the shader block as beeing the "root" of every shader, and the basic properties, gradient, noise whatever block as the parameteres, everything is much clearer in my little mind now, that was somewhat the missing link in my logical reconstruction :lightbulb

Nnnnnnnnice!!!

M.

Thalaxis
09-02-2003, 09:54 PM
Originally posted by lmilton
Great:thumbsup:

Do you feel that a forum on pmG sites is necessary?

-lyle

Not now that CgTalk has this forum here for Messiah :)

CGTalk Moderation
01-16-2006, 01:00 AM
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.