🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

basic shader questions

Started by
1 comment, last by cozzie 4 years, 2 months ago

Hi

as a shader newbie, I want to use a existing shader but don't understand to begin those:

// textures

uniform sampler2D u_textureFg;

uniform sampler2D u_textureBg;

// alpha-blends two colors

vec4 blend(vec4 bg,vec4 fg){

How should I give a loaded texture to for ex:

uniform sampler2D u_textureBg;

Why is it later only named bg and not u_textureBg?

Many thanks

Advertisement

You might need to start with some HLSL basics, for example this could work: http://rbwhitaker.wikidot.com/hlsl-tutorials

Answering your question(s):

  • uniform means you can update it from outside the shader
  • the names of variables can be many things ?
  • the vec4 bg is a 4d vector, the u_textureBg is a texture sampler, which is used to determine how the texels of a texture are sampled

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

This topic is closed to new replies.

Advertisement