![]() |
|
Normal Mapping Precision on iOS - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Graphics & Audio Programming (/forum-9.html) +--- Thread: Normal Mapping Precision on iOS (/thread-8833.html) |
Normal Mapping Precision on iOS - OptimisticMonkey - Apr 13, 2011 03:31 PM I was using ZBrush alot lately, and want to get normal mapping working on ios. I have implemented a normal mapping glsl shader that works, but I see subtle "banding" on the lit parts of the model. The shader works great when I run it on the mac with no banding - it's only on ios that I see the effect. I am thinking it might be a problem with the precision of the texture sampler on ios. Is this a known issue - should I look into encoding the normals in a more effecient fashion... I am using the stock tangent space normal map coming out of zbrush, which I think encodes nx,ny,nz in r,g,b and ignores a. Thanks for any advice... RE: Normal Mapping Precision on iOS - OneSadCookie - Apr 13, 2011 04:17 PM GLSL ES has the concept of "precision" within the shader. This allows you to potentially sacrifice precision in your results to run faster. Long story short, the default precision for the fragment shader is "mediump"; did you change it? RE: Normal Mapping Precision on iOS - OptimisticMonkey - Apr 13, 2011 07:54 PM Yes - I have tried using highp for everything... still same banding is present. It is like the actual sampler is returning lower precision normals. on mac: ![]() on ios: ![]() Thanks again for any advice.... RE: Normal Mapping Precision on iOS - OneSadCookie - Apr 13, 2011 08:20 PM Samplers also have associated precision, did you set the precision on the sampler? Additionally, the default precision for samplers is "lowp". Maybe you should post your shader code. RE: Normal Mapping Precision on iOS - arekkusu - Apr 13, 2011 10:23 PM What texture format are you using? RE: Normal Mapping Precision on iOS - OptimisticMonkey - Apr 13, 2011 11:21 PM I tried it with the samplers explicitly set to highp - same issue... I tried limiting the fragcolor to just a solid color modulated by nDotL... and I still see the banding...it seems to be an artifact of how I am calculating nDotL. Here are the shaders (sorry I haven't taken time to clean them up) Vertex Shader Code: attribute vec4 position;Fragment Shader Code: precision highp float;Thanks again for any advice.... RE: Normal Mapping Precision on iOS - OptimisticMonkey - Apr 13, 2011 11:35 PM arekkusu - You are Open GL master! I was using a Texture loader that was incorrectly picking RGB565! Once I used rgba8888 all was perfect! Thank you - I have been struggling with this all day :-) And thank you too OSC ! :-) |