I'm writing texture atlas on the fragment shader and I really need to use texture2DLod in order to render the textures correctly in different mip levels. I just found out that WebGL only supports texture2DLod on the vertex shader. Is there some way for me to access texture2DLod on the fragment shader? Perhaps I could use a custom function that does the same?
Asked
Active
Viewed 3,760 times
1 Answers
4
Simply use texture2D with the third parameter set to the lod you want to use:
gl_FragColor = texture2D(map, uv, lod)

Henrik Ilgen
- 1,879
- 1
- 17
- 35