PDA

View Full Version : Shaders and textures


Mahtan
03-28-2005, 11:16 PM
hi everyone

I am totally new in the texturing field and I've been trying to find a good tutorial or book that explains me what a shader is.

I bought the Digital Texturing & Painting book, and eventhough at the end of each chapter the author explained what shader he had used, i never quite understood what a shader is, the differnece beteween shaders, what is the difference between using a shader or not, or if you always have to use one, is it a matter of preference? what advantages or disadvantages are in using one or not?

I'd really apreciate if anyone could point me in the right direction, thanks

jeremybirn
03-28-2005, 11:56 PM
A shader is a description of how a surface will respond to light. For example, will it look shiny or dull? If it's shiny, will it reflect light like a phonograph record with highlights streaking out from the center, or with focused reflections like mirror, or soft reflections like your kitchen counter? Will it be translucent like a leaf or a candle, and if so, how does light move through it? These kinds of issues (and many more) are programmed into a shader.

You can adjust variables in the shader, and apply texture maps to attributes of the shader, in order to design the exact surface appearance of your object.

-jeremy

Mahtan
03-29-2005, 09:24 PM
thanks

just a couple of more questions..

so everytime we apply a texture map whether it is as a color map, bump, transparency etc, are we using a shader?

or in other words shaders use texture maps to define some of its atributes. am I right on this or not?

and my other question is where do you get shaders from?
do they come with the software or do you buy them separately as plug-ins?
or can you make your own ones? and how?

thanks again for taking the time in reading this

Ian Jones
03-29-2005, 10:10 PM
"or in other words shaders use texture maps to define some of its atributes. am I right on this or not?"

Yes

" do they come with the software or do you buy them separately as plug-ins?
or can you make your own ones?"

All of the above.

"and how?"

That depends on your software, and what you want to create.

Mahtan
03-29-2005, 11:09 PM
thanks again

ok I use lightwave 7.5
what would you recomend I should start learning in order to be able to creatre my own shaders?

like... do I need to learn any specific programming language?

or does lightwave has any tools that allow me to create my own shaders without having to learn any programming?

JJ54
03-30-2005, 10:14 AM
Leigh van derByl (CGTalk admin) has a great book on this for LightWave. Also, her website has some good information to get you started.


Jim

Mahtan
04-01-2005, 11:09 PM
thanks for the link
I already ordered her book, I am waiting for it to arrive

ok I think I am begining to understand what a s shader is and what we can use it for
please correct me if I am wrong

you could say that a shader is a more advanced way to texture 3d models than just simly applying a color, bump, speculary, etc texture maps to it.

with a shader you can get more control of how the light affects the surface of an object than just by using texture maps

for instance, you can apply color to the specular highlight or even have several specular highlights.

but my question is
couldn't you get the same results of some of these shaders by simply rendering in layers?
I mean if you need several specular highlights couldn't you just render each highlight in a separate pass? i mean you could even have diffrerent texture maps for each pass

I guess what I am trying to say is
could you get the same results if you render an image in passes than if you use a very sophisticated shader?

again please correct me if I am mistaken
thanks

madart
04-02-2005, 05:54 AM
You always have a shader to your objects, but you can choose not to have any maps/textures if you would want to, but the shader is always there. When you create objects, there always is a default shader (Maya grey Lambert, XSI grey Phong(?) and Studio Max has a Blinn (Phong?) default shader I think and LW, I have no idea).

You usually change the shader to the one that you want, to help you decide, you think about the things that Jeremy Birn said. What does the object look like, specularity, reflection, translucence, etc. When you have decided on your shader, you make and/or add your textures.

You can if you like, make several rendering passes. There are several ways of making different passes, there's beauty passes, highlight passes, shadow passes, reflection passes etc and you then composite theses passes. You can also render layers, different objects on different layers, foreground-background etc. I won't go further into this, as I know that Jeremy Birn is an expert at this.
Hope this explains it a little more.

leigh
04-02-2005, 06:25 AM
The shader confusion arises from the fact that the terminology used differently from software package to package.

As Jeremy pointed out, the most universally accepted description of a shader is basically the way in which the surface responds to light. It is the quality of the surface, as opposed to its details.

Sometimes the term shader is simply used to describe the entire material, textures and all, applied to an object.

In LightWave, a shader is defined as a seperate plugin/script applied to the Shaders tab in the Surface Editor, which alters the surface as a whole.

madart
04-02-2005, 06:57 AM
Ooops, maybe I confused Mahtan with my description, I don't use LW at all.

Mahtan
04-02-2005, 11:03 PM
thanks madart!

you didn't confused me, in fact I think you explained me exactly what I was trying to understand, objects always have a shader applied to them, and each package applies its default shader to obejects automatically,

I think this is where I was more confused, because when I looked at the options of some of the shaders, it seemed to me that all those options were already available under the basic tab of the surface editor in lightwave, therefore it didn't seem logical to me to use a shader if you already had those options available, but what I didn't know was that I was already using a default shader applied by lightwave.

Leigh, excellent website! really anxious to read your book
I have a question though, when you say:
"In LightWave, a shader is defined as a seperate plugin/script applied to the Shaders tab in the Surface Editor, which alters the surface as a whole."

you mean that when we load a shader from the shaders tab in the surface editor we are loading a script that modifies the default shader applied by lightwave or that we are changing the shader used by lightwave?

madart
04-03-2005, 01:56 PM
Glad I could be of some help, Mahtan. But I am really just as curious as you as to how it works in LW, because it seems to be somewhat different than most other 3D applications. Well good luck, Mahtan!

leigh
04-04-2005, 07:11 AM
I have a question though, when you say:
"In LightWave, a shader is defined as a seperate plugin/script applied to the Shaders tab in the Surface Editor, which alters the surface as a whole."

you mean that when we load a shader from the shaders tab in the surface editor we are loading a script that modifies the default shader applied by lightwave or that we are changing the shader used by lightwave?

You're simply using a plugin that gives you additional shading features :)

Mahtan
04-08-2005, 10:31 PM
thanks Leigh

sundialsvc4
04-08-2005, 11:12 PM
One way to think of it is, the word "shader" really refers to any procedure ... any fragment of executable computer code within the system (or in an external plug-in module) ... that determines or helps to determine what any (and every) pixel on a surface will ultimately "look like."

Although the english term "shader" strongly implies that a shader would just determine how "shady" (vs. "bright") a point might be, the term as it is used in CG is really much more abstract and much broader in compass. A surface may have dozens of attributes, not just "brightness," and shader-functions determine every one of them. Maps, curves, and so-on may be used to provide inputs to those shaders.

Furthermore, there's quite a "production line" of steps that we go through from start to finish in producing a frame, and shader-functions may be invoked at many different steps along that timeline, for many different purposes. The term "shader" is shamelessly applied in situations that have nothing to do with individual pixels. It's simply become a colloquial term de jour, "for lack of a better word" perhaps... and it's as good a word as any, I suppose.

All CG packages provide a selection of shaders, and the plug-in API (application programming interface) of more advanced systems generally allow you to supply shaders of your own, generally written in C or C++. Whether you ever actually need to do this depends on whether or not you work at Pixar. ;)

---

The term "texture" is, of course, very closely related to shaders, although not quite the same. You might think of a "texture" as the set of parameters (including input values, map selections, choice of shaders and so on) which determine how particular faces of particular objects ... that is, "those which use this texture in some way" ... are to be rendered. As the various objects and faces move through the production-line that I spoke of earlier, each of the faces that use Texture #1 will be handled one way; textures #22 and #79 and #143 another. They'll pass through (perhaps) different shaders, giving each shader different inputs, maps and so-forth, and thus come out looking differently. The term "material" has a similar meaning but on an even broader scale, affecting the production-line in even more places (and including the selection of textures.) But only the term "shader" refers to executable computer code.

CGTalk Moderation
04-08-2005, 11:12 PM
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.