This commit is contained in:
Tomas G.
2026-03-13 08:16:01 +01:00
commit 23bb2d2749
104 changed files with 205490 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 KiB

View File

@ -0,0 +1,28 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 08.06.2011 15:26:00
newmtl _10634_SpeedBoat_v01_LOD310634_SpeedBoat_v01
Ns 53.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5882 0.5882 0.5882
Kd 0.5882 0.5882 0.5882
Ks 0.2000 0.2000 0.2000
Ke 0.0000 0.0000 0.0000
map_Ka boat.jpg
map_Kd boat.jpg
newmtl glass
Ns 80.0000
Ni 1.5000
d 0.2000
Tr 0.8000
Tf 0.2000 0.2000 0.2000
illum 2
Ka 0.5882 0.5882 0.5882
Kd 0.5882 0.5882 0.5882
Ks 0.5000 0.5000 0.5000
Ke 0.0000 0.0000 0.0000

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
#version 330 core
in vec4 vColor;
in vec2 vLocal;
in vec4 vShape;
in float vHeightFactor;
out vec4 FragColor;
float hash12(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
void main() {
float c = cos(vShape.z);
float s = sin(vShape.z);
mat2 rot = mat2(c, -s, s, c);
vec2 p = rot * vLocal;
p /= max(vShape.xy, vec2(0.3));
float angle = atan(p.y, p.x);
float radius = length(p);
float wave = 1.0 + vShape.w * (0.45 * sin(3.0 * angle) + 0.35 * cos(5.0 * angle));
float envelope = radius / max(wave, 0.35);
if (envelope > 1.0) {
discard;
}
float shell = smoothstep(1.0, 0.06, envelope);
float core = smoothstep(0.66, 0.0, envelope);
float edge = smoothstep(0.98, 0.55, envelope) * (1.0 - core);
float noise1 = hash12(p * 6.0 + vec2(vShape.w * 13.7, vShape.z));
float noise2 = hash12(p * 11.0 + vec2(vShape.z * 0.3, vShape.w * 19.1));
float densityNoise = mix(noise1, noise2, 0.5);
float density = mix(0.70, 1.18, densityNoise);
vec3 lightDir = normalize(vec3(-0.35, 0.68, 0.64));
vec3 normal = normalize(vec3(p * 0.9, sqrt(max(0.0, 1.0 - clamp(envelope * envelope, 0.0, 1.0)))));
float diff = max(dot(normal, lightDir), 0.0);
float ashLift = mix(0.92, 1.10, vHeightFactor);
vec3 smokeLit = vColor.rgb * (0.52 + 0.30 * diff) * ashLift;
vec3 emberTint = vec3(0.95, 0.40, 0.08) * core * (1.0 - vHeightFactor) * 0.35;
vec3 rimCool = vec3(0.10, 0.11, 0.12) * edge * 0.30;
float alpha = vColor.a * shell * density;
alpha *= mix(1.05, 0.70, vHeightFactor);
alpha = clamp(alpha, 0.0, 1.0);
if (alpha < 0.01) {
discard;
}
FragColor = vec4(smokeLit + emberTint - rimCool, alpha);
}

View File

@ -0,0 +1,38 @@
#version 330 core
layout (location = 0) in vec2 aCorner;
layout (location = 1) in vec3 aCenter;
layout (location = 2) in vec3 aRight;
layout (location = 3) in vec3 aUp;
layout (location = 4) in float aHalfSize;
layout (location = 5) in vec4 aColor;
layout (location = 6) in vec4 aShape;
out vec4 vColor;
out vec2 vLocal;
out vec4 vShape;
out float vHeightFactor;
uniform mat4 view;
uniform mat4 projection;
uniform float uTime;
void main() {
float cornerTop = clamp((aCorner.y + 1.0) * 0.5, 0.0, 1.0);
float heightFactor = clamp(aCenter.y * 0.055, 0.0, 1.0);
float swayA = sin(uTime * 0.48 + aCenter.y * 0.16 + aShape.w * 13.0);
float swayB = cos(uTime * 0.37 + aCenter.x * 0.09 + aShape.w * 19.0);
float shear = (0.06 + 0.28 * heightFactor) * cornerTop;
vec3 dynamicOffset = aRight * (swayA * shear * aHalfSize) +
aUp * (swayB * 0.08 * shear * aHalfSize);
vec3 worldPos = aCenter + aRight * (aCorner.x * aHalfSize) + aUp * (aCorner.y * aHalfSize) + dynamicOffset;
gl_Position = projection * view * vec4(worldPos, 1.0);
vColor = aColor;
vLocal = aCorner;
vShape = aShape;
vHeightFactor = heightFactor;
}

View File

@ -0,0 +1,54 @@
#version 330 core
// Fragment Shader for Ocean Rendering with Texture Normals
in vec3 NormalInterp; // **IN variable declaration - crucial!**
// Input from Vertex Shader
in vec2 TexCoord;
in vec3 FragPosWorld;
in vec3 NormalWorld;
// Output fragment color
out vec4 FragColor;
// Uniforms (textures, lighting parameters, camera position)
uniform sampler2D oceanTexture; // Sampler for ocean color texture
uniform sampler2D normalMap; // Sampler for normal map texture
uniform vec3 lightDir; // Directional light direction (world space)
uniform vec3 lightColor; // Light color
uniform vec3 viewPosWorld; // Camera position in world space
void main() {
// 1. Sample textures
vec3 albedoColor = texture(oceanTexture, TexCoord).rgb; // Sample ocean color texture
//vec3 normalMapSample = texture(normalMap, TexCoord).rgb; // Sample normal map
// 2. Unpack and transform normal from normal map (Tangent Space to World Space - Simplified)
//vec3 normalMapNormal = normalize(normalMapSample * 2.0 - 1.0); // Unpack from [0, 1] to [-1, 1] and normalize
vec3 normalWorld = normalize(NormalInterp); // Get interpolated geometric normal from vertex shader
// **Basic Tangent Space Normal Mapping Approximation:**
// For truly correct tangent-space normal mapping, you'd need to construct a proper TBN matrix.
vec3 finalNormal = normalize(normalWorld ); // **Blend/Perturb geometric normal with texture normal**
// 3. Lighting calculations (Blinn-Phong example)
vec3 lightDirNorm = normalize(lightDir);
vec3 viewDirNorm = normalize(viewPosWorld - FragPosWorld);
vec3 reflectDir = reflect(-lightDirNorm, finalNormal);
// Diffuse component
float diff = max(dot(finalNormal, lightDirNorm), 0.0);
vec3 diffuse = diff * lightColor * albedoColor;
// Specular component (Blinn-Phong)
float spec = pow(max(dot(viewDirNorm, reflectDir), 0.0), 32.0);
vec3 specular = spec * lightColor * vec3(0.8); // Example specular color
// Ambient component
vec3 ambient = 0.3 * lightColor * albedoColor; // Example ambient
// 4. Combine lighting components for final color
vec3 finalColor = ambient + diffuse + specular;
FragColor = vec4(finalColor, 1.0); // Output final fragment color
}

View File

@ -0,0 +1,34 @@
#version 330 core
// Vertex Shader for Ocean Rendering
// Input vertex attributes (from VBOs)
layout (location = 0) in vec3 aPos; // Vertex position (from Ocean::vertices VBO)
layout (location = 1) in vec3 aNormal; // Vertex normal (from Ocean::normals VBO)
layout (location = 2) in vec2 aTexCoord; // Texture coordinates (from Ocean::texCoords VBO)
// Output to Fragment Shader
out vec2 TexCoord;
out vec3 FragPosWorld; // Fragment position in world space
out vec3 NormalWorld; // Normal vector in world space
out vec3 NormalInterp; // **OUT variable declaration - crucial!**
// Uniforms (matrices, light parameters, etc.)
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform mat3 normalMatrix; // Normal matrix for correct normal transformation
void main() {
// 1. Transform vertex position to clip space
gl_Position = projection * view * vec4(aPos, 1.0);
// 2. Pass texture coordinates to fragment shader
TexCoord = aTexCoord;
// 3. Calculate fragment position in world space
FragPosWorld = vec3(model * vec4(aPos, 1.0));
// 4. Transform normal vector to world space using the Normal Matrix
NormalWorld = normalize(normalMatrix * aNormal);
}

View File

@ -0,0 +1,61 @@
#version 330 core
// Fragment Shader for Terrain Rendering
in vec2 TexCoord;
in vec3 FragPosWorld;
in vec3 NormalWorld;
out vec4 FragColor;
uniform sampler2D terrainTexture; // Sampler for terrain color texture (no normal map for now)
uniform sampler2D heightMapTexture; // **New: Sampler for heightmap texture**
uniform vec3 lightDir;
uniform vec3 lightColor;
uniform vec3 viewPosWorld;
uniform vec3 volcanoCenterWorld;
uniform float volcanoRadius;
uniform float volcanoHeat;
void main() {
// 1. Sample textures
vec3 albedoColor = texture(terrainTexture, TexCoord * 8.0).rgb;
float heightValue = texture(heightMapTexture, TexCoord).r;
// 2. Lighting calculations (Blinn-Phong - similar to ocean shader)
vec3 normal = normalize(NormalWorld); // Use geometric normal for terrain
vec3 lightDirNorm = normalize(lightDir);
vec3 viewDirNorm = normalize(viewPosWorld - FragPosWorld);
vec3 reflectDir = reflect(-lightDirNorm, normal);
// Diffuse component
float diff = max(dot(normal, lightDirNorm), 0.0);
vec3 diffuse = diff * lightColor * albedoColor;
// Specular component
float spec = pow(max(dot(viewDirNorm, reflectDir), 0.0), 16.0); // Adjust shininess (exponent)
vec3 specular = spec * lightColor * vec3(0.3); // Example specular color - less shiny than ocean
// Ambient component
vec3 ambient = 0.2 * lightColor * albedoColor;
vec3 lowColor = vec3(0.78, 0.73, 0.64);
vec3 highColor = vec3(0.42, 0.36, 0.30);
vec3 heightTint = mix(lowColor, highColor, heightValue);
// 4. Combine lighting components for final color
vec3 litTerrain = (ambient + diffuse + specular) * albedoColor * heightTint;
float distToVolcano = length(FragPosWorld.xz - volcanoCenterWorld.xz);
float heightFromVolcanoBase = max(FragPosWorld.y - volcanoCenterWorld.y, 0.0);
float coneHeightMask = smoothstep(1.5, 8.0, heightFromVolcanoBase);
float lavaMask = 1.0 - smoothstep(volcanoRadius * 0.15, volcanoRadius, distToVolcano);
lavaMask = pow(clamp(lavaMask, 0.0, 1.0), 2.4);
lavaMask *= coneHeightMask;
lavaMask *= clamp(volcanoHeat, 0.0, 1.0);
vec3 lavaColor = mix(vec3(0.95, 0.18, 0.03), vec3(1.0, 0.75, 0.2), heightValue);
vec3 finalColor = mix(litTerrain, litTerrain * 0.78 + lavaColor * 0.72, lavaMask);
FragColor = vec4(finalColor, 1.0);
}

View File

@ -0,0 +1,22 @@
#version 330 core
// Vertex Shader for Terrain Rendering
layout (location = 0) in vec3 aPos; // Vertex position
layout (location = 1) in vec3 aNormal; // Vertex normal
layout (location = 2) in vec2 aTexCoord; // Texture coordinates
out vec2 TexCoord;
out vec3 FragPosWorld;
out vec3 NormalWorld;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform mat3 normalMatrix;
void main() {
gl_Position = projection * view * vec4(aPos, 1.0);
TexCoord = aTexCoord;
FragPosWorld = vec3(model * vec4(aPos, 1.0));
NormalWorld = normalize(normalMatrix * aNormal);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB