problems understanding the functions

Started by al91, December 01, 2009, 11:30:24 AM

Previous topic - Next topic

al91

um i have problems understanding the functions shaders and what exactly they do..can anybody explain them to me?

FrankB

they are primarily math functions that apply an operation to the color or position of the procedural geometry or anything really that you feed into it.

An example for a function could be to apply a sine to the color of a surface layer. To do that, you would

- start with a "get position in texture" node
- feed that into "x from scalar" (for example, or y or z)
- feed that into sin
- feed that into the color function input of your surface layer.

This network of function nodes gives you color[-1;1] = sin(x)

For any function, you need to feed them coordinates at the top of the function chain. That's essentially how functions work. In a nutshell. A tiny nutshell.

Frank

domdib

Dear Frank,

Please consider expanding the tiny nutshell to something more approaching coconut size  ;) Perhaps (as I've hinted elsewhere) there's an NWDA tutorial or product in there somewhere?

Regards,

Dominic

PorcupineFloyd

Yes, a basic approach to functions is so much needed.

Zairyn Arsyn

WARNING! WIZARDS! DO NOT PREDICT THE BEHAVIOR OF OTTERS UNLESS YOU OBEY BIG HAPPY TOES.

i7 2600k 3.4GHZ|G.skill 16GB 1600MHZ|Asus P8P67 EVO|Evga 770GTX 4GB|SB X-FI|Antec 750W
http://zlain81.deviantart.com/

FrankB

Quote from: domdib on December 02, 2009, 09:38:47 AM
Dear Frank,

Please consider expanding the tiny nutshell to something more approaching coconut size  ;) Perhaps (as I've hinted elsewhere) there's an NWDA tutorial or product in there somewhere?

Regards,

Dominic

Ok, ok... I'll try to put something together after christmas. No time before that unfortunately :(

domdib

Great news! Something to look forward to AFTER Christmas  :)

PG

I think the biggest problem people have, I certainly do, is that they can see how you do it but can't understand why you'd want to. I can see what that function does but I wouldn't have the first clue how it works or what I could do with it. Maybe that's due to the awful syllabus that English schools are afflicted with, but if I wanted to create a swirling cloud mass or something like that I wouldn't have the first clue where to start. So I think a Terragen-centric maths lesson would be required first for a lot of people.
Figured out how to do clicky signatures

FrankB

that's true, PG, and it gives me a headache when thinking about a tutorial that is to be broadly understood.
I don't feel inclined to teach maths as such, but then I also know that nobody will actually understand the use of functions, or use them purposefully without maths.

Secondly, I'm not a maths expert. I have once tried to create a cyclone function, but failed, because I don't know what the right math formula for it would be. Sometimes it's also difficult for me to translate pure math functions into node elements that are available in TG2. In maths, you often have to transform an equation, which is an art on its own, and requires a lot of knowledge in maths.

To take a very simple example, let's say you find in a book, that the formula you're looking to have is tan(x), and assume the TG2 doesn't have a TAN function node. If you don't know that you could transform TAN into sin(x)/cos(x) instead, you would be lost.

However, what i could do is explain the functions that I do understand, and how to a. build them in TG2, and b. apply them to a scene in TG2 in practice. That's as far as I can go with a tutorial. If that's still helpful, I'm happy to do it.

Cheers,
Frank


PG

Yeah that seems the most sensible approach. I think that knowledge and teaching of mathematics varies too much between people and indeed between nations so even if we had a TG2-centric maths lesson it could still skip over areas that many don't understand.
Figured out how to do clicky signatures

domdib

Perhaps some of the more mathematically inclined function experts might be able to supplement your work Frank? Maybe in that case it could go on the wiki, with links to some of the threads that have used functions in the past? Since I'm the one requesting it, I could do this.

Oshyan

The wiki would be a great place for collaboration on this, to be sure. But I think everyone should also keep strongly in mind that the vast majority of scenes - even those of highest quality - are accomplished without the use of functions, or at least without the creation of new function networks (i.e. someone may use an existing function network clip, but is unlikely to create some new technique). Function nodes are very powerful, to be sure, but they are not by any means a necessity to using TG, or even to knowing it well and accomplishing very complex and realistic scenes. They are perhaps most useful for accomplishing the unusual, the otherworldly, etc. though of course they also have potential value in realistic settings. But no one should have the impression that they're missing out and their TG2 scenes aren't good *because* of their lack of knowledge of function nodes.

Additionally, for anyone who does have a real interest in this, there are books written that will give you as good an introduction as anyone here could give you, and quite frankly a more comprehensive understanding that will be applicable not just to TG2, but the many other CG industry applications that build shaders in similar ways. This book has been suggested quite a few times, and it remains one of the best references available:
http://www.amazon.com/Texturing-Modeling-Procedural-Approach-Kaufmann/dp/1558608486/ref=sr_1_1?ie=UTF8&s=books&qid=1244894170&sr=1-1

The bottom line is if you're really interested in using the power of function nodes, you'll need a strong understanding of math, and to spend a good amount of time learning to understand how math can build 3D graphics. It will require dedication. If you're not already inclined toward math, you may not want to stick with it long enough to really get much innovation and benefit from function nodes. But again that doesn't mean your scenes will suffer. :)

- Oshyan

Henry Blewer

FrankB asked me to write about what I know. So I am going to be doing some experiments with them. When I think I have enough knowledge, I'll write up a tutorial about that group of functions.
Oshyan will probably need to make a bunch of corrections. ::) But, at least then the thing will be correct. 8)
It has been 15 years since I have done any real math, except for fractal programs like ChaosPro. But Chaospro makes it easy.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

Henry Blewer

The book is kind of pricey, but the excerpts I read are well written.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T