HDRP에서 Custom post-process를 만들고 있습니다.

코드가 셰이더 코드처럼 보이지만, 보던 형태가 아니라 어려움이 있었습니다.

코드도 오랜만이라 어려움이 있어서, AI 도움을 받았습니다.(AI 만쉐~)

원하는 결과를 얻었습니다.

추가된 코드

더보기
    float _Threshold;
    //float _Intensity;
    TEXTURE2D_X(_MainTex);

    float4 CustomPostProcess(Varyings input) : SV_Target
    {
        UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);

    // Note that if HDUtils.DrawFullScreen is used to render the post process, use ClampAndScaleUVForBilinearPostProcessTexture(input.texcoord.xy) to get the correct UVs

    float3 sourceColor = SAMPLE_TEXTURE2D_X(_MainTex, s_linear_clamp_sampler, input.texcoord).xyz;

    // Calculate grayscale value using Rec. 709 formula
    float luminance = dot(sourceColor, float3(0.2126, 0.7152, 0.0722));

    // Determine whether color is bright or dark
    float isBright = step(luminance, 0.07);

    // Convert to black or white
    float3 color = lerp(float3(1, 1, 1), float3(0, 0, 0), isBright);

    float3 oc = color* float3(1.0, 0.0, 0.0);

    return float4(oc, 1);


    }

'업무일지' 카테고리의 다른 글

업무일지 <연출 툴 개선>  (0) 2023.04.21
업무일지 <헤어를 깔끔하게 만드는 방법>  (0) 2023.04.19
업무일지 <Custom post-process>  (0) 2023.04.12
업무일지 <Fresnel>  (0) 2023.04.05
업무일지  (0) 2023.03.30