22
May
08

Radial VDM, Sobel Normalmap

OK, time for some explanation:
These are meshes created using ‘Vertex Displacement Mapping’. The displacement image used to create the distorted sphere form is behind each mesh. I’ve experimented with this technique before (and been less-than-impressed by the resulting framerates), but this time I’ve tried to add lighting by using a normal map in the Fragment shader. Normal map creation is also something I’ve tried before, but this time I tried a different method of creating it, based on modified Sobel filter code Desaxismundi very kindly sent me. I’m not altogether pleased with the results, which show a lot of ‘stepping’, but it’s an interesting experiment.

The first set of five snaps use simple, diffuse-only lighting. With the others, I’ve implemented the velvet lighting effect I mentioned in a previous post. Looks a bit odd on a ‘spiky’ form. More crystalline than soft and velvetty, I think, but it’s still a nice look. I’ll try a version with Phong lighting too, but I want to produce a set of portable, generalised Phong lighting Vertex and Fragment shader functions that I can easily apply to other projects, rather than just hacking-together something that works for this specific case.

Advertisements

10 Responses to “Radial VDM, Sobel Normalmap”


  1. 1 639me
    July 4, 2008 at 12:37 am

    i think these look absolutely brilliant! i’d love to try displacement mapping in glsl. have you released any qtz’s yet? and the displacement images in the back, they really look good as backgrounds. brilliant idea! i think the velvet lighting works great with darker shades

  2. 2 toneburst
    July 4, 2008 at 8:45 am

    Hiya,

    they’re quite cool, aren’t they. A bit more interesting than the usual heightfield/landscape generation applications of the vertex displacement technique.

    In order to get VDM working, I’ve had to use a Kineme.net plugin that’s still in beta. If you’re registered there, and have checked the option to be able to see beta releases, however, you should be able to download it. It’s the OpenCV patch.

    The displacement map is generated by the Kineme Texture plugin, which can be freely downloaded from their site. If you’ve got both the plugins, give me a shout, and I’ll send you the QTZ.

    a|x

  3. July 10, 2008 at 11:58 pm

    That all looks very claymation!

  4. 4 toneburst
    July 11, 2008 at 9:11 am

    Hiya Hob,

    I hadn’t thought of that. I was thinking more oddly-symmetrical asteroids…

    I’m going to revisit this one sometime. I’m kinda waiting for the modified heightfield plugin that supports texture-mapping and lighting in a GLSL shader, though, as the GLSL VDM method is always going to fall back to software (with all the poor performance that implies).

    a|x

  5. 5 639me
    September 14, 2008 at 12:07 pm

    hei
    i missed out on this one. i got the open cv and texture plugins. so if you’d still want to obscure your spaghetti (hm..), i’d be thankful!

  6. 6 swizzle
    October 31, 2008 at 3:21 pm

    Will the source code be available at any point? I’m most interested in the shader code for the normal generation using a sobel filter. I’ve implemented my own form of displacement mapping, with normals generated using a sobel filter, but there are some anomalies at the texture edges. I’m curious about examining an alternate implementation.

  7. 7 toneburst
    October 31, 2008 at 4:59 pm

    Hi swizzle,

    I’d be very interested to see your implementation too, in fact. I was never happy with the way my version worked. In fact, I was always amazed that it did actually work at all. The problem I had was that for various reasons, I couldn’t get tangent data for each vertex, which makes it very hard to transform the normals stored in the normal-map into the right space. Also, the fact that I was creating a spherical, rather than planar mesh made things much more complicated.

    Do you happen to have any examples of your version I could see?

    Cheers,

    a|x

  8. 8 swizzle
    November 3, 2008 at 11:23 pm

    a|x,

    My solution probably isn’t much to write home about 🙂 Mostly I’ve aggregated existing solutions. I see you made a comment on Catalin’s blog:

    http://catalinzima.spaces.live.com/blog/cns!3D9ECAE1F2DC56EF!223.entry

    Recently I’ve basically gutted my version and stolen this one. I’m using GLSL though, not HLSL, so there are minor differences.

    Here is a somewhat useful post about how to find the gradient (normal):

    http://www.gamedev.net/community/forums/topic.asp?topic_id=370902

    I’m a little confused about what “scale” means in this case. In the Catalin implementation, the y-component (z- in my case) is just some constant. I’ve tried this as well as reading the value from the heightmap and using that directly. Both seem a little off, when compared to analytically finding the normal (I can do this because my test data has a simple displacement function).

    GPU Gems 1 Chapter 42 has some useful information about tangent-space calculations. Also, this article has some implementation details:

    http://www.ozone3d.net/tutorials/mesh_deformer_p2.php

    One thing that I’m generally confused about is the sobel kernel itself. Depending on which reference you look at, it seems like the horizontal and vertical masks are interchangeable. In fact, I’ve found that switching dx and dy in the Catalin example makes for better results in my case.

    Anyway that’s probably enough rambling for now 🙂 Let me know what you think.

  9. 9 toneburst
    November 4, 2008 at 3:37 pm

    Hi Swizzle,

    I replied via email.

    a|x

  10. 10 swizzle
    November 4, 2008 at 4:27 pm

    I haven’t seen any new mail. You sent to my gmail address, correct?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Twitter

May 2008
M T W T F S S
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

Links

Blog Stats

  • 474,728 hits

%d bloggers like this: