no textures

This commit is contained in:
ethan merchant 2024-11-24 13:30:57 -05:00
parent 9574f17a8d
commit c5e25f37b0
4 changed files with 6 additions and 37 deletions

View file

@ -2,13 +2,8 @@
//--name = dofdev/backbox //--name = dofdev/backbox
//--color:color = 1, 1, 1, 1 //--color:color = 1, 1, 1, 1
//--tex_scale = 1
//--diffuse = white
float4 color; float4 color;
float tex_scale;
Texture2D diffuse : register(t0);
SamplerState diffuse_s : register(s0);
struct vsIn { struct vsIn {
float4 pos : SV_Position; float4 pos : SV_Position;
@ -42,19 +37,17 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
// flip input normals to treat backfaces like normal // flip input normals to treat backfaces like normal
o.normal = normalize(mul(-input.norm, (float3x3)sk_inst[id].world)); o.normal = normalize(mul(-input.norm, (float3x3)sk_inst[id].world));
o.uv = input.uv * tex_scale; o.uv = input.uv;
o.color = color * sk_inst[id].color; o.color = color * sk_inst[id].color;
return o; return o;
} }
float4 ps(psIn input) : SV_TARGET { float4 ps(psIn input) : SV_TARGET {
float4 col = diffuse.Sample(diffuse_s, input.uv);
float3 view_dir = normalize(input.world_pos - input.cam_pos); float3 view_dir = normalize(input.world_pos - input.cam_pos);
// Fresnel effect calculation // Fresnel effect calculation
float fresnel = 1.0 - saturate(dot(-view_dir, input.normal)); float fresnel = 1.0 - saturate(dot(-view_dir, input.normal));
fresnel = pow(fresnel, 5.0); // Adjust power for different falloff rates fresnel = pow(fresnel, 5.0); // Adjust power for different falloff rates
float value = 0.5; float value = 0.5;
return lerp(col, float4(1), 0.666) * float4(fresnel * input.color.rgb * value, input.color.a); return float4(fresnel * input.color.rgb * value, input.color.a);
} }

View file

@ -2,13 +2,8 @@
//--name = dofdev/mono //--name = dofdev/mono
//--color:color = 1, 1, 1, 1 //--color:color = 1, 1, 1, 1
//--tex_scale = 1
//--diffuse = white
float4 color; float4 color;
float tex_scale;
Texture2D diffuse : register(t0);
SamplerState diffuse_s : register(s0);
struct vsIn { struct vsIn {
float4 pos : SV_Position; float4 pos : SV_Position;
@ -33,16 +28,12 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
float3 normal = normalize(mul(input.norm, (float3x3)sk_inst[id].world)); float3 normal = normalize(mul(input.norm, (float3x3)sk_inst[id].world));
o.uv = input.uv * tex_scale; o.uv = input.uv;
float3 norm_color = float3(0.5) + (normal * 0.5); float3 norm_color = float3(0.5) + (normal * 0.5);
float3 norm_shade = float3(0.5) + (norm_color * 0.5); float3 norm_shade = float3(0.5) + (norm_color * 0.5);
o.color = float4(norm_shade, 1) * input.col; // input.col * color * sk_inst[id].color; o.color = float4(norm_shade, 1) * input.col; // input.col * color * sk_inst[id].color;
return o; return o;
} }
float4 ps(psIn input) : SV_TARGET { float4 ps(psIn input) : SV_TARGET {
float4 col = diffuse.Sample(diffuse_s, input.uv); return input.color;
col = col * input.color;
return col;
} }

View file

@ -2,13 +2,8 @@
//--name = dofdev/unlit //--name = dofdev/unlit
//--color:color = 1, 1, 1, 1 //--color:color = 1, 1, 1, 1
//--tex_scale = 1
//--diffuse = white
float4 color; float4 color;
float tex_scale;
Texture2D diffuse : register(t0);
SamplerState diffuse_s : register(s0);
struct vsIn { struct vsIn {
float4 pos : SV_Position; float4 pos : SV_Position;
@ -33,14 +28,10 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
float3 normal = normalize(mul(input.norm, (float3x3)sk_inst[id].world)); float3 normal = normalize(mul(input.norm, (float3x3)sk_inst[id].world));
o.uv = input.uv * tex_scale; o.uv = input.uv;
o.color = input.col * color * sk_inst[id].color; o.color = input.col * color * sk_inst[id].color;
return o; return o;
} }
float4 ps(psIn input) : SV_TARGET { float4 ps(psIn input) : SV_TARGET {
float4 col = diffuse.Sample(diffuse_s, input.uv); return input.color;
col = lerp(col, float4(1), 0.666) * input.color;
return col;
} }

View file

@ -14,8 +14,6 @@ static class Arts
static Material mat_backbox = new Material("backbox.hlsl"); static Material mat_backbox = new Material("backbox.hlsl");
static Material mat_justcolor = new Material("justcolor.hlsl"); static Material mat_justcolor = new Material("justcolor.hlsl");
static Tex tex_box = Tex.FromFile("paper.jpg");
public static Vec3 box_shake = new(0, 0, 0); public static Vec3 box_shake = new(0, 0, 0);
static Quat food_ori = Quat.Identity; static Quat food_ori = Quat.Identity;
@ -42,10 +40,6 @@ static class Arts
Color.White Color.White
); );
// mat_mono.SetTexture("diffuse", tex_mono);
mat_box.SetTexture("diffuse", tex_box);
mat_backbox.SetTexture("diffuse", tex_box);
mat_backbox.FaceCull = Cull.Front; mat_backbox.FaceCull = Cull.Front;
mat_backbox.Transparency = Transparency.Add; mat_backbox.Transparency = Transparency.Add;
mat_backbox.DepthTest = DepthTest.LessOrEq; mat_backbox.DepthTest = DepthTest.LessOrEq;