GPU 텍스처 미립 필터 설정 함수
이 문서에서는 gpu_set_tex_mip_filter_ext
함수에 대해 설명합니다. 이 함수는 특정 셰이더 샘플러에 대한 미립 필터 모드를 설정하는 데 사용됩니다.
함수 설명
gpu_set_tex_mip_filter_ext
함수를 사용하면 주어진 셰이더 샘플러의 미립 필터 모드를 설정할 수 있습니다. 이 함수는 shader_get_sampler_index()
함수로 반환된 셰이더 샘플러의 핸들과 아래에 나열된 모드 값 상수 중 하나를 인수로 받습니다.
모드 값 상수 설명
상수 이름 | 설명 |
---|---|
tf_point |
미립 맵 레벨 간의 블렌딩이 비활성화되어, 텍스처 전환이 눈에 띄게 보일 수 있지만 성능이 가장 좋습니다. |
tf_linear |
미립 맵 레벨 간의 블렌딩이 활성화되어 텍스처 전환이 부드러워지지만 성능에 약간의 영향을 미칩니다. |
tf_anisotropic |
비등방 필터링이 활성화되어 텍스처 전환 품질이 크게 향상되고 다른 필터링 모드에서 보이는 흐림을 줄일 수 있지만 성능에 가장 큰 영향을 미칩니다. |
함수 구문
gpu_set_tex_mip_filter_ext(sampler_index, filter);
인수 설명
인수 이름 | 타입 | 설명 |
---|---|---|
sampler_index |
셰이더 샘플러 핸들 | 설정할 셰이더 샘플러의 핸들입니다. |
filter |
미립 맵 필터 상수 | 사용할 미립 필터 모드 (기본값: tf_point ). |
반환 값
- N/A
활용 예제
다음은 gpu_set_tex_mip_filter_ext
함수를 사용하는 예제입니다.
var _sampleIndex = shader_get_sampler_index(shd_Glass, "s_Background");
var _spriteTex = sprite_get_texture(sprite_index, 0);
shader_set(shd_Glass);
if (gpu_get_tex_mip_filter_ext(_sampleIndex) != tf_point) {
gpu_set_tex_mip_filter_ext(_sampleIndex, tf_point);
}
texture_set_stage(_sampleIndex, _spriteTex);
shader_reset();
위 코드는 주어진 셰이더 텍스처 샘플러에 대해 미립 필터 모드를 tf_point
로 설정합니다(미립 맵 비활성화). 만약 이미 설정되어 있지 않다면 설정을 진행합니다.
추가 활용 예제
- 비등방 필터링 설정 예제
gml var _sampleIndex = shader_get_sampler_index(shd_Texture, "s_Texture"); gpu_set_tex_mip_filter_ext(_sampleIndex, tf_anisotropic);
- 선형 필터링 설정 예제
gml var _sampleIndex = shader_get_sampler_index(shd_Texture, "s_Texture"); gpu_set_tex_mip_filter_ext(_sampleIndex, tf_linear);
- 조건부 필터링 변경 예제
gml var _sampleIndex = shader_get_sampler_index(shd_Texture, "s_Texture"); if (gpu_get_tex_mip_filter_ext(_sampleIndex) == tf_linear) { gpu_set_tex_mip_filter_ext(_sampleIndex, tf_anisotropic); }
이와 같이 gpu_set_tex_mip_filter_ext
함수를 활용하여 다양한 텍스처 필터링 모드를 설정할 수 있습니다.