青麈

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: 有人给作业换过模型吗 #11523 Score: 0
    青麈
    Participant
    -2 pt

    你什么错误也不发 让别人怎么帮你分析?

    in reply to: 作业一阴影很小 #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;
    }

    in reply to: vPositionFromLight.z 恒为 0 #8103 Score: -1
    青麈
    Participant
    -2 pt

    let left = -100
    let right = 100
    let bottom = -60
    let top = 100
    let near = -420
    let far = -40
    正交矩阵的参数,仅供参考。
    调了半天、、、

    This post has received 1 vote down.
    in reply to: 【作业1】请教下,shadowMap中深度的范围 #8101 Score: 0
    青麈
    Participant
    -2 pt

    你的pack代码是不是有问题?作业1里面的pack代码不是你这样的。
    vec4 pack (float depth) {
    // 使用rgba 4字节共32位来存储z值,1个字节精度为1/256
    const vec4 bitShift = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);
    const vec4 bitMask = vec4(1.0/256.0, 1.0/256.0, 1.0/256.0, 0.0);
    // gl_FragCoord:片元的坐标,fract():返回数值的小数部分
    vec4 rgbaDepth = fract(depth * bitShift); //计算每个点的z值
    rgbaDepth -= rgbaDepth.gbaa * bitMask; // Cut off the value which do not fit in 8 bits
    return rgbaDepth;
    }

Viewing 4 posts - 1 through 4 (of 4 total)