Configure shader maps correctly in own software #1040
-
I want to use the new shadowing functionality in our own software. The standard_pbr.frag has changed to consider shadow maps. I don't understand how the shadow maps have to be configured in the shaderset.
When I run the program, I get this message:
Seems my configuration is incomplete or maybe wrong. What should I do? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The pbr and phong ShaderSet's in the vsgshaderset example illustrate how it's done so is good starting place, and follow the form: shaderSet->addDescriptorBinding("lightData", "", VIEW_DESCRIPTOR_SET, 0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Array::create(64));
shaderSet->addDescriptorBinding("viewportData", "", VIEW_DESCRIPTOR_SET, 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Value::create(0,0, 1280, 1024));
shaderSet->addDescriptorBinding("shadowMaps", "", VIEW_DESCRIPTOR_SET, 2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::floatArray3D::create(1, 1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT})); The new vsgcustomshaderset example and the "so new I only check it in yesterday" vsgtextureprojection also create custom ShaderSet that include sections for the vsg::ViewDependentState. Technically you should be able to get away without defining the DescriptorBinding for the state associated with the ViewDependentState as the above ShaderSet setup include: shaderSet->customDescriptorSetBindings.push_back(vsg::ViewDependentStateBinding::create(VIEW_DESCRIPTOR_SET)); The vsg::ViewDependentStateBinding provides the binding information that is required. The ShaderSet::addDescriptorBinding(..) entries are more for signally the functionality to users. Though... I haven't tried o putting the ShaderSet::addDescirptorBinding(..) calls in :-) One error I spotted in your code was that your code uses 0 for the binding location for both the lightData and the shadowMap, in the above code snippet you'll see 0 and 1 used respectively. |
Beta Was this translation helpful? Give feedback.
The pbr and phong ShaderSet's in the vsgshaderset example illustrate how it's done so is good starting place, and follow the form: