Answer the question
In order to leave comments, you need to log in
What math is needed to write shaders?
Hello! I was very intrigued by the shaders in Unity3d, but there, as I see it, one cannot do without mathematical manipulations. Who fumbles in shaders, tell me what you need to know? I just got the idea to run to the tutor, and there, after all, there will be a need for some specifics, because. there is no interest in studying all mathematics - only in essence. Thank you for your attention!)
Answer the question
In order to leave comments, you need to log in
There are two types of shaders: vertex and fragment.
The vertex shader can manipulate and modify specific mesh vertices. Those. at the input we get an array of vertices (for example, 8 pieces for a cube) and we must give it to the output with new parameters. To write such shaders, you need knowledge of trigonometry and vectors.
The fragment shader controls the color of a particular pixel on the screen. Those. at the input we receive an array of pixels in rgba format (red, green, blue and alpha channel) and must return the modified array at the output. It's pure math for me.
In general, there is nothing mega-complicated there. The language already has 100,500 ready-made functions for working with vectors, for example. The main difficulty is that at first you will have to climb the documentation very often.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question