# Shaders for beginners

**URL:** <https://forum.defold.com/t/shaders-for-beginners/66622>\
**Category:** The Defoldmine\
**Created:** [October 16, 2020, 12:04pm UTC](https://forum.defold.com/t/shaders-for-beginners/66622 "2020-10-16T12:04:27Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [December 28, 2020, 9:55pm UTC](https://forum.defold.com/t/shaders-for-beginners/66622/22 "2020-12-28T21:55:22Z")

</div>

Check this post

> [@Using an if statement in a material fragment script](https://forum.defold.com/t/using-an-if-statement-in-a-material-fragment-script/66621/3):
>
> Yes, syntax is like in C++ : if(){} or if(){}else if(){} else{} To do what you want (pallete modifications) take a default sprite.fp as a base of your new fragment program: varying mediump vec2 var\_texcoord0; uniform lowp sampler2D texture\_sampler; uniform lowp vec4 tint; void main() { // Pre-multiply alpha since all runtime textures already are lowp vec4 tint\_pm = vec4(tint.xyz \* tint.w, tint.w); gl\_FragColor = texture2D(texture\_sampler, var\_texcoord0.xy) \* tint\_pm; } above,…

---

_[View the full topic](https://forum.defold.com/t/shaders-for-beginners/66622)._
