Boom exam done!

This commit is contained in:
2024-12-25 03:14:05 +01:00
parent 28c27a8706
commit 9f90739b90
66 changed files with 9992 additions and 8378 deletions

View File

@@ -1,4 +1,5 @@
SamplerState gSampleState : SampleState;
RasterizerState gRasterizerState : RasState;
float4x4 gWorldViewProj : WorldViewProjection;
float4x4 gWorldMatrix : WorldMatrix;
@@ -39,12 +40,12 @@ struct VS_OUTPUT {
//----------------------
// Rasterizer state
//----------------------
RasterizerState gRasterizerState
{
CullMode = none;
FrontCounterClockwise = false; //default
};
// //----------------------
// RasterizerState gRasterizerState
// {
// CullMode = none;
// FrontCounterClockwise = false; //default
// };
//Vertex shader

View File

@@ -0,0 +1,141 @@
SamplerState gSampleState : SampleState;
RasterizerState gRasterizerState : RastState;
float4x4 gWorldViewProj : WorldViewProjection;
float4x4 gWorldMatrix : WorldMatrix;
texture2D gDiffuseMap : DiffuseMap;
texture2D gNormalMap : Normal;
texture2D gSpecularMap : Specular;
texture2D gGlossMap : Gloss;
float3 gLightDirection : LightDirection;
float3 gLightColor : LightColor;
float3 gCameraPosition : CameraPosition;
bool gUseNormal : UseNormal;
static const float3 gAmbient = float3(.03f, .03f, .03f);
static const float gLightIntensity = 7.f;
static const float PI = 3.14159f;
static const float gSpecularReflectance = 1.f;
static const float gShininess = 25.f;
//Input output
struct VS_INPUT {
float3 Position : POSITION;
float2 TexCoord : TEXCOORD;
float3 Normal : NORMAL;
float3 Tangent : TANGENT;
};
struct VS_OUTPUT {
float4 Position : SV_POSITION;
float4 WorldPosition : WORLDPOSITION;
float2 TexCoord : TEXCOORD;
float3 Normal : NORMAL;
float3 Tangent : TANGENT;
};
//----------------------
// Rasterizer state
//----------------------
// RasterizerState gRasterizerState
// {
// CullMode = none;
// FrontCounterClockwise = false; //default
// };
//Vertex shader
VS_OUTPUT VS(VS_INPUT input){
VS_OUTPUT output = (VS_OUTPUT)0;
output.Position = mul(float4(input.Position, 1.f), gWorldViewProj);
output.WorldPosition = mul(float4(input.Position, 1.f), gWorldMatrix);
output.TexCoord = input.TexCoord;
output.Normal = mul(input.Normal, (float3x3) gWorldMatrix);
output.Tangent = mul(input.Tangent, (float3x3) gWorldMatrix);
return output;
}
float3 Phong(float ks, float exp, float3 l, float3 v, float3 n)
{
float3 reflected = reflect(l, n);
float cosAngle = dot(reflected, v);
return ks * pow(max(0.f, cosAngle), exp) * gLightColor;
}
float3 Lambert(float kd, float3 cd)
{
return (kd * cd) / PI;
}
float3 Shade(VS_OUTPUT input)
{
// Sample diffuse, specular, and gloss maps
float3 diffuseSample = gDiffuseMap.Sample(gSampleState, input.TexCoord).rgb;
float3 specularSample = gSpecularMap.Sample(gSampleState, input.TexCoord).rgb;
float glossSample = gGlossMap.Sample(gSampleState, input.TexCoord).x;
float3 normalSample = gNormalMap.Sample(gSampleState, input.TexCoord).rgb;
// Compute inversed view and light directions
float3 invViewDirection = normalize(gCameraPosition - input.WorldPosition.xyz);
float3 invLightDirection = -gLightDirection;
// Compute tangent space axes if normal mapping is used
float3 normal = input.Normal;
if (gUseNormal) {
float3 binormal = cross(input.Normal, input.Tangent);
float3x3 tangentSpaceAxis = float3x3(input.Tangent, binormal, input.Normal);
// Sample and transform normal map
normal = float3(2.f * normalSample.x - 1.f,
2.f * normalSample.y - 1.f,
2.f * normalSample.z - 1.f);
normal = mul(normal, tangentSpaceAxis);
}
// Compute Lambert diffuse lighting
float3 diffuse = Lambert(gLightIntensity, diffuseSample);
// Compute Phong specular lighting
float ks = (specularSample.x + specularSample.y + specularSample.z) / 3.f;
float3 specular = Phong(ks, glossSample * gShininess, invLightDirection, invViewDirection, normal);
// Compute observed area based on the cosine of the light angle
float cosAngle = dot(invLightDirection, normal);
float3 observedArea = float3(cosAngle, cosAngle, cosAngle);
// Combine lighting components
float3 color = saturate(diffuse * observedArea + specular + gAmbient * cosAngle);
return color;
}
float4 PS(VS_OUTPUT input) : SV_TARGET{
return gDiffuseMap.Sample(gSampleState, input.TexCoord);
}
DepthStencilState gDepthStencilState
{
//enable
DepthEnable = true;
DepthWriteMask = ALL;
DepthFunc = LESS;
//stencil
StencilEnable = true;
};
technique11 DefaultTechnique{
pass P0 {
SetDepthStencilState(gDepthStencilState, 0);
SetRasterizerState(gRasterizerState);
SetVertexShader( CompileShader( vs_5_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_5_0, PS() ) );
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

View File

@@ -0,0 +1,39 @@
from PIL import Image
import os
import pprint
# Set the folder containing images
folder_path = 'converted' # Replace with your folder path
output_folder = os.path.join(folder_path, 'dingus')
# Create the 'dingus' folder if it doesn't exist
if not os.path.exists(output_folder):
os.makedirs(output_folder)
# Initialize a pretty printer
pp = pprint.PrettyPrinter(indent=4)
# Iterate through all files in the folder
for filename in os.listdir(folder_path):
if filename.endswith(('.png', '.jpg', '.jpeg', '.bmp', '.tiff')): # Add more formats if needed
file_path = os.path.join(folder_path, filename)
# Open the image
try:
with Image.open(file_path) as img:
# Ensure the image is in 'RGBA' mode (32-bit with 4 channels: R, G, B, A)
img = img.convert('RGBA')
# Create the save path as a PNG in the 'dingus' folder
save_path = os.path.join(output_folder, f'{os.path.splitext(filename)[0]}.png')
# Save the image as PNG
img.save(save_path, 'PNG')
# Pretty-print the successful conversion
pp.pprint(f"Successfully converted and saved: {save_path}")
except Exception as e:
pp.pprint(f"Error processing {filename}: {e}")
print("Conversion complete!")

352
project/resources/scene.mtl Normal file
View File

@@ -0,0 +1,352 @@
# Blender 4.3.2 MTL File: '1GD16E_Verhulst_Bram_Diorama.blend'
# www.blender.org
newmtl M_Baksteen
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_SingleBrick_C.png
newmtl M_Brick
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Brick_C.png
newmtl M_Car
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Car_C.png
newmtl M_Chicken
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_Chicken_C.png
map_d T_Chicken_O.png
newmtl M_ChickenRoof
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_ChickenCoopRoof_C.png
newmtl M_ChickenWireFence
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_ChickenWire_C.png
map_d T_ChickenWire_O.png
newmtl M_Cliff
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_BrickWall_C.png
newmtl M_ClothesLine
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_ClothesLine_C.png
newmtl M_Dirt
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Dirt_C.png
newmtl M_DirtTrimm
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_DirtTrim_C.png
newmtl M_Fountain
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Fountain_C.png
newmtl M_GardenFlowers
Ns 200.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_GardenFlowers_Grass_C.png
map_d T_GardenFlowers_Grass_O.png
newmtl M_GlassPane
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 0.376859
illum 1
map_Kd T_GlassPane_C.png
newmtl M_Grass
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_GroundGrass_C.png
newmtl M_GrassFlowers
Ns 1000.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_Flowers_C.png
map_d T_Flowers_wheel_O.png
newmtl M_Hay
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Hay_C.png
newmtl M_HouseTrim
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_HouseTrim_C.png
newmtl M_HouseUnique
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_HouseUnique_C.png
newmtl M_IndoorChickenWire
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_ChickenWireInside_C.png
newmtl M_LawnMower_Ladder_pots
Ns 200.000000
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
newmtl M_Path
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Path_C.png
newmtl M_PlantPot
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 1
map_Kd T_Vase_C.png
newmtl M_Plants
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_Flowers_C.png
map_d T_Flowers_wheel_O.png
newmtl M_Rocks_Wall
Ns 200.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Rocks_Wall_C.png
newmtl M_RoofTiles
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Roof_C.png
newmtl M_Sand
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_Sand_C.png
newmtl M_SwingChair
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_ChainBench_C.png
map_d T_ChainBench_O.png
newmtl M_TableCloth
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_TableCloth_C.png
newmtl M_TableUnique
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_TableUnique_c.png
newmtl M_TreeBark
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_LocustBark_C.png
newmtl M_TreeLeaf
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_Leaf_C.png
map_d T_Leaf_O.png
newmtl M_Vines
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
illum 1
map_Kd T_Vines_C.png
map_d T_Vines_O.png
newmtl M_Water
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 0.269091
illum 1
map_Kd T_Water_C.png
newmtl M_WoodPlanks
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_WoodSeamless_C.png
newmtl M_WorldTrimm
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd T_WorldTrimm_C.png

File diff suppressed because it is too large Load Diff