This would be a bit of work if the approach was to draw lines on the plane. But I also want those lines to be lit. As usual, shade the plane using Blinn-Phong and the grid was created by getting sine of the x & y positions of the fragments. If the sine fell between -0.05 and 0.05, the shaded color was lerped with black to create the grid, ie:
// Blinn-Phong shading comes before this, result ends up in "color"
float4 black = float4(0.0f, 0.0f, 0.0f, 1.0f);
float min = -0.05;
float max = 0.05;
float x = sin(position.x * 0.33);
float z = sin(position.z * 0.33);
if((x >= min && x <= max) || (z >= min && z <= max))
{
color = lerp(color, black, 0.2f);
}
No comments:
Post a Comment