Hello.
I'm making my first shader inspired by the easy-findable shockwave shader on the web (yeah, it's the same one on many pages with very little variations). So I said I would do something accessible for my entry level (that is level 0.5). Once I get it to work, I'll post it so to have to what to laugh in a few months - a year when I'll master the shading techniques. Just kidding (half).
OK, generally I'm self-teaching but when I get too deep into the mud I ask somebody else for help. From what I could see, coding shaders has very strange things compared to CPU programming so I feel a little lost.
My first concern is performance; I read everywhere to move the code as "higher" as possible (CPU - vs - fs, in this order) I've also read that many short/fast shaders can actually slow things down compared to fewer, longer ones.
I'd like some opinions from people that has coded shaders enough to be able to tell; roughly, what's faster/slower of the following, so I can build a style of coding?:
1. create new variables in the shader
2. extra operations (to avoid mediated variables)
3. function calls (built-in or otherwise, nested)
4. branching (even nested)
5. iterating (even nested)
Now from what I've read the opinions about branching are split in halves: some say avoid it at all costs, some say it's not the case anymore since years back, due to new hardware changes. I find it very cumbersome to avoid ifs and fors.
I know feel develops in time but a coarse indication would help a lot.
Other tips you could share?



). Once I get it to work, I'll post it so to have to what to laugh in a few months - a year when I'll master the shading techniques. Just kidding (half).
Reply With Quote
