开发者

Identify mip map levels by coloring different screen areas in GLSL

开发者 https://www.devze.com 2023-02-16 10:58 出处:网络
I don\'t wish to bombard this post with code. I\'ve got a main file, fragment shader and a vertex shader file.

I don't wish to bombard this post with code. I've got a main file, fragment shader and a vertex shader file.

I need to know the steps that I should take to color the screen according to mipmap level? I.e. where the loop should go t开发者_运维问答hat asks for mipmap level, then sets colour accordingly. I don't know where to implement this or how, a simple example would suffice many thanks.


You should create a texture with a different color for every level, and then retrieve that color in your fragment program. It might also be possible to compute it using dFdx(texcoord.x) and dFdy(texcoord.y).


Like tibur said, an easy way to do this is to use a debug texture that have a different color for every level as seen here.

Now if you need to compute the mipmap level by hand (usually a floating point value), this is another story since you will need derivatives, but this should put you on track.


http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter28.html

This GPU Gems 2 article implements something like what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消