Hardware bump mapping demo

Blitz3D Forums/Blitz3D Programming/Hardware bump mapping demo

Tom(Posted 2006) [#1]
Hiya,

Been *exploring* bump mapping via the DLL, it's not DOT3, it's the other type, I think environmental bump mapping?

Bump mapping in Direct3D can be accurately described as "per-pixel texture coordinate perturbation of specular or diffuse environment maps," because you provide information about the contour of the bump map in terms of delta-values, which the system applies to the u and v texture coordinates of an environment map in the next texture stage. The delta values are encoded in the pixel format of the bump map surface.


Strangely, I didn't have to create a specific bump map, instead I just converted a grayscale map using NVidias PS DDS tools to a U8V8 map and saved it as a bitmap.

Uses 2 commands you must call before and after a RenderWorld() that forces the 2nd texture layer to use bump mapping during the call.

www.tomspeed.com/embm.rar

Move in close to the surface and look towards the edge, this could make for some kick ass water huh?

Frame rate is a wopping 900+ here! So so long as your card supports it via hardware (should be widely supported) it's a nice free effect :)

More info to follow
Tom


puki(Posted 2006) [#2]
This wasn't here a minute ago.


Picklesworth(Posted 2006) [#3]
Mmmm... cool.


300 FPS here, on Radeon 9600 Pro.
No idea what version of that gd Catalyst driver thing I'm running on, and I'm afraid to use the Control Center thing to check.


Zmatrix(Posted 2006) [#4]
thats what I was trying to do when I was asking about the Render states of you dll ;)

Embm isnt really a good name for it,,,while it can do enviromental bumpmaps. it can do many other bump effects.
"Preturbed surface" should be what its called.

yeah you only need a heightmap, but a geyscale verion of the same texture will create a bumpy effect...but a heightmap is better :)

it will be easier to generate cubemap lights with color than with dot3...this is good stuff.

*edit
It should run on geforce3+(geforce2 left it out) and any radeon class (even 7000) , matrox and kyro2.

Sam


puki(Posted 2006) [#5]
I'd be brutally honest here - I'd rather you came up with a useable solution for DOT 3. You can still work on this too - just come up with a better implementation of DOT 3 too.

Right, everyone is happy. Next week is fine by me.


smilertoo(Posted 2006) [#6]
something isnt right, i only get 500-700fps.


Picklesworth(Posted 2006) [#7]
We should summon Mark and force him to do something to make the DX7Test DLL completely trustable for full projects.

...Either that or put its functionality straight into B3d.

It's a shame that this sort of stuff, in its current incarnation, can't safely go far beyond a tech demo.


Tom(Posted 2006) [#8]
I'd rather you came up with a useable solution for DOT 3. You can still work on this too - just come up with a better implementation of DOT 3 too.


What did your last slave die of? :O)


slenkar(Posted 2006) [#9]
we are all his slaves....


skyfire1(Posted 2006) [#10]
Could someone post some screenshots? I'm using linux right now.


puki(Posted 2006) [#11]
"Tom" will attend to this request.


Zmatrix(Posted 2006) [#12]
I messed around changing the Textures and..
I think your texture stages may be in the wrong order Tom,
it seems to be getting the surface data from the cube map not the bump texture?

In other programs I would do it like this:
(for example in Quest3d)

Stage1 diffuse texture
stage2 bump texture
stage3 enviroment or lightmap.

that runs fine on a radeon7000 or a kyro2
but its dx8...so it might be a little different.

Sam


puki(Posted 2006) [#13]
Mistakes will not be tolerated.


Tom(Posted 2006) [#14]
Zmatrix: That demo isn't really showing it off well, I'll up a match for the DX7 sample in a while. Looks similar, except for the spherical enviroment map which looks odd.


Zmatrix(Posted 2006) [#15]
gonna release some b3d code>? ;)

I was gonna ask about the shpereical map, are you sure embm supports cubemaps correctly?


Sam


fredborg(Posted 2006) [#16]
Tom, it looks great with a proper cubemap, the one in your demo is messed up. If you need one let me know :)


Ross C(Posted 2006) [#17]
Nice one Tom!


Naughty Alien(Posted 2006) [#18]
..cool..I'm looking forward to see this also included in to final composition in one DLL..


OrcSlayer(Posted 2006) [#19]
I was just watching Galaxy Quest the other day...and when I heard the guy say "Raving Egomaniac" I couldn't help but think of puki...


slenkar(Posted 2006) [#20]
Puki will use 'force choke' like Darth Vader


Zmatrix(Posted 2006) [#21]
Tom, ignore earlier posts...It looks right on my Radeon..on the geforce6800 the Cubemap is stretched out and banded.
how does it look for you Ross C (seeing you have a geforce also)

Sam


Mustang(Posted 2006) [#22]
Coooooool...! On my laptop it looked bit "stretched out and banded", have to check how it looks on my work machine when I get there. But this would be a good addition as DOT is hard to use and mostly useless anyway because there's no tangent space support.

[edit]

OK, at work... it looks on my GF7800FTX very different, more right I guess. If Fred is right then the weirdness that's left comes from the cubemap. I'm really looking forward to get the "proper" demo!

EMBM:


Bump Mapping

This is a method where the flat image of a texture map is altered to give the impression of being non-smooth but without changing the physical shape of the surface. Bump mapping is becoming more popular in 3D games because it can be used to add small scale detail (such as wrinkles, creases, scuff marks, etc) without the need to add extra polygons.

It does this by using another texture map (sometimes called a bump map) to change the brightness of the pixel in the main texture on the surface. There are various methods of bump mapping - 3 such popular ones are:

Emboss:
the bump map is called a height map - it is a simple greyscale version of the texture to be bumped, whereby the texel values are used to alter the colour of the original pixel. The height map is rendered twice, with the second one moved slightly. The two maps are then combined together, in such a way that the resulting new bump map is the difference between the two. This is then multiplied with the required base texture.

DOT Product 3:
the bump map is called a normal map - this texture contains values that alter the surface normals of the original pixels. A surface normal is like an arrow that points in the direction that the surface is facing in; as it angles away from a light source, the colour of the pixel gets darker (and vice versa). This method generally gives better results than embossing but at a greater cost to performance.
Direct3D offers a "set" dot 3 bump mapping routine but a more general method exists too; normal mapping basically uses the same process but it is done via a programmable pixel shader.

Environmental:
this method uses a mixture of techniques, embossing, and environment mapping. A height map is created (as described above) and then blended with the original base texture; this is then followed by blending this result with an environment map (which can be anything from a simple lightmap to a complex cubic map) to give the final bumped surface.
It should be noted that bump mapping never alters the position or amount of vertices in the surface. Edge-on views and shadows can spoil the illusion but more complex bump mapping procedures can help to reduce this problem.




Phalastos(Posted 2006) [#23]
Hi Tom,

i canīt see any objects on the screen.
I see a blue background and 2 lines with text.

EDIT : ( thanks Zmatrix )

ATI Radeon 9100 64MB VRAM / WIN98se


Zmatrix(Posted 2006) [#24]
What Graphics card do you have Phalastos?

@Mustang,

Embm has been around since DX6 if im not mistaken? on the Kyro series of cards they called it preturbed UV?.

if used with a enviroment map ( such as here) its looks like a refracting wet or shiney bumpy surface.
with a lightmap it looks alot like Dot3 (more like dot3 with specular component)

it was over looked/under used becuase of card limitations when it was implimented.
3 texture stages was heavy on older cards,(some had to do it in 2 passes)
the Env maps had to be low res because of memory limits.
And its biggest downfall...the most popular dx7 cards the geforce1/2 didnt support it.

Its used on some gamecube games(mainly for water), and I think a few Dreamcast games used it also.

there may be more limitations on it, Im not sure (I didnt think it could be Mipped, but Toms demo apears to do just that)

But at worst..we can have some pretty water in B3d..heh ;)

Tom,
I have the "Dx7 d3d bumpmap compare" demo/source From powerVR
its a embm/emboss/dot3 comparision.
pretty clean , even I can follow it...lol
I can seem to find it on the Web anymore...but i could email it to you if you would like.

Sam


bytecode77(Posted 2006) [#25]
hey, i'm looking forward to see the source code?
could you give it to us, please?


Ross C(Posted 2006) [#26]
Sorry, i haven't updated my specs. I'm running a radeon 9800 pro now. Works fine on it :o)


Tom(Posted 2006) [#27]
source & new demo here:
http://www.blitzbasic.com/Community/posts.php?topic=62128


puki(Posted 2006) [#28]
Woof, woof