diff --git a/CMakeLists.txt b/CMakeLists.txt index ad078ca5..b245e1a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(vsgExamples - VERSION 1.1.7 + VERSION 1.1.8 DESCRIPTION "Set of example programs that test and illustrate how to use the VulkanSceneGraph" LANGUAGES CXX C ) @@ -21,13 +21,13 @@ if (VULKAN_SDK) set(ENV{VULKAN_SDK} ${VULKAN_SDK}) endif() -find_package(vsg 1.1.9) +find_package(vsg 1.1.10) vsg_setup_dir_vars() vsg_setup_build_vars() # find the optional vsgXchange that can be used for reading a range of image and 3d model formats and shader compilation -find_package(vsgXchange 1.0.5 QUIET) +find_package(vsgXchange 1.1.6 QUIET) # find the optional vsgImGui that can be used for GUI elements added into graphics windows. find_package(vsgImGui QUIET) diff --git a/data/models/lz.vsgt b/data/models/lz.vsgt index 3e3396a2..cb151a77 100644 --- a/data/models/lz.vsgt +++ b/data/models/lz.vsgt @@ -615,7 +615,7 @@ void main() image id=31 vsg::ubvec4Array2D { userObjects 0 - properties 37 4 1 1 1 1 2 -1 0 + properties 43 4 1 1 1 1 2 -1 0 width 128 height 128 storage id=0 @@ -14238,7 +14238,7 @@ void main() image id=825 vsg::ubvec4Array2D { userObjects 0 - properties 37 4 1 1 1 1 2 -1 0 + properties 43 4 1 1 1 1 2 -1 0 width 256 height 256 storage id=0 @@ -36657,7 +36657,7 @@ void main() image id=851 vsg::ubvec4Array2D { userObjects 0 - properties 37 4 1 1 1 1 2 -1 0 + properties 43 4 1 1 1 1 2 -1 0 width 64 height 64 storage id=0 diff --git a/data/models/teapot.vsgt b/data/models/teapot.vsgt index ae8416f3..38b68d25 100644 --- a/data/models/teapot.vsgt +++ b/data/models/teapot.vsgt @@ -5839,7 +5839,7 @@ void main() { userObjects 0 properties 0 0 0 1 1 1 0 -1 0 - value 1 0.929412 0.137255 1 + value 1 0.846874 0.0168074 1 } } } diff --git a/data/shaders/standard_pbr.frag b/data/shaders/standard_pbr.frag index f6f803ee..308b9674 100644 --- a/data/shaders/standard_pbr.frag +++ b/data/shaders/standard_pbr.frag @@ -90,19 +90,6 @@ struct PBRInfo vec3 specularColor; // color contribution from specular lighting }; - -vec4 SRGBtoLINEAR(vec4 srgbIn) -{ - vec3 linOut = pow(srgbIn.xyz, vec3(2.2)); - return vec4(linOut,srgbIn.w); -} - -vec4 LINEARtoSRGB(vec4 srgbIn) -{ - vec3 linOut = pow(srgbIn.xyz, vec3(1.0 / 2.2)); - return vec4(linOut, srgbIn.w); -} - float rcp(const in float value) { return 1.0 / value; @@ -289,7 +276,7 @@ vec3 BRDF(vec3 u_LightColor, vec3 v, vec3 n, vec3 l, vec3 h, float perceptualRou color *= ao; #ifdef VSG_EMISSIVE_MAP - vec3 emissive = SRGBtoLINEAR(texture(emissiveMap, texCoord0)).rgb * pbr.emissiveFactor.rgb; + vec3 emissive = texture(emissiveMap, texCoord0).rgb * pbr.emissiveFactor.rgb; #else vec3 emissive = pbr.emissiveFactor.rgb; #endif @@ -333,7 +320,7 @@ void main() float v = texture(diffuseMap, texCoord0.st).s * pbr.baseColorFactor; baseColor = vertexColor * vec4(v, v, v, 1.0); #else - baseColor = vertexColor * SRGBtoLINEAR(texture(diffuseMap, texCoord0)) * pbr.baseColorFactor; + baseColor = vertexColor * texture(diffuseMap, texCoord0) * pbr.baseColorFactor; #endif #else baseColor = vertexColor * pbr.baseColorFactor; @@ -352,14 +339,14 @@ void main() #ifdef VSG_WORKFLOW_SPECGLOSS #ifdef VSG_DIFFUSE_MAP - vec4 diffuse = SRGBtoLINEAR(texture(diffuseMap, texCoord0)); + vec4 diffuse = texture(diffuseMap, texCoord0); #else vec4 diffuse = vec4(1.0); #endif #ifdef VSG_SPECULAR_MAP vec4 specular_texel = texture(specularMap, texCoord0); - vec3 specular = SRGBtoLINEAR(specular_texel).rgb; + vec3 specular = specular_texel.rgb; perceptualRoughness = 1.0 - specular_texel.a; #else vec3 specular = vec3(0.0); @@ -552,5 +539,5 @@ void main() } } - outColor = LINEARtoSRGB(vec4(color, baseColor.a)); + outColor = vec4(color, baseColor.a); } diff --git a/data/textures/lz.vsgb b/data/textures/lz.vsgb index 388f14ef..54524ed8 100644 Binary files a/data/textures/lz.vsgb and b/data/textures/lz.vsgb differ diff --git a/examples/animation/vsganimation/vsganimation.cpp b/examples/animation/vsganimation/vsganimation.cpp index 1eb8feb5..d79fbd71 100644 --- a/examples/animation/vsganimation/vsganimation.cpp +++ b/examples/animation/vsganimation/vsganimation.cpp @@ -407,7 +407,7 @@ int main(int argc, char** argv) auto directionalLight = vsg::DirectionalLight::create(); directionalLight->name = "directional"; directionalLight->color.set(1.0f, 1.0f, 1.0f); - directionalLight->intensity = 0.9f; + directionalLight->intensity = 0.98f; directionalLight->direction = direction; directionalLight->shadowSettings = shadowSettings; @@ -416,7 +416,7 @@ int main(int argc, char** argv) auto ambientLight = vsg::AmbientLight::create(); ambientLight->name = "ambient"; ambientLight->color.set(1.0f, 1.0f, 1.0f); - ambientLight->intensity = 0.1f; + ambientLight->intensity = 0.02f; scene->addChild(ambientLight); } diff --git a/examples/app/vsgcameras/vsgcameras.cpp b/examples/app/vsgcameras/vsgcameras.cpp index 69bd33f2..844e67b7 100644 --- a/examples/app/vsgcameras/vsgcameras.cpp +++ b/examples/app/vsgcameras/vsgcameras.cpp @@ -252,7 +252,7 @@ int main(int argc, char** argv) auto secondary_view = vsg::View::create(secondary_camera, scenegraph); auto secondary_RenderGraph = vsg::RenderGraph::create(window, secondary_view); - secondary_RenderGraph->clearValues[0].color = {{0.2f, 0.2f, 0.2f, 1.0f}}; + secondary_RenderGraph->clearValues[0].color = vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 1.0f); commandGraph->addChild(secondary_RenderGraph); y += secondary_height + margin; diff --git a/examples/app/vsgmultiviews/vsgmultiviews.cpp b/examples/app/vsgmultiviews/vsgmultiviews.cpp index 11edf507..af649d98 100644 --- a/examples/app/vsgmultiviews/vsgmultiviews.cpp +++ b/examples/app/vsgmultiviews/vsgmultiviews.cpp @@ -158,7 +158,7 @@ int main(int argc, char** argv) // clear the depth buffer before view2 gets rendered VkClearValue colorClearValue{}; - colorClearValue.color = {{0.2f, 0.2f, 0.2f, 1.0f}}; + colorClearValue.color = vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 1.0f); VkClearAttachment color_attachment{VK_IMAGE_ASPECT_COLOR_BIT, 0, colorClearValue}; VkClearValue depthClearValue{}; diff --git a/examples/app/vsgortho/CMakeLists.txt b/examples/app/vsgortho/CMakeLists.txt index 3d403b57..4f7c894d 100644 --- a/examples/app/vsgortho/CMakeLists.txt +++ b/examples/app/vsgortho/CMakeLists.txt @@ -6,4 +6,9 @@ add_executable(vsgortho ${SOURCES}) target_link_libraries(vsgortho vsg::vsg) +if (vsgXchange_FOUND) + target_compile_definitions(vsgortho PRIVATE vsgXchange_FOUND) + target_link_libraries(vsgortho vsgXchange::vsgXchange) +endif() + install(TARGETS vsgortho RUNTIME DESTINATION bin) diff --git a/examples/app/vsgortho/vsgortho.cpp b/examples/app/vsgortho/vsgortho.cpp index 38ec0585..eee28cef 100644 --- a/examples/app/vsgortho/vsgortho.cpp +++ b/examples/app/vsgortho/vsgortho.cpp @@ -1,5 +1,9 @@ #include +#ifdef vsgXchange_FOUND +# include +#endif + #include #include #include @@ -29,6 +33,12 @@ int main(int argc, char** argv) auto options = vsg::Options::create(); options->fileCache = vsg::getEnv("VSG_FILE_CACHE"); options->paths = vsg::getEnvPaths("VSG_FILE_PATH"); + +#ifdef vsgXchange_all + // add vsgXchange's support for reading and writing 3rd party file formats + options->add(vsgXchange::all::create()); +#endif + vsg::Path filename = arguments[1]; auto vsg_scene = vsg::read_cast(filename, options); diff --git a/examples/app/vsgrendertotexture/vsgrendertotexture.cpp b/examples/app/vsgrendertotexture/vsgrendertotexture.cpp index ae06c725..fe335e19 100644 --- a/examples/app/vsgrendertotexture/vsgrendertotexture.cpp +++ b/examples/app/vsgrendertotexture/vsgrendertotexture.cpp @@ -50,7 +50,7 @@ vsg::ref_ptr createOffscreenRendergraph(vsg::Context& context, // create image for color attachment auto colorImage = vsg::Image::create(); colorImage->imageType = VK_IMAGE_TYPE_2D; - colorImage->format = VK_FORMAT_R8G8B8A8_UNORM; + colorImage->format = VK_FORMAT_R8G8B8A8_SRGB; colorImage->extent = attachmentExtent; colorImage->mipLevels = 1; colorImage->arrayLayers = 1; @@ -104,7 +104,7 @@ vsg::ref_ptr createOffscreenRendergraph(vsg::Context& context, // attachment descriptions vsg::RenderPass::Attachments attachments(2); // Color attachment - attachments[0].format = VK_FORMAT_R8G8B8A8_UNORM; + attachments[0].format = VK_FORMAT_R8G8B8A8_SRGB; attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; @@ -166,7 +166,7 @@ vsg::ref_ptr createOffscreenRendergraph(vsg::Context& context, rendergraph->framebuffer = fbuf; rendergraph->clearValues.resize(2); - rendergraph->clearValues[0].color = {{0.4f, 0.2f, 0.4f, 1.0f}}; + rendergraph->clearValues[0].color = vsg::sRGB_to_linear(0.4f, 0.2f, 0.4f, 1.0f); rendergraph->clearValues[1].depthStencil = VkClearDepthStencilValue{0.0f, 0}; return rendergraph; diff --git a/examples/app/vsgrendertotexturearray/vsgrendertotexturearray.cpp b/examples/app/vsgrendertotexturearray/vsgrendertotexturearray.cpp index 217b806f..89fba190 100644 --- a/examples/app/vsgrendertotexturearray/vsgrendertotexturearray.cpp +++ b/examples/app/vsgrendertotexturearray/vsgrendertotexturearray.cpp @@ -168,7 +168,7 @@ vsg::ref_ptr createOffscreenRendergraph(vsg::Context& context, rendergraph->framebuffer = fbuf; rendergraph->clearValues.resize(2); - rendergraph->clearValues[0].color = {{0.4f, 0.2f, 0.4f, 1.0f}}; + rendergraph->clearValues[0].color = vsg::sRGB_to_linear(0.4f, 0.2f, 0.4f, 1.0f); rendergraph->clearValues[1].depthStencil = VkClearDepthStencilValue{0.0f, 0}; return rendergraph; @@ -579,7 +579,7 @@ int main(int argc, char** argv) VkExtent2D targetExtent{512, 512}; // create the color and depth image 2D arrays to render to/read from. - auto colorImage = createImage(*context, targetExtent.width, targetExtent.height, numLayers, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); + auto colorImage = createImage(*context, targetExtent.width, targetExtent.height, numLayers, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); auto depthImage = createImage(*context, targetExtent.width, targetExtent.height, numLayers, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT); // use the TraverseChildrenOfNode to decorate the main view3D so it's children can be travesed by the render to texture without invoking the view3D camera/ViewDependentState diff --git a/examples/app/vsgscreenshot/vsgscreenshot.cpp b/examples/app/vsgscreenshot/vsgscreenshot.cpp index 15f5a42e..639384e4 100644 --- a/examples/app/vsgscreenshot/vsgscreenshot.cpp +++ b/examples/app/vsgscreenshot/vsgscreenshot.cpp @@ -106,7 +106,7 @@ class ScreenshotHandler : public vsg::Inherit vkGetPhysicalDeviceFormatProperties(*(physicalDevice), sourceImageFormat, &srcFormatProperties); VkFormatProperties destFormatProperties; - vkGetPhysicalDeviceFormatProperties(*(physicalDevice), VK_FORMAT_R8G8B8A8_UNORM, &destFormatProperties); + vkGetPhysicalDeviceFormatProperties(*(physicalDevice), VK_FORMAT_R8G8B8A8_SRGB, &destFormatProperties); bool supportsBlit = ((srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT) != 0) && ((destFormatProperties.linearTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT) != 0); @@ -114,7 +114,7 @@ class ScreenshotHandler : public vsg::Inherit if (supportsBlit) { // we can automatically convert the image format when blit, so take advantage of it to ensure RGBA - targetImageFormat = VK_FORMAT_R8G8B8A8_UNORM; + targetImageFormat = VK_FORMAT_R8G8B8A8_SRGB; } vsg::info("supportsBlit = ", supportsBlit); diff --git a/examples/app/vsgskybox/skybox.h b/examples/app/vsgskybox/skybox.h index 2fda4a18..8e62309e 100644 --- a/examples/app/vsgskybox/skybox.h +++ b/examples/app/vsgskybox/skybox.h @@ -9,20 +9,20 @@ layout(push_constant) uniform PushConstants { mat4 modelView; } pc; -layout(location = 0) in vec3 osg_Vertex; -layout(location = 0) out vec3 outUVW; +layout(location = 0) in vec3 vsg_Vertex; +layout(location = 0) out vec3 UVW; out gl_PerVertex{ vec4 gl_Position; }; void main() { - outUVW = osg_Vertex; + UVW = vsg_Vertex; // Remove translation mat4 modelView = pc.modelView; modelView[3] = vec4(0.0, 0.0, 0.0, 1.0); - vec4 pos = pc.projection * modelView * vec4(osg_Vertex, 1.0); + vec4 pos = pc.projection * modelView * vec4(vsg_Vertex, 1.0); gl_Position = vec4(pos.xy, 0.0, pos.w); } )"; @@ -32,11 +32,11 @@ const auto skybox_frag = R"( #extension GL_ARB_separate_shader_objects : enable layout(binding = 0) uniform samplerCube envMap; -layout(location = 0) in vec3 inUVW; +layout(location = 0) in vec3 UVW; layout(location = 0) out vec4 outColor; void main() { - outColor = textureLod(envMap, inUVW, 0); + outColor = textureLod(envMap, UVW, 0); } )"; diff --git a/examples/app/vsgskybox/vsgskybox.cpp b/examples/app/vsgskybox/vsgskybox.cpp index 8a636237..51f5bd63 100644 --- a/examples/app/vsgskybox/vsgskybox.cpp +++ b/examples/app/vsgskybox/vsgskybox.cpp @@ -188,7 +188,7 @@ int main(int argc, char** argv) arguments.read("--samples", windowTraits->samples); auto numFrames = arguments.value(-1, "-f"); auto horizonMountainHeight = arguments.value(0.0, "--hmh"); - auto skyboxFilename = arguments.value("", "--skybox"); + auto skyboxFilename = arguments.value("textures/skybox.dds", "--skybox"); auto outputFilename = arguments.value("", "-o"); if (arguments.errors()) return arguments.writeErrorMessages(std::cerr); diff --git a/examples/app/vsgwindows/vsgwindows.cpp b/examples/app/vsgwindows/vsgwindows.cpp index 437e47a2..3d9a238d 100644 --- a/examples/app/vsgwindows/vsgwindows.cpp +++ b/examples/app/vsgwindows/vsgwindows.cpp @@ -140,7 +140,7 @@ int main(int argc, char** argv) auto main_RenderGraph = vsg::RenderGraph::create(window1, main_view); auto secondary_RenderGraph = vsg::RenderGraph::create(window2, secondary_view); - secondary_RenderGraph->clearValues[0].color = {{0.2f, 0.2f, 0.2f, 1.0f}}; + secondary_RenderGraph->clearValues[0].color = vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 1.0f); auto commandGraph1 = vsg::CommandGraph::create(window1); commandGraph1->addChild(main_RenderGraph); diff --git a/examples/lighting/vsglights/vsglights.cpp b/examples/lighting/vsglights/vsglights.cpp index 426ebfd9..8df8c10d 100644 --- a/examples/lighting/vsglights/vsglights.cpp +++ b/examples/lighting/vsglights/vsglights.cpp @@ -187,12 +187,12 @@ int main(int argc, char** argv) auto ambientLight = vsg::AmbientLight::create(); ambientLight->name = "ambient"; ambientLight->color.set(1.0f, 1.0f, 1.0f); - ambientLight->intensity = 0.1f; + ambientLight->intensity = 0.0044f; auto directionalLight = vsg::DirectionalLight::create(); directionalLight->name = "head light"; directionalLight->color.set(1.0f, 1.0f, 1.0f); - directionalLight->intensity = 0.9f; + directionalLight->intensity = 0.9956f; directionalLight->direction.set(0.0f, 0.0f, -1.0f); auto absoluteTransform = vsg::AbsoluteTransform::create(); diff --git a/examples/lighting/vsgshadow/vsgshadow.cpp b/examples/lighting/vsgshadow/vsgshadow.cpp index af0d6186..196635cd 100644 --- a/examples/lighting/vsgshadow/vsgshadow.cpp +++ b/examples/lighting/vsgshadow/vsgshadow.cpp @@ -538,7 +538,7 @@ int main(int argc, char** argv) directionalLight = vsg::DirectionalLight::create(); directionalLight->name = "directional"; directionalLight->color.set(1.0f, 1.0f, 1.0f); - directionalLight->intensity = 0.9f; + directionalLight->intensity = 0.98f; directionalLight->direction = direction; directionalLight->angleSubtended = angleSubtended; directionalLight->shadowSettings = shadowSettings; @@ -552,7 +552,7 @@ int main(int argc, char** argv) ambientLight = vsg::AmbientLight::create(); ambientLight->name = "ambient"; ambientLight->color.set(1.0f, 1.0f, 1.0f); - ambientLight->intensity = 0.2f; + ambientLight->intensity = 0.02f; group->addChild(ambientLight); } diff --git a/examples/nodes/vsgcoordinateframe/vsgcoordinateframe.cpp b/examples/nodes/vsgcoordinateframe/vsgcoordinateframe.cpp index bb8fcf07..4cfaf990 100644 --- a/examples/nodes/vsgcoordinateframe/vsgcoordinateframe.cpp +++ b/examples/nodes/vsgcoordinateframe/vsgcoordinateframe.cpp @@ -608,7 +608,7 @@ int main(int argc, char** argv) deviceFeatures->get().depthClamp = VK_TRUE; } - VkClearColorValue clearColor{{0.0f, 0.0f, 0.0f, 1.0f}}; + auto clearColor = arguments.value(vsg::vec4(0.0f, 0.0f, 0.0f, 1.0f), "--clear"); bool playAnimations = arguments.read("--play"); @@ -796,8 +796,6 @@ int main(int argc, char** argv) return 1; } - window->clearColor().set(0.0f, 0.0f, 0.0f, 1.0f); - viewer->addWindow(window); // compute the bounds of the scene graph to help position camera @@ -906,7 +904,7 @@ int main(int argc, char** argv) } auto renderGraph = vsg::createRenderGraphForView(window, camera, universe, VK_SUBPASS_CONTENTS_INLINE, false); - renderGraph->setClearValues(clearColor); + renderGraph->setClearValues(vsg::sRGB_to_linear(clearColor)); auto commandGraph = vsg::CommandGraph::create(window, renderGraph); diff --git a/examples/nodes/vsgtextureprojection/vsgtextureprojection.cpp b/examples/nodes/vsgtextureprojection/vsgtextureprojection.cpp index 444711a0..503bb1a9 100644 --- a/examples/nodes/vsgtextureprojection/vsgtextureprojection.cpp +++ b/examples/nodes/vsgtextureprojection/vsgtextureprojection.cpp @@ -344,7 +344,8 @@ int main(int argc, char** argv) vsg::Path filename = argv[i]; if (auto data = vsg::read_cast(filename, options)) { - if (data->properties.format == VK_FORMAT_R8G8B8A8_UNORM) + data->properties.format = vsg::uNorm_to_sRGB(data->properties.format); + if (data->properties.format == VK_FORMAT_R8G8B8A8_SRGB) { if (!firstImage) { @@ -364,7 +365,7 @@ int main(int argc, char** argv) } else { - std::cout << "Image file : " << filename << " loaded, but does not match required VK_FORMAT_R8G8B8A8_UNORM format." << std::endl; + std::cout << "Image file : " << filename << " loaded, but does not match required VK_FORMAT_R8G8B8A8_SRGB format." << std::endl; } } else @@ -456,7 +457,7 @@ int main(int argc, char** argv) auto texgenMatrices = vsg::mat4Array::create(depth); texgenMatrices->properties.dataVariance = vsg::DYNAMIC_DATA; - auto texture2DArray = vsg::ubvec4Array3D::create(firstImage->width(), firstImage->height(), depth, vsg::ubvec4(255, 255, 255, 255), vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM}); + auto texture2DArray = vsg::ubvec4Array3D::create(firstImage->width(), firstImage->height(), depth, vsg::ubvec4(255, 255, 255, 255), vsg::Data::Properties{VK_FORMAT_R8G8B8A8_SRGB}); texture2DArray->properties.imageViewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY; texgenDescritor->bufferInfoList.push_back(vsg::BufferInfo::create(texgenMatrices)); @@ -562,7 +563,7 @@ int main(int argc, char** argv) auto directionalLight = vsg::DirectionalLight::create(); directionalLight->name = "directional"; directionalLight->color.set(1.0, 1.0, 1.0); - directionalLight->intensity = 0.9f; + directionalLight->intensity = 0.98f; directionalLight->direction = direction; if (numShadowMapsPerLight > 0) { @@ -573,7 +574,7 @@ int main(int argc, char** argv) auto ambientLight = vsg::AmbientLight::create(); ambientLight->name = "ambient"; ambientLight->color.set(1.0, 1.0, 1.0); - ambientLight->intensity = 0.2f; + ambientLight->intensity = 0.02f; group->addChild(ambientLight); } diff --git a/examples/nodes/vsgtiledatabase/vsgtiledatabase.cpp b/examples/nodes/vsgtiledatabase/vsgtiledatabase.cpp index 2862751c..5ce16e9d 100644 --- a/examples/nodes/vsgtiledatabase/vsgtiledatabase.cpp +++ b/examples/nodes/vsgtiledatabase/vsgtiledatabase.cpp @@ -45,8 +45,7 @@ int main(int argc, char** argv) arguments.read("--file-cache", options->fileCache); bool osgEarthStyleMouseButtons = arguments.read({"--osgearth", "-e"}); - VkClearColorValue clearColor{{0.2f, 0.2f, 0.4f, 1.0f}}; - arguments.read({"--bc", "--background-color"}, clearColor.float32[0], clearColor.float32[1], clearColor.float32[2], clearColor.float32[3]); + auto clearColor = arguments.value(vsg::vec4(0.2f, 0.2f, 0.4f, 1.0f), "--clear"); uint32_t numOperationThreads = 0; if (arguments.read("--ot", numOperationThreads)) options->operationThreads = vsg::OperationThreads::create(numOperationThreads); @@ -266,7 +265,7 @@ int main(int argc, char** argv) } auto rendergraph = vsg::createRenderGraphForView(window, camera, vsg_scene); - rendergraph->setClearValues(clearColor); + rendergraph->setClearValues(vsg::sRGB_to_linear(clearColor)); auto commandGraph = vsg::CommandGraph::create(window, rendergraph); viewer->assignRecordAndSubmitTaskAndPresentation({commandGraph}); diff --git a/examples/platform/vsgwin32/vsgwin32.cpp b/examples/platform/vsgwin32/vsgwin32.cpp index 6caaf5e0..ab43379e 100644 --- a/examples/platform/vsgwin32/vsgwin32.cpp +++ b/examples/platform/vsgwin32/vsgwin32.cpp @@ -62,7 +62,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR lpszCmdLine, i // register the vsgWin32::Win32_Window object so that we can have events processed by the VSG event handler SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast(window.get())); - window->clearColor() = VkClearColorValue{{0.2f, 0.2f, 0.2f, 0}}; + window->clearColor() = vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 0.0f); auto viewer = vsg::Viewer::create(); viewer->addWindow(window); diff --git a/examples/state/vsgstateswitch/vsgstateswitch.cpp b/examples/state/vsgstateswitch/vsgstateswitch.cpp index 1841297f..98051cfd 100644 --- a/examples/state/vsgstateswitch/vsgstateswitch.cpp +++ b/examples/state/vsgstateswitch/vsgstateswitch.cpp @@ -192,7 +192,7 @@ int main(int argc, char** argv) std::cout << "Using a RenderGraph per View" << std::endl; auto main_RenderGraph = vsg::RenderGraph::create(window, main_view); auto secondary_RenderGraph = vsg::RenderGraph::create(window, secondary_view); - secondary_RenderGraph->clearValues[0].color = {{0.2f, 0.2f, 0.2f, 1.0f}}; + secondary_RenderGraph->clearValues[0].color = vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 1.0f); auto commandGraph = vsg::CommandGraph::create(window); commandGraph->addChild(main_RenderGraph); @@ -210,7 +210,7 @@ int main(int argc, char** argv) // clear the depth buffer before view2 gets rendered VkClearValue colorClearValue{}; - colorClearValue.color = {{0.2f, 0.2f, 0.2f, 1.0f}}; + colorClearValue.color = vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 1.0f); VkClearAttachment color_attachment{VK_IMAGE_ASPECT_COLOR_BIT, 0, colorClearValue}; VkClearValue depthClearValue{}; diff --git a/examples/state/vsgtexturearray/vsgtexturearray.cpp b/examples/state/vsgtexturearray/vsgtexturearray.cpp index d6b6b78f..f11d0b6b 100644 --- a/examples/state/vsgtexturearray/vsgtexturearray.cpp +++ b/examples/state/vsgtexturearray/vsgtexturearray.cpp @@ -204,7 +204,7 @@ int main(int argc, char** argv) for (uint32_t i = 0; i < numTiles; ++i) { auto textureData = vsg::ubvec4Array2D::create(256, 256); - textureData->properties.format = VK_FORMAT_R8G8B8A8_UNORM; + textureData->properties.format = VK_FORMAT_R8G8B8A8_SRGB; if (update) textureData->properties.dataVariance = vsg::DYNAMIC_DATA; updateBaseTexture(*textureData, 1.0f); diff --git a/examples/text/vsgtext/vsgtext.cpp b/examples/text/vsgtext/vsgtext.cpp index 6e41d192..52556266 100644 --- a/examples/text/vsgtext/vsgtext.cpp +++ b/examples/text/vsgtext/vsgtext.cpp @@ -569,7 +569,7 @@ int main(int argc, char** argv) return 1; } - window->clearColor() = VkClearColorValue{{clearColor.r, clearColor.g, clearColor.b, clearColor.a}}; + window->clearColor() = vsg::sRGB_to_linear(clearColor); viewer->addWindow(window); diff --git a/examples/text/vsgtextgroup/vsgtextgroup.cpp b/examples/text/vsgtextgroup/vsgtextgroup.cpp index 30330a57..07db353c 100644 --- a/examples/text/vsgtextgroup/vsgtextgroup.cpp +++ b/examples/text/vsgtextgroup/vsgtextgroup.cpp @@ -326,7 +326,7 @@ int main(int argc, char** argv) return 1; } - window->clearColor() = VkClearColorValue{{clearColor.r, clearColor.g, clearColor.b, clearColor.a}}; + window->clearColor() = vsg::sRGB_to_linear(clearColor); viewer->addWindow(window); diff --git a/examples/threading/vsgdynamicviews/vsgdynamicviews.cpp b/examples/threading/vsgdynamicviews/vsgdynamicviews.cpp index 4e9fd56d..4f84b571 100644 --- a/examples/threading/vsgdynamicviews/vsgdynamicviews.cpp +++ b/examples/threading/vsgdynamicviews/vsgdynamicviews.cpp @@ -92,7 +92,7 @@ struct LoadViewOperation : public vsg::InheritaddChild(vsg::createHeadlight()); auto renderGraph = vsg::RenderGraph::create(ref_window, view); - renderGraph->setClearValues({{0.2f, 0.2f, 0.2f, 1.0f}}); + renderGraph->setClearValues(vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 1.0f)); // need to add view to compileManager ref_viewer->compileManager->add(*ref_window, view); diff --git a/examples/threading/vsgdynamicwindows/vsgdynamicwindows.cpp b/examples/threading/vsgdynamicwindows/vsgdynamicwindows.cpp index 18049738..f69cb201 100644 --- a/examples/threading/vsgdynamicwindows/vsgdynamicwindows.cpp +++ b/examples/threading/vsgdynamicwindows/vsgdynamicwindows.cpp @@ -114,7 +114,7 @@ struct LoadWindowOperation : public vsg::InheritaddChild(vsg::createHeadlight()); auto renderGraph = vsg::RenderGraph::create(second_window, view); - renderGraph->clearValues[0].color = {{0.2f, 0.2f, 0.2f, 1.0f}}; + renderGraph->clearValues[0].color = vsg::sRGB_to_linear(0.2f, 0.2f, 0.2f, 1.0f); auto commandGraph = vsg::CommandGraph::create(second_window); commandGraph->addChild(renderGraph); diff --git a/examples/ui/vsgimgui_example/vsgimgui_example.cpp b/examples/ui/vsgimgui_example/vsgimgui_example.cpp index 716ddc87..c87f1a00 100644 --- a/examples/ui/vsgimgui_example/vsgimgui_example.cpp +++ b/examples/ui/vsgimgui_example/vsgimgui_example.cpp @@ -62,7 +62,7 @@ class MyGui : public vsg::Inherit } ImGui::SliderFloat("float", ¶ms->dist, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f - ImGui::ColorEdit3("clear color", (float*)¶ms->clearColor); // Edit 3 floats representing a color + ImGui::ColorEdit3("clear color", (float*)¶ms->clearColor); // Edit 3 floats representing a color. Beware: the color space will match the rendering color space, typically linear, whereas colour pickers are typically sRGB. if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) params->counter++; @@ -129,7 +129,7 @@ class MyGui : public vsg::Inherit if (params->showImagesWindow) { ImGui::Begin("Image Window", ¶ms->showImagesWindow); - ImGui::Text("An texture:"); + ImGui::Text("A texture:"); // The logo texture is big, show it at half size ImGui::Image(texture->id(cb.deviceID), ImVec2(texture->width / 2.0f, texture->height / 2.0f)); @@ -175,6 +175,8 @@ int main(int argc, char** argv) windowTraits->debugLayer = arguments.read({"--debug", "-d"}); windowTraits->apiDumpLayer = arguments.read({"--api", "-a"}); + if (arguments.read("--sRGB")) windowTraits->swapchainPreferences.surfaceFormat = {VK_FORMAT_B8G8R8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR}; + if (arguments.read("--RGB")) windowTraits->swapchainPreferences.surfaceFormat = {VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR}; arguments.read("--screen", windowTraits->screenNum); arguments.read("--display", windowTraits->display); arguments.read("--samples", windowTraits->samples); diff --git a/examples/utils/vsgshaderset/flat.cpp b/examples/utils/vsgshaderset/flat.cpp index 06e51624..d687da6f 100644 --- a/examples/utils/vsgshaderset/flat.cpp +++ b/examples/utils/vsgshaderset/flat.cpp @@ -45,9 +45,7 @@ vsg::ref_ptr flat_ShaderSet(vsg::ref_ptr opt shaderSet->addAttributeBinding("vsg_Vertex", "", 0, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_Normal", "", 1, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_TexCoord0", "", 2, VK_FORMAT_R32G32_SFLOAT, vsg::vec2Array::create(1)); - shaderSet->addAttributeBinding("vsg_Color", "", 3, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1)); - - shaderSet->addAttributeBinding("vsg_DisplacementScale", "VSG_DISPLACEMENT_MAP", 4, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Value::create(1.0f, 1.0f, 1.0f)); + shaderSet->addAttributeBinding("vsg_Color", "", 3, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1), vsg::CoordinateSpace::LINEAR); shaderSet->addAttributeBinding("vsg_position", "VSG_INSTANCE_POSITIONS", 4, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_position_scaleDistance", "VSG_BILLBOARD", 4, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1)); @@ -58,10 +56,10 @@ vsg::ref_ptr flat_ShaderSet(vsg::ref_ptr opt shaderSet->addDescriptorBinding("diffuseMap", "VSG_DIFFUSE_MAP", MATERIAL_DESCRIPTOR_SET, 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); shaderSet->addDescriptorBinding("detailMap", "VSG_DETAIL_MAP", MATERIAL_DESCRIPTOR_SET, 1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); - shaderSet->addDescriptorBinding("displacementMap", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::floatArray2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT})); + shaderSet->addDescriptorBinding("displacementMap", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::floatArray2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT}), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("displacementMapScale", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 8, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::vec3Value::create(1.0f, 1.0f, 1.0f)); - shaderSet->addDescriptorBinding("material", "", MATERIAL_DESCRIPTOR_SET, 10, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::PhongMaterialValue::create()); + shaderSet->addDescriptorBinding("material", "", MATERIAL_DESCRIPTOR_SET, 10, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::PhongMaterialValue::create(), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("jointMatrices", "VSG_SKINNING", MATERIAL_DESCRIPTOR_SET, 11, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::mat4Value::create()); diff --git a/examples/utils/vsgshaderset/pbr.cpp b/examples/utils/vsgshaderset/pbr.cpp index e8004a1d..59308b46 100644 --- a/examples/utils/vsgshaderset/pbr.cpp +++ b/examples/utils/vsgshaderset/pbr.cpp @@ -39,7 +39,7 @@ vsg::ref_ptr pbr_ShaderSet(vsg::ref_ptr opti shaderSet->addAttributeBinding("vsg_Vertex", "", 0, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_Normal", "", 1, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_TexCoord0", "", 2, VK_FORMAT_R32G32_SFLOAT, vsg::vec2Array::create(1)); - shaderSet->addAttributeBinding("vsg_Color", "", 3, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1)); + shaderSet->addAttributeBinding("vsg_Color", "", 3, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1), vsg::CoordinateSpace::LINEAR); shaderSet->addAttributeBinding("vsg_position", "VSG_INSTANCE_POSITIONS", 4, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_position_scaleDistance", "VSG_BILLBOARD", 4, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1)); @@ -49,16 +49,16 @@ vsg::ref_ptr pbr_ShaderSet(vsg::ref_ptr opti shaderSet->addDescriptorBinding("diffuseMap", "VSG_DIFFUSE_MAP", MATERIAL_DESCRIPTOR_SET, 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); shaderSet->addDescriptorBinding("detailMap", "VSG_DETAIL_MAP", MATERIAL_DESCRIPTOR_SET, 1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); - shaderSet->addDescriptorBinding("normalMap", "VSG_NORMAL_MAP", MATERIAL_DESCRIPTOR_SET, 2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec3Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32G32B32_SFLOAT})); + shaderSet->addDescriptorBinding("normalMap", "VSG_NORMAL_MAP", MATERIAL_DESCRIPTOR_SET, 2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec3Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32G32B32_SFLOAT}), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("aoMap", "VSG_LIGHTMAP_MAP", MATERIAL_DESCRIPTOR_SET, 3, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::floatArray2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT})); shaderSet->addDescriptorBinding("emissiveMap", "VSG_EMISSIVE_MAP", MATERIAL_DESCRIPTOR_SET, 4, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); shaderSet->addDescriptorBinding("specularMap", "VSG_SPECULAR_MAP", MATERIAL_DESCRIPTOR_SET, 5, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); - shaderSet->addDescriptorBinding("mrMap", "VSG_METALLROUGHNESS_MAP", MATERIAL_DESCRIPTOR_SET, 6, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec2Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32G32_SFLOAT})); + shaderSet->addDescriptorBinding("mrMap", "VSG_METALLROUGHNESS_MAP", MATERIAL_DESCRIPTOR_SET, 6, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec2Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32G32_SFLOAT}), vsg::CoordinateSpace::LINEAR); - shaderSet->addDescriptorBinding("displacementMap", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::floatArray2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT})); + shaderSet->addDescriptorBinding("displacementMap", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::floatArray2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT}), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("displacementMapScale", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 8, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::vec3Value::create(1.0f, 1.0f, 1.0f)); - shaderSet->addDescriptorBinding("material", "", MATERIAL_DESCRIPTOR_SET, 10, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::PbrMaterialValue::create()); + shaderSet->addDescriptorBinding("material", "", MATERIAL_DESCRIPTOR_SET, 10, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::PbrMaterialValue::create(), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("jointMatrices", "VSG_SKINNING", MATERIAL_DESCRIPTOR_SET, 11, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::mat4Value::create()); diff --git a/examples/utils/vsgshaderset/phong.cpp b/examples/utils/vsgshaderset/phong.cpp index f3dd7fd7..865c2b6e 100644 --- a/examples/utils/vsgshaderset/phong.cpp +++ b/examples/utils/vsgshaderset/phong.cpp @@ -38,7 +38,7 @@ vsg::ref_ptr phong_ShaderSet(vsg::ref_ptr op shaderSet->addAttributeBinding("vsg_Vertex", "", 0, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_Normal", "", 1, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_TexCoord0", "", 2, VK_FORMAT_R32G32_SFLOAT, vsg::vec2Array::create(1)); - shaderSet->addAttributeBinding("vsg_Color", "", 3, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1)); + shaderSet->addAttributeBinding("vsg_Color", "", 3, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1), vsg::CoordinateSpace::LINEAR); shaderSet->addAttributeBinding("vsg_position", "VSG_INSTANCE_POSITIONS", 4, VK_FORMAT_R32G32B32_SFLOAT, vsg::vec3Array::create(1)); shaderSet->addAttributeBinding("vsg_position_scaleDistance", "VSG_BILLBOARD", 4, VK_FORMAT_R32G32B32A32_SFLOAT, vsg::vec4Array::create(1)); @@ -48,13 +48,14 @@ vsg::ref_ptr phong_ShaderSet(vsg::ref_ptr op shaderSet->addDescriptorBinding("diffuseMap", "VSG_DIFFUSE_MAP", MATERIAL_DESCRIPTOR_SET, 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); shaderSet->addDescriptorBinding("detailMap", "VSG_DETAIL_MAP", MATERIAL_DESCRIPTOR_SET, 1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); - shaderSet->addDescriptorBinding("normalMap", "VSG_NORMAL_MAP", MATERIAL_DESCRIPTOR_SET, 2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec3Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32G32B32_SFLOAT})); + shaderSet->addDescriptorBinding("normalMap", "VSG_NORMAL_MAP", MATERIAL_DESCRIPTOR_SET, 2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec3Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32G32B32_SFLOAT}), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("aoMap", "VSG_LIGHTMAP_MAP", MATERIAL_DESCRIPTOR_SET, 3, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT})); shaderSet->addDescriptorBinding("emissiveMap", "VSG_EMISSIVE_MAP", MATERIAL_DESCRIPTOR_SET, 4, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM})); - shaderSet->addDescriptorBinding("displacementMap", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::floatArray2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT})); + + shaderSet->addDescriptorBinding("displacementMap", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 7, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::floatArray2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT}), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("displacementMapScale", "VSG_DISPLACEMENT_MAP", MATERIAL_DESCRIPTOR_SET, 8, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::vec3Value::create(1.0f, 1.0f, 1.0f)); - shaderSet->addDescriptorBinding("material", "", MATERIAL_DESCRIPTOR_SET, 10, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::PhongMaterialValue::create()); + shaderSet->addDescriptorBinding("material", "", MATERIAL_DESCRIPTOR_SET, 10, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::PhongMaterialValue::create(), vsg::CoordinateSpace::LINEAR); shaderSet->addDescriptorBinding("jointMatrices", "VSG_SKINNING", MATERIAL_DESCRIPTOR_SET, 11, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, vsg::mat4Value::create());