Hi mogn,
Quote from: mogn on September 12, 2007, 02:57:11 AM
My reason to object conditionals are that the mind must follow more threads to deciffer a conditional.
E.g it is easier to understand:
x = 1;
if (condition) x = 2;
That's how the Conditional scalar node works, if you don't provide an else value.
Quote
than:
if (condition)
{
x = 2;
}
else
{
x = 1;
}
You don't have to do that with the Conditional scalar node.
If you simply talking about stylistic things in programming languages, I really dislike this form :
x = 1;
if (condition) x = 2;
for two reasons. One is that it becomes inconsistent, you end up having two conditional clauses which look different, one with brackets and one without, which makes the code harder to scan. Second, you can't set a break point on the statement so that the breakpoint only gets hit when the conditional is met. Matt does things like that all the time, and it drives me nuts :-).
I much prefer this form :
x = 1;
if (condition)
{
x = 2;
}
for consistency and ease of debugging.
There is a good reason to avoid conditionals in node networks if you can, and that is because conditionals introduce discontinuities ( i.e. hard edges/transitions ) which the renderer doesn't like, it causes aliasing and jagged edges. This is only really an issue in logic which makes things visible. It is often better to use a smoothly interpolated transition area between areas of two different values. A future version ( next alpha release, anyway ) will have a smoothstep function to make this easier. That isn't to say that conditionals aren't very useful, because they are :-).
Regards,
Jo