You should look in the developer tools, and check out the GLHeighfield
example, it does a similar effect but with render to vertex buffer.
which should be supported under more hardware.
Ive edited your vertex shader like so, which does z displacement,
similar to a rutt etra video effect. Ironically, youve helped me solve
a huge problem I was having. I did not realize you could sample within
the vertex shader, which i think is only supported under a few newer
cards? At least I had errors attempting it before on my hardware.
Awesome.
uniform sampler2D DisplacementMap;
const float textureSize = 256.0;
const float texelSize = 1.0 / 256.0;
/*vec4 texture2D_bilinear(sampler2D Tex, vec2 uv)
{
vec2 f = fract( uv.xy * textureSize );
vec4 t00 = texture2D( Tex, uv );
vec4 t10 = texture2D( Tex, uv + vec2( texelSize, 0.0 ));
vec4 tA = mix( t00, t10, f.x );
vec4 t01 = texture2D( Tex, uv + vec2( 0.0, texelSize ) );
vec4 t11 = texture2D( Tex, uv + vec2( texelSize, texelSize ) );
vec4 tB = mix( t01, t11, f.x );
return mix( tA, tB, f.y );
}
*/
void main(void)
{
vec4 newVertexPos;
vec4 dv;
float df;
vec4 v = gl_Vertex;
gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
// dv = texture2D_bilinear(DisplacementMap, gl_MultiTexCoord0.xy);
dv = texture2D(DisplacementMap, gl_MultiTexCoord0.xy);
df = 0.30*dv.x + 0.59*dv.y + 0.11*dv.z;
v.z += df;
//newVertexPos = vec4(gl_Normal * df * 100.0, 0.0) + gl_Vertex;
gl_Position = gl_ModelViewProjectionMatrix * v;
}
On Nov 5, 2007, at 4:07 AM, Alex Drinkwater wrote:
Hiya,
I've been trying to get the code from the following
tutorial to work
in a GLSL patch in Quartz Composer.
http://www.ozone3d.net/tutorials/vertex_displacement_mapping_p03.php
I understand that vertex displacement is only
supported on certain
graphics hardware (ie newer nvidia cards), but I
wonder if the
attached patch works for anyone. I don't get an error
when I run it on
my G5 (with an nvidia GeForce 7800 GPU), but neither
does it actually
appear to work. It could be I'm making some very
stupid and obvious
mistake in the code, as I just copy-pasted it from the
page. Anyone
any ideas?
My test QTZ file can be downloaded here;
http://158.223.20.36/temp/Vertex_Displace_Test_04-11-07.qtz
If some could take a look at it, I'd be very grateful.
Cheers,
alx
http://www.toneburst.net
___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer.
Try it
now.
http://uk.answers.yahoo.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected]
)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/doktorp%40mac.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]