Ashlie M
Ashlie M

Reputation: 1

When should I write a shader?

I'm just starting to explore the world of shaders (specifically in relation to games), but I'm struggling to answer the question, "When should I write my own shader?"

I understand that a fragment shader is essentially responsible for coloring individual pixels, but when is that actually used in practice? What kind of simple games utilize custom shaders to generate scenes that would not have been possible otherwise (by using Unity defaults, for example)?

In general, I have a cursory understanding of what a shader accomplishes, but I don't know when I should use them.

Upvotes: 0

Views: 814

Answers (1)

Doh09
Doh09

Reputation: 2385

As with all code, if the solution you can come up with using shaders does the job you need done, then you can use it. So long as it can run on the OS you are developing for and is not too performance heavy.

Shaders can be performance heavy at times but there are mobile shaders and relatively light shaders made.

What kind of simple games utilize custom shaders to generate scenes that would not have been possible otherwise

Not exactly a game, but here is a demonstration of where shader usage comes in handy to keep water out of a boat.

DepthMaskShader

If you take a look at this video:

https://www.youtube.com/watch?v=7fMCTVhEzmU

And other videos uploaded by the same guy. He shows a lot of examples of effects that would be, to my knowledge, impossible to achieve without shaders. At least much harder to achieve.

Upvotes: 1

Related Questions