Forgive my ignorance, I'm not much of a hard-core GLSL shader guy, though I've done procedural shaders galore in non-realtime photorealistic 3D tools (where I didn't have to write the underlying math). Recently I needed to do some bump-mapping of surfaces using non-repeating texture functions. With some help, I was able to cobble together a shader that converted a 2D noise amplitude function (implemented in GLSL) into a normal, and jammed this into a sample Phong/Bump shader framework provided by ATI/AMD's RenderMonkey. it worked ok, but it has issues. Specifically, I tried to use dfdx and dfdy to determine the texcoord offset to sample to come up with the X and Y slope to formulate the normal when each fragment was evaluated. This appeared to work, but had some strange singularities at certain angles.
I don't want to get into debugging this code if possible, as I'm not certain it was well-inspired to begin with. The Orange Book has an example of bump shading, but it assumes a sort of continuous noise function that can directly supply a slope, and I can't really do that. I'm wondering if there's a canonical example of translating a non-continuous noise amplitude function (let's ignore anti-aliasing for now) into a normal in a GLSL shader? I've kludged mine to work for now, but I don't think it's best practice to do it the way I am. If there isn't such a thing out there, I'll share my shader code and see if anyone has any critique on the amplitude-to-normal function. -- Chris 'Xenon' Hanson, omo sanza lettere. [email protected] http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

