Graphics Emulated Mipmapping Support for shaders


GM Version: gm1.4
Target Platform: Windows(shader in hlsl)
Links: N/A

This function allows for mipmapping in the pixel shader by using a script to create a mipmap texture and a shader function to sample the texture to find the appropriate texture.

The first thing we have to do is to is to create our mipmaptexture from our original image; we use a script to that draws the image repeatedly according to the defined mipmaplevel in a different position and scale until it look something like this:
we then save it into a surface with twice the width but the same height as the image;
With that out of the way all we now need is to change how we sample the texture, with the function "get_mipmap_texcoord" in the shader "mipmap" we can sample each level of the mipmaptexture to get the image on the defined mipmaplevel (note: the mipmaplevel is passed as an argument in the sampler;function; 0.0 is for original texture)

Because the process is emulated there are some problems that would occur, i will address these problems later on but for now i advice you stick to mipmaplevel 0.0-2.0;