跳到主要内容
← Lighting Basics

Lighting Basics

Colors

shader-learning 自学第 1 课:Colors

实时渲染 · 纹理 HLSL

第 1 课:Colors

实现

Texture2D iChannel0 : register(t0);
SamplerState samplerDefault : register(s0);

struct PSInput {
  float4 position : SV_Position;
  float2 uv       : TEXCOORD0;
};

float4 main(PSInput input) : SV_Target {
  float3 lightColor = float3(1.0, 1.0, 0.0);
  float3 objectColor = iChannel0.Sample(samplerDefault, input.uv).rgb;

  return float4(objectColor * lightColor, 1.0);
}