Get the pixel size in shader for homemade MipMap

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Get the pixel size in shader for homemade MipMap

Post by Valmond »

Hi

I have done an Atlasmap for my terrain created by FreeWorld3D and it works okay except that I can't create it with MipMap generation set to true (bleeding around the edges).
So I thought I'd generate the MipMaps myself which brings me to the problem on how to select the right LOD in the fragment shader??

I'v searched tons of "texel size" etc. on google and in the forum but I just can't lay my hands on that pice of code that'll give me the size of the pixel the fragment shader is suppoised to draw (well, the pixelsize in texelspace i guess).

I didn't know if I should post this in the Off-topic or not, sorry if I should have.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I'm no shader whizz but I did solve a similar problem a while back, the answer was the "fwidth" function.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

You can also look on this (Sub-tiling):
http://www.gamedev.net/community/forums ... cyear=2008
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Post by Valmond »

bitplane got me running for over a day and Nadro confirmed what I'v found :)

Thanks !


Guess you can't get the pixelsizes with 'old" shaders like the 1.2 (Nadros link says you'll need like at least 3.0 shaders)?
Post Reply