


Moderators: jesterKing, stiv
Code: Select all
+
1 2
Code: Select all
1
+
2
Code: Select all
+
1 *
3 /
4 8
Code: Select all
(1 + (3 * (4 / 8)))
Code: Select all
4 / 8 * 3 + 1
Code: Select all
(1 (3 (4 8 /) *) +)
Code: Select all
1 3 4 8 / * +
Code: Select all
(+ 1 ( * 3 (/ 4 8)))
Code: Select all
4
/
8
*
3 +
1
Code: Select all
/\
o o
/ \
o o
/ \
o o
Code: Select all
for ($x = 0 ; $x < 10 ; $x++) {
if ($x == 5) {
$y = 10; print "hello";
}
}
Code: Select all
(for (= $x 0) (< $x 10) (++ $x) (if (== $x 5) (expressionlist (= 10 y) (print "hello")))
Code: Select all
(($x 0 =) ($x 10 <) ($x ++) (($x 5 ==) ((10 y =) ("hello" print) expressionlist) for)
Code: Select all
(for ($x = 0) ($x < 10) ($x++) (if ($x == 5) (($y = 10) (print "hello"))))
Code: Select all
/\
o o
/ \
o o
/ \
o o
Code: Select all
label:
statement
statement
statement
if (not condition) jump next statement
goto label
statement
statement
Code: Select all
initial statement
label:
if (not condition) jump the next statement
goto next_label:
statement
statement
statement
goto label:
next_label:
statement
statement
Code: Select all
mov cx,80 ; # of stars
mov ah,2 ; disp char fnctn
mov dl,'*' ; char to display
TOP:
int 21h ; display a star
loop TOP ; repeat 80 times
I read your post a couple of times. I have no idea how shader compiling works but I can tell you how it works in Crafter/YafRay at the moment.And as I describe in the previous message,
can be represented visually.. However a for-loop can't be executed in parallel because it implies a linear process (or interative form) of execution, it would need a top-down evaluation (starting with the parent node and evaluating the children, this like going backwards, from right to left, for crafter, a module would have to control other modules to get a result), which you probably can't do with crafter at this time..
yea, something that good and complet than it could modifie it way of working for the selected render( a limited tree for blender internal and a full compatible renderman for aqsis for ex.)Monkeyboi wrote:Sounds nice that you are going to implement!
But, why not replace the Material buttons?
BTW, for inspiration on node-based material editors, I strongly suggest you download a demo of Softimage XSI, either the 30-day full version or the XSI Experience version. Then follow one or two tutorials and see just how powerful it is! I apreciate Crafter, but I still think XSI might serve for some good inspiration.
This new Material editor will also have to be able to simulate pretty much everything that is possible already, including setting texture mapping, controling ramps and shaders etc.
Lastly, very good luck to you, a nodebased material editor would be such a boon for Blender.
So when you evaluate a material, you recursively travserse your node tree from the material definition at the root, and work down to all the children until you reach the leaf nodes and formulate a result on the way back up the node tree.wavk wrote: There's basicly a hardcoded class derived from a base material block class, that's implemented for each type of material block, in YafRay. A material block does it's math by asking it's children to give their output. These children at their turn ask their children for their output, until the tree ends.
Well you know from working in C++, a class is a blueprint, object is the instance of the class blueprint.. In the implementation of a language, you can have a class defined for every command-type (not talking about the working structure but the language but the parts of speech that are used to define how you express ideas in it). The shader is evaluated from the top node to the bottom by calling methods on the child nodes that recusively call their child nodes, with the resulting solution to the shader passed up the tree to the root node. This may be efficient or may not for runtime.wavk wrote: So the shader blocks diagram at render time is converted, well converted, not even that. The shader diagram should be a visual representation of an instance of a class that has the code in it. I don't think it could be any faster.
Okay.. Well I something like that.. I mean the intermediate language for most languages is a tree, so why not give the users access to this tree to program with, rather than giving them a text based language (like python). It could be very simple visually.. But I think it could be reduced with the addition of a method of grouping. The idea is to make it visual and easy to diagram.. This way you are avoiding the pitfalls of text-based languages : "syntax errors", which are really when the parser can't figure out hwo to interpret some character symbols that it didn't expect.. In the node-based or graph based language, the errors would be less granualar and more like "missing blocks".. Like "you have a missing incrementer in the for loop". So the user would just add an incrementer block and set it to increment by one.. Rather than having to deal with "expected statement in line 15"). The problem with most computer languages is the interpretation of text into semantics.. So why use the text at all.. That was the idea behind my previous messages.. But it may be simpler to just represent the commands or nodes that are useful in making shaders than creating a whole programming language.Anyway, don't think there should be an intermediate shader language, that would only slow things down. And I think everything should be made possible by simple blocks. The math itself will be precompiled inside blender. It's just functions asking other functions their output.
Make the internal model accessible graphically to the users to program with.. Almost one to one.. If you don't make it one-to-one, you will ahve to deal with the complexities of cross-linked nodes and problems with representation and the actual representation. I think the big problem with object oriented design, the way it was presented to commercial developers is that is allowed for commercial developers to "hide" their implementation, not for the purpose of protecting the users from the implementation, but to protect the commercial developers from competitors, by implementing something that changes the way users think and not about giving them tools of thought that they can reuse anywhere they go.. Microsoft for instance has a tendency to change the language so that users of Microsoft tools can't talk to users of Linux tools, Java tools, etc.. Either they change the spoken language, or the programming languages, or the way the tools connect (protocols, container formats, function libraries, tool sets). Its also the way that patents push program design.. It just results in a mess of protective indirect reasoning that just ends up perpetually leaving users in the dark.Is that what you mean? Are you suggesting an internal kind of way to handle the maths of a tree based system?
Sorry.. I haven't the greatest way of expressing myself, it just comes out this way because I think as I type.. Some have better ways fo organizing thought, I have an objective model in my head that seems good until I talk about it, and then it kinda changes form.. So if I don't sound consistent, I'm nto making up somethign different everytime.. Its like I'm chipping away at a stone trying to approximate a sculpture but I haven't a verbal way to get at that without talking a lot.. Rome wasn't built in a day..Argh look at what you made me do! This must be my longest post ever!If you want to help, please do! I think it's quite a lot of work.
I think I'll start off with a simple thing... making a new space type in blender!