Skip to content

Commit

Permalink
修改参数
Browse files Browse the repository at this point in the history
  • Loading branch information
luxiaodong committed Sep 29, 2022
1 parent ccb4246 commit e72cfcf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
33 changes: 13 additions & 20 deletions Vulkan/Vulkan_Sample/Vulkan/assets/shaders/shadowquality/scene.frag
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,19 @@ void main()
vec3 N = normalize(inNormal);
vec3 L = normalize( vec3(1,-1,1) );

// directional light
float NoL = min(dot(N, L), 1.0);

float shadow;
vec4 position_clip = biasMat * ubo.lightSpace * vec4(inWorldPos, 1.0);
vec4 shadowCoord = position_clip / position_clip.w;
shadow = textureProj(shadowCoord, vec2(0.0));

if (NoL > 0.0f && shadow > 0.0f)
{
float NoL = min(dot(N, L), 1.0);

if (NoL > 0.0)
{
float shadow;
{
vec4 position_clip = biasMat * ubo.lightSpace * vec4(inWorldPos, 1.0);
vec4 shadowCoord = position_clip / position_clip.w;

shadow = textureProj(shadowCoord, vec2(0.0));
}

if (shadow > 0.0f)
{
Lo = vec3(shadow, shadow, shadow);
}
}
Lo = vec3(shadow, shadow, shadow);
}

outFragColor = vec4(N, 1.0);

// Lo = vec3( abs(shadowCoord.x), abs(shadowCoord.y), abs(shadowCoord.z));

outFragColor = vec4(Lo, 1.0);
}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

ShadowQuality::ShadowQuality(std::string title) : Application(title)
{
m_width = 1336;
m_height = 1018;
m_width = 1336/2;
m_height = 1018/2;
}

ShadowQuality::~ShadowQuality()
Expand Down Expand Up @@ -76,7 +76,7 @@ void ShadowQuality::prepareVertex()
{
std::vector<std::string> filenames = {"capsule.obj", "cone.obj", "convexmesh.obj", "cube.obj", "cylinder.obj", "sphere.obj"};

m_sphereLoader.loadFromFile2(Tools::getModelPath() + "basic/" + filenames[5]);
m_sphereLoader.loadFromFile(Tools::getModelPath() + "basic/" + filenames[5]);
m_sphereLoader.createVertexAndIndexBuffer();

m_planeLoader.loadFromFile(Tools::getModelPath() + "basic/floor.obj");
Expand Down

0 comments on commit e72cfcf

Please sign in to comment.