Bump mapping vs Fragment/Vertex programs

Hi,



I've tried searching for this topic but haven't been successful. I'm new to jME and am trying to understand some of the graphical effects that can be done using this engine. In particular, I'm trying to determine the differences (pros and cons) between using a bump mapping approach, as in the TestBumpMapping demo class, and a custom fragment/vertex program, as in the TestFragmentProgramState demo class. Why would one be used over the other and under which circumstances? They appear to have the same visual effect to me  :?

what's done in testbumpmapping is simple dot3 bumpmapping which is about as good as you can do with the fixed function pipeline. with shaders you are free to implement whatever bumpmapping technique you wish, normalmapping, parallax, relief etc etc

Ok, I think I understand a little more now. So essentially, you can implement dot3 (normal) bump mapping either by using a fragment/vertex shader or by using the Texture.ACF_DOT3_RGB combine mode on your normal map texture? Does the TestFragmentProgramState demo class demonstrate dot3 bump mapping with the fragment/vertex shaders or is it some other form of bump mapping?

yeah that's correct, you can implement that in shaders too. what's good about using fixed pipeline is that the stuff works on older cards…

the technique in testfragmentprogramstate is called parallax mapping

Mr.Coder thanks so much for the helpful insight  :slight_smile:



What other "fixed pipeline" techniques can be used in jME? Is there some kind of a rule that determines whether a techniques is fixed pipeline or not?



Also, is there more than one way to implement, for instance, "parallax" bump mapping? I would imagine there could be a code repository of the best implementations for parallax, displacement, relief texture, etc. bump mapping, could there not? Or is the implementation of these shaders really dependent on the game's requirements?



I find this flexibility of jME quite interesting. In my 3D coding experience, I've used Java3D for about a year, and jPCT for the past 2 years. So I've never really had the option/need of digging this deep into the rendering pipeline. This is why I don't know hardly anything about this process. Is custom shaders a game industry standard today? And maybe normal bump mapping (dot3) is a thing of the past? Unless of course, as you said, I need to support older (< GL 2.0 ???) graphics cards.



Hummm, sorry for asking so many questions in one post!  ://

I’m probably going to be wrong about all of this, but if I am someone smart will come along and correct me  :stuck_out_tongue:



Anything you do that isn’t in a shader is using the fixed pipeline (i.e. All the standard OpenGL calls).  Also I think if you are using newer cards the ‘fixed pipeline’ doesn’t actually exist at all anymore as any standard GL calls emulated by shaders in the dark.



Shaders seem to be here to stay thats for sure, and dot3 is a thing of the past (8, 9 years old?).



http://en.wikipedia.org/wiki/Shader

I'm trying to understand why the shader API exists. Why wouldn't the parallax, or displacement bump mapping be implemented through the fixed pipeline like dot3. This is why I asked the question:

Quote:
is there more than one way to implement, for instance, "parallax" bump mapping?
If these shading techniques are a standard then why aren't they in some kind of lib?

well that's exactly why the shader system came into existance. so that instead of waiting for a next version of opengl and driver updates from nvidia or ati, you can implement new "fixed function operations" yourself :wink:

a stupid question here:

why is testbumpmap using a normal map instead of a height map?

Ummm doesn't bump mapping use a normal map to construct the 'pseudo' heights?



Is it possible to also bump map with a height map?  And would it still be bump mapping (or rather height mapping ;))?

huh? test bumpmapping is using dot3 normal mapping which requires a normal map not a height map…

With a shader you can change how the video card operates, just like you can write code to make your computer do stuff. This ability gives developers nearly unlimited power over the video card, many effects are possible to do using shaders that are awkward or completely impossible to implement using the fixed pipeline. I believe all modern video cards support shaders, even the onboard ones. Using shaders is the thing now, fixed pipeline is a thing of the past, of course if you want to support old machines this way of thinking isn't for you.



Bump mapping uses a normal map to make the surface appear to have more detail, parallax mapping uses a bump/height map in addition to a normal map to increase the illusion by making the surface appear "3D", relief mapping adds self shadowing to the illusionary 3D surface, but it requires a much better video card than ones required by parallax/bump mapping since it does ray tracing on the video card.

i think the precise definition of parallax mapping is that it makes the surface bump reacts to the viewing angle so a more realistic bump effect is achieved.

i always thought you do bumpmapping with a bump map and normal mapping with a normal map, not bump mapping with a normal map.

the testfragmentprogramstate uses a bump/heightmap for the bumps.

bumpmapping = normalmapping

Different ways to name the same thing. You can easily generate a normalmap from a bumpmap, I guess it is called bumpmapping because it makes the surface appear to have bumps…

I thought a normal map was just an extension of a bump map.



Isn't a bump map a grayscale gradient of the geometry height while a normal map is a RGB texture of the geometries normal angles?

A Normal "only" descripes apoint in a relativ way, while a bump describes a clear structure.



For The Effect, like Per Pixel Lightning, the angle is completly enough, and looks realy beautiful. But for Real describing of a Structur, like ParralexMapping You need the Height.



Perhaps BumpMapping also calculates the Pixel with the LightAngle. So the height wouldn't matter. That would meen, Bump- and Normal-Mapping is realy the same, only with the difference that in NormalMapping every Pixel is calculated for its own.

HamsterofDeath said:

i always thought you do bumpmapping with a bump map and normal mapping with a normal map, not bump mapping with a normal map.
the testfragmentprogramstate uses a bump/heightmap for the bumps.


i think bump mapping is a more general term where normal mapping is one of the bump mapping techniques. parallax mapping is also one of the bump mapping techniques.

In my experience parallax mapping is only useful for mostly planar surfaces, which tend to lack detail to actually represent anything. One time parallax mapping caused parts of my model which had very thin UV coords to shimmer noise. Anyway, you should try the techniques and simply see what works for you.