Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
HLSL-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#version 330 uniform vec3 SunDirection; smooth in vec3 Eye; out vec4 OutColor; void main() { vec3 HalfwayVector = normalize(normalize(Eye) - normalize(SunDirection)); float SpecularIntensity = max(dot(HalfwayVector, vec3(0.0, 1.0, 0.0)), 0.0); //Die Normale ist zur Vereinfachung fest gesetzt. float SpecularColor = 1.0 * pow(SpecularIntensity, 5.0); OutColor = vec4(SpecularColor, SpecularColor, SpecularColor, 1.0); } |
HLSL-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#version 330 uniform mat4 ViewTransformMatrix; uniform ivec2 PositionAdd; uniform vec3 CameraPos; layout(location = 1) in float WaterHeight; layout(location = 0) in float Height; smooth out vec3 Eye; void main() { ivec2 Pos2D = ivec2(gl_VertexID & (TERRAINBLOCKDATA_SIZE - 1), gl_VertexID >> TERRAINBLOCKDATA_SIZE_LOG2); //Berechnung der Position aus dem Grid Pos2D += PositionAdd; vec3 Position = vec3(float(Pos2D.x), (1.0 / (VERTICALFACTOR)) * float(WaterHeight), float(Pos2D.y)); gl_Position = ViewTransformMatrix * vec4(Position, 1.0); Eye = normalize(CameraPos - Position); } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Spiele Programmierer« (15.04.2014, 20:40)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »stef« (17.04.2014, 14:45)
HLSL-Quelltext |
|
1 2 |
float SpecularIntensity = max(dot(HalfwayVector, vec3(0.0, 1.0, 0.0)), 0.0); SpecularIntensity = (dot(normalize(SunDirection), SurfaceNormal) > 0.0) ? SpecularIntensity : 0.0; |
HLSL-Quelltext |
|
1 |
max(dot(HalfwayVector, vec3(0.0, 1.0, 0.0)), 0.0) |
Werbeanzeige