Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Displacement Mapping

#40

Add support for displacement mapping to the SceneJS.Texture node.

This would involve extending the texture layer "applyTo" mode to target texturing output at vertices within GLSL, along with extensions to the GLSL program generator.

Notes

  • Internal pixel format of GL_RGBA_FLOAT32_ATI
  • Map must not be filtered - must be nearest mode

Bilear filtering can be done in GLSL like this though:

#define textureSize 256.0
#define texelSize 1.0 / 256.0

vec4 texture2D_bilinear( uniform 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 );
}

Links

Reported by lindsay.kay (at xeolabs) · April 29th, 2010 @ 01:15 AM

State: new
Milestone: none

Activity

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.