Parallax Occlusion Mapping

Started by
7 comments, last by Yours3!f 10 years, 6 months ago

Anyone have a decent GLSL example of POM?

Advertisement

Anyone have a decent GLSL example of POM?

http://www.gamedev.net/topic/623035-parallax-occlusion-mapping-in-a-deferred-renderer/

I think it can even be extended with that shadow stuff, and the pixel-perfect displacement mapping (ie. silhouette mapping) as it is in CE3

hm, thanks. i'll try to take a look although i'm doing forward rendering so it might be a bit tricky

i got it running without errors but the results are screwy :/ would be grateful for anyone else with another example

i got it running without errors but the results are screwy :/ would be grateful for anyone else with another example

it has nothing to do with deferred rendering, I just used that for lighting. You need to make sure your generated tangent vector are ok, then I suppose after doing normal mapping this shouldn't be much challenge either. The directx sdk has a great example.

so . . . it "kind of" works, but mainly up close from only one direction and far away it gets too distorted.. here's a vid, take a look (only the brick in the hallway[texture you supplied] is parallaxed)

Also, this is how I calculate my tangent stuff in the vertex shader:

vec3 c1 = cross( v_Normal, vec3( 0, 0, 1 ) );
vec3 c2 = cross( v_Normal, vec3( 0, 1, 0 ) );
vec3 tangent;
if( length( c1 ) > length( c2 ) ) tangent = normalize( c1 );
else tangent = normalize( c2 );
vec3 n = normalize( V_NormalMatrix * v_Normal );
vec3 t = normalize( V_NormalMatrix * tangent );
vec3 b = cross( n, t );
I see that which is probably basically what you have as your `vertex_output.tbn`
At first i thought `vs_to_ts` was the same as `vertex_output.tbn`, but apparently not... So i tried this instead:
mat3 vs_to_ts = mat3(t.x,b.x,n.x,t.y,b.y,n.y,t.z,b.z,n.z );
and these are the results I got. No distortion. . . but still seems somewhat wrong? It like... goes from one direction to the other, based on the direction i'm viewing it from..
It almost seems like my tangent calculations are wrong? But, I use them in my specular normalmapping which works perfectly fine, so I don't think they're off..

Hmm, I just tried by implementing the one from this page, and I get basically the same results

http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-closer-look-at-parallax-occlusion-mapping-r3262

Maybe that's how it's supposed to be. Also might not be worth the performance hit

Hmm, I just tried by implementing the one from this page, and I get basically the same results

http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-closer-look-at-parallax-occlusion-mapping-r3262

Maybe that's how it's supposed to be. Also might not be worth the performance hit

you quite possible have some problems with coordinate spaces or your tangents/normals etc. aren't good. it should look like this (look at the floor: stable, solid, great at grazing angles):



performance wise, it should be rougly the same speed as tessellation, but this doesn't have to be tweaked that much. So it IS worth the implementation (imho). It does have some performance impact but that should be ok.

so . . . it "kind of" works, but mainly up close from only one direction and far away it gets too distorted.. here's a vid, take a look (only the brick in the hallway[texture you supplied] is parallaxed)

Also, this is how I calculate my tangent stuff in the vertex shader:

vec3 c1 = cross( v_Normal, vec3( 0, 0, 1 ) );
vec3 c2 = cross( v_Normal, vec3( 0, 1, 0 ) );
vec3 tangent;
if( length( c1 ) > length( c2 ) ) tangent = normalize( c1 );
else tangent = normalize( c2 );
vec3 n = normalize( V_NormalMatrix * v_Normal );
vec3 t = normalize( V_NormalMatrix * tangent );
vec3 b = cross( n, t );
I see that which is probably basically what you have as your `vertex_output.tbn`
At first i thought `vs_to_ts` was the same as `vertex_output.tbn`, but apparently not... So i tried this instead:
mat3 vs_to_ts = mat3(t.x,b.x,n.x,t.y,b.y,n.y,t.z,b.z,n.z );
and these are the results I got. No distortion. . . but still seems somewhat wrong? It like... goes from one direction to the other, based on the direction i'm viewing it from..
It almost seems like my tangent calculations are wrong? But, I use them in my specular normalmapping which works perfectly fine, so I don't think they're off..

hey there, I only had time to look at this now, here's how I calculate the tangents (on the cpu):
https://github.com/Yours3lf/libmymath/blob/master/mymath/mm_util.h#L102

This topic is closed to new replies.

Advertisement