Reputation: 113
I have an issue with applying noise over the surface of a non-trivial mesh (well any mesh) in OpenGL without texture coordinates. I basically want to have a noise texture applied over the surface but since I don't have texture coordinates I can't just apply a noise texture. Generating texture coordinates in the vertex shader works to an extent however whether it is cube, sphere or object planar coordinates there is always some texture smearing.
smearing with cube map http://img811.imageshack.us/img811/3923/0ouu.png
Smearing with cube map coordinates across surface changes
smearing with object planar http://img195.imageshack.us/img195/987/c3cz.png
Smearing with object planar (xy) coordinates along z plane
I've done random noise generation in the fragment shader however as this changes every frame it is not what i need (and not computationally cheap either).
I just need a static uniform distribution of noise across the mesh surface.
Anybody got any ideas on how this could be done?
Upvotes: 0
Views: 478
Reputation: 2022
You could acquire 3d model space coordinates for each pixel in fragment shader and use some 3d noise based on those values.
Upvotes: 1