S
S
Station 722015-10-01 14:06:49
Mathematics
Station 72, 2015-10-01 14:06:49

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

2 answer(s)
A
Alexander Movchan, 2015-10-01
@Alexander1705

Linear algebra. Vectors, matrices.

G
GreatRash, 2015-10-01
@GreatRash

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 question

Ask a Question

731 491 924 answers to any question