Use 16-bit single channel heightmap for terrain displacement
This commit is contained in:
parent
a9de176d12
commit
d9d3a3e3b3
6 changed files with 8 additions and 6 deletions
|
|
@ -30,4 +30,5 @@ call _build multisampling %1
|
||||||
call _build multithreading %1
|
call _build multithreading %1
|
||||||
call _build textoverlay %1
|
call _build textoverlay %1
|
||||||
call _build debugmarker %1
|
call _build debugmarker %1
|
||||||
call _build scenerendering %1
|
call _build scenerendering %1
|
||||||
|
call _build terraintessellation %1
|
||||||
|
|
@ -10,7 +10,7 @@ if %ERRORLEVEL% EQU 0 (
|
||||||
xcopy "..\..\data\shaders\terraintessellation\*.*" "assets\shaders\terraintessellation" /Y
|
xcopy "..\..\data\shaders\terraintessellation\*.*" "assets\shaders\terraintessellation" /Y
|
||||||
|
|
||||||
mkdir "assets\textures"
|
mkdir "assets\textures"
|
||||||
xcopy "..\..\data\textures\terrain_heightmap_r8.ktx" "assets\textures" /Y
|
xcopy "..\..\data\textures\terrain_heightmap_r16.ktx" "assets\textures" /Y
|
||||||
xcopy "..\..\data\textures\terrain_texturearray_bc3.ktx" "assets\textures" /Y
|
xcopy "..\..\data\textures\terrain_texturearray_bc3.ktx" "assets\textures" /Y
|
||||||
xcopy "..\..\data\textures\skysphere_bc3.ktx" "assets\textures" /Y
|
xcopy "..\..\data\textures\skysphere_bc3.ktx" "assets\textures" /Y
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ adb uninstall de.saschawillems.vulkanMultithreading
|
||||||
adb uninstall de.saschawillems.vulkanTextoverlay
|
adb uninstall de.saschawillems.vulkanTextoverlay
|
||||||
adb uninstall de.saschawillems.vulkanDebugmarker
|
adb uninstall de.saschawillems.vulkanDebugmarker
|
||||||
adb uninstall de.saschawillems.vulkanScenerendering
|
adb uninstall de.saschawillems.vulkanScenerendering
|
||||||
|
adb uninstall de.saschawillems.vulkanTerraintessellation
|
||||||
goto finish
|
goto finish
|
||||||
|
|
||||||
:exit
|
:exit
|
||||||
|
|
|
||||||
BIN
data/textures/terrain_heightmap_r16.ktx
Normal file
BIN
data/textures/terrain_heightmap_r16.ktx
Normal file
Binary file not shown.
Binary file not shown.
|
|
@ -68,7 +68,7 @@ public:
|
||||||
glm::vec4 lightPos = glm::vec4(0.0f, -2.0f, 0.0f, 0.0f);
|
glm::vec4 lightPos = glm::vec4(0.0f, -2.0f, 0.0f, 0.0f);
|
||||||
glm::vec4 frustumPlanes[6];
|
glm::vec4 frustumPlanes[6];
|
||||||
float displacementFactor = 32.0f;
|
float displacementFactor = 32.0f;
|
||||||
float tessellationFactor = 1.0f;
|
float tessellationFactor = 0.75f;
|
||||||
glm::vec2 viewportDim;
|
glm::vec2 viewportDim;
|
||||||
// Desired size of tessellated quad patch edge
|
// Desired size of tessellated quad patch edge
|
||||||
float tessellatedEdgeSize = 20.0f;
|
float tessellatedEdgeSize = 20.0f;
|
||||||
|
|
@ -117,8 +117,8 @@ public:
|
||||||
title = "Vulkan Example - Dynamic terrain tessellation";
|
title = "Vulkan Example - Dynamic terrain tessellation";
|
||||||
camera.type = Camera::CameraType::firstperson;
|
camera.type = Camera::CameraType::firstperson;
|
||||||
camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 512.0f);
|
camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 512.0f);
|
||||||
camera.setRotation(glm::vec3(-22.0f, 135.0f, 0.6f));
|
camera.setRotation(glm::vec3(-6.0f, -56.0f, 0.0f));
|
||||||
camera.setTranslation(glm::vec3(0.0f, 30.0f, 0.0f));
|
camera.setTranslation(glm::vec3(-45.0f, 14.0f, -28.5f));
|
||||||
camera.movementSpeed = 7.5f;
|
camera.movementSpeed = 7.5f;
|
||||||
timerSpeed *= 15.0f;
|
timerSpeed *= 15.0f;
|
||||||
// Support for tessellation shaders is optional, so check first
|
// Support for tessellation shaders is optional, so check first
|
||||||
|
|
@ -210,7 +210,7 @@ public:
|
||||||
{
|
{
|
||||||
textureLoader->loadTexture(getAssetPath() + "textures/skysphere_bc3.ktx", VK_FORMAT_BC3_UNORM_BLOCK, &textures.skySphere);
|
textureLoader->loadTexture(getAssetPath() + "textures/skysphere_bc3.ktx", VK_FORMAT_BC3_UNORM_BLOCK, &textures.skySphere);
|
||||||
// Height data is stored in a one-channel texture
|
// Height data is stored in a one-channel texture
|
||||||
textureLoader->loadTexture(getAssetPath() + "textures/terrain_heightmap_r8.ktx", VK_FORMAT_R8_UNORM, &textures.heightMap);
|
textureLoader->loadTexture(getAssetPath() + "textures/terrain_heightmap_r16.ktx", VK_FORMAT_R16_UNORM, &textures.heightMap);
|
||||||
// Terrain textures are stored in a texture array with layers corresponding to terrain height
|
// Terrain textures are stored in a texture array with layers corresponding to terrain height
|
||||||
textureLoader->loadTextureArray(getAssetPath() + "textures/terrain_texturearray_bc3.ktx", VK_FORMAT_BC3_UNORM_BLOCK, &textures.terrainArray);
|
textureLoader->loadTextureArray(getAssetPath() + "textures/terrain_texturearray_bc3.ktx", VK_FORMAT_BC3_UNORM_BLOCK, &textures.terrainArray);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue