Home Forums Games202-高质量实时渲染 作业一阴影很小

Tagged: 

Viewing 4 reply threads
  • Author
    Posts
    • #8031 Score: 0
      由乃克斯
      Participant

      作业一阴影很小,不知道是哪里的问题,求教

      Attachments:
      You must be logged in to view attached files.
    • #8035 Score: 0
      tftl
      Participant
      1 pt

      看上去像是projection的cube参数有问题,先画一下shadowmap看看
      具体方法参考这里

      • This reply was modified 3 years, 7 months ago by tftl.
    • #8097 Score: 0
      zhishao
      Participant
      2 pts

      SM取出来的值unpack后已经在[0,1]了,不需要再归一化到[0,1]了

    • #8104 Score: 0
      青麈
      Participant
      -2 pt

      1.求 shadowCoord,归一化到[0,1]
      vec4 shadowCoord = vPositionFromLight/vPositionFromLight.w;
      shadowCoord.xyz = shadowCoord.xyz*0.5+vec3(0.5,0.5,0.5);

      2.填充API

      float useShadowMap(sampler2D shadowMap, vec4 shadowCoord){
      //return 1.0;
      vec4 rgbaDepth = texture2D(uShadowMap,shadowCoord.xy);
      float depthZ = unpack(rgbaDepth);
      //depthZ = depthZ*0.5+0.5;
      float shadow = shadowCoord.z > depthZ ? 0.0 : 1.0;
      return shadow;
      }

    • #8358 Score: 0
      小夜子
      Participant

      haha,我一开始也这样犯这个错误。要先对vPositionFromLight归一化再去用,不然会被齐次坐标最后一项给影响到。

Viewing 4 reply threads
  • You must be logged in to reply to this topic.