Skip to content

Commit

Permalink
Switch from back face culling to back face culling so that the rays s…
Browse files Browse the repository at this point in the history
…tart at the back of the brick and march forwards towards the eye through the volume
  • Loading branch information
robertosfield committed Apr 24, 2023
1 parent 29a5f91 commit 4f47b59
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/volume/vsgvolume/vsgvolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ int main(int argc, char** argv)
auto vertexShader = vsg::read_cast<vsg::ShaderStage>("shaders/volume.vert", options);
auto fragmentShader = vsg::read_cast<vsg::ShaderStage>("shaders/volume.frag", options);

// if (!vertexShader) vertexShader = vsg::ShaderStage::create(VK_SHADER_STAGE_VERTEX_BIT, "main", volume_vert);
// if (!fragmentShader) fragmentShader = vsg::ShaderStage::create(VK_SHADER_STAGE_FRAGMENT_BIT, "main", volume_frag);
if (!vertexShader) vertexShader = vsg::ShaderStage::create(VK_SHADER_STAGE_VERTEX_BIT, "main", volume_vert);
if (!fragmentShader) fragmentShader = vsg::ShaderStage::create(VK_SHADER_STAGE_FRAGMENT_BIT, "main", volume_frag);

if (!vertexShader || !fragmentShader)
{
Expand Down Expand Up @@ -254,10 +254,14 @@ int main(int argc, char** argv)
VkVertexInputAttributeDescription{0, 0, VK_FORMAT_R32G32B32_SFLOAT, 0}, // vertex data
};


auto rasterizationState = vsg::RasterizationState::create();
rasterizationState->cullMode = VK_CULL_MODE_FRONT_BIT;

vsg::GraphicsPipelineStates pipelineStates{
vsg::VertexInputState::create(vertexBindingsDescriptions, vertexAttributeDescriptions),
vsg::InputAssemblyState::create(),
vsg::RasterizationState::create(),
rasterizationState,
vsg::MultisampleState::create(),
vsg::ColorBlendState::create(),
vsg::DepthStencilState::create()};
Expand Down

0 comments on commit 4f47b59

Please sign in to comment.