|
![](/i/fill.gif) |
Zeger Knaepen wrote:
[Snip]
Nice to see, that someone is playing with shaders and creating such
beautiful pictures!
I took a look to your shader and I must admit, that I don't understand
its semantics at all (as I've never learned Flemish? ;o) But I looked at
it from syntax viewpoint and may I propose couple of improvement
suggestions?
I noted, that you created help function intercol() to mix 2 colors, but
shading language has built-in function mix() with same functionality.
Using it instead of user-function will save couple of commands.
You calculate value of opac from dot production of normalized normal and
incident vectors, later you calculate normalized normal vector again
and store it in variable Norm. By moving this before opac calculation,
you can save one vector normalization.
I'm not sure, what is meaning of variable teken? Will it hold sign of
cosinus? In this case it would be much more effective to use built-in
sign function (note, that sign returns 0, if argument is 0, but in
current case it does not matter, as value of ruis4 should remain same).
There is couple of variables, which values are calculated, but never
used. Better would be to comment them out, if you don't want to delete
them. Unfortunately SL compiler is not so smart, that it could throw
such unnecessary statements away...
Sorry to be so critic, but as my measurments have shown, shader
execution takes great deal of rendering time and every optimization
there is welcome.
However, this shader is quite nice and I'd like to add it to shader
examples section in my homepage (with your permission, of course). And
I'd like to put your contact information (name and e-mail address) there
as well. This would be of course only in case, if you don't have
nothing against it (some people don't want to put e-mail addresses in
web pages to avoid spam). So please reply here or send me mail, if you
agree with it.
Post a reply to this message
|
![](/i/fill.gif) |