Skip to main content
gamedev.net
🔒 Locked

pixel shader displacement mapping (sortof)

Started by RipTorn Nov 21, 2003 at 5:24 AM 9 replies 8.2k views
Original Post
RipTorn
RipTorn
I thought I''d share something, The other day I saw an article on opengl.org about per-pixel displacement mapping (here), which looked mighty impressive and I wanted to try it out. It''s just that it a), it didn''t run, and b), needed absolutly massive ''4d'' textures.. So I decided to try and write my own. (Using just the height stored in the alpha of the normal map). Although I bumped into the limits of my radeon (and therefor couldn''t get things as accurate as I want) this is the result (two triangles). I''m quite happy. it doesn''t slow things down too much either (about 15% slower over normal PPL lighting). If enough people want a description of how I did it I suppose I can write something up. Anyway. Just thought I''d share some fun I had. :D | - Project-X - On hold (kindof ).. - | - adDeath - | - email me - |
Ready4Dis
Ready4Dis
I'm going to see about playing with those, but I have a feeling my graphics board may just be a tad to old .


--- Edit ---
By the way, I'd be interested in your method and/or a demo to see if it'll work on my radeon 9100.

[edited by - Ready4Dis on November 21, 2003 10:33:23 AM]
Nik02
Nik02
The textures seem to contain the pattern''s normals for every possible viewing angle (of course, not _every_ angle; hence simplification to 2d), so that the inter-occlusion(sp?) of the shapes can be presented to the pixel shader.

Note that effectively implementation almost requires that the same pattern is used over the entire surface. I say "almost" because i have a tingling feeling in my mind that this could be more generalized.

Not magic, but clever

-Nik
Niko Suni
Pragma
Pragma
I would be interested to see if you could adapt it to arbitrary curvature, as they did in the siggraph paper. The reduction in texture space is great, since the siggraph images were really low-res but took up huge amounts of video ram.

Are you doing multiple lookups into a height map (raytracing style), or something more tricky than that?

"Math is hard" -Barbie
"Math is hard" -Barbie
RipTorn
RipTorn
yes I am doing multiple lookups into a height map, my video card (a radeon 9500) doesn''t seem to have the felxibility to do more than 5 (shown) - I expected more to be possible as the texture coords are generated in the vertex shader not the pixel shader, I have a couple of ideas how to make these more accurate, and reduce artifacts that occur at really low angles, but I can''t since the shaders I write to try these ideas don''t compile (Cg) and I''m not sure for what reason. (I could probably cut out the lighting calculations I guess)

as for the radeon 9100 thing, I have seen a similar thing done on my old radeon 9000 a long time ago, but very was pretty rough (simply an offset based on a single heightmap, so at low angles things blew up badly - unlike this where things only slightly blow up )


the ftp I use isn''t responding so I can''t put up a couple of pics I want to... will do later on...

| - Project-X - On hold (kindof ).. - | - adDeath - | - my windows XP theme - | - email me - |
JonnyQuest
JonnyQuest
Wow, those images look gorgeous. Good work, man. I can''t play with it because I haven''t upgraded from my Radeon 8500 yet, but I''m looking forward to getting my hands on a 9800XT now.

If you can''t be bothered to do a detailed description, how about the shader source?

- JQ
~phil
RipTorn
RipTorn
I think I will write something up...

It was great fun to write, and didn''t need any new code which was nice.

I''m going up to talk with a few docs later in the week about some work I might be doing.. so I think I''ll have a talk about this too.l

| - Project-X - On hold (kindof ).. - | - adDeath - | - my windows XP theme - | - email me - |
wolf
wolf
That''s looks good. I am looking forward to read your description.

- Wolf

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.