Phong Bump Mapping in ARB_vertex_program. Is it possible?

Hello! I am almost finish my 3D Engine. But there is a problem…
I use always ARB_fragment_program.
THis means that only people with Radeon9500+ and FX5600 could run the engine.
I has thinking to add support for Radeon 8500+ and GeForce3+ hardware.
Is it possible to make a Phong Bump mapping Shader in a ARB_vertex_program only?
ARB_vertex_program does not support “TEX” instruction.
How I can do that? is it possible?
thanks in advance

vertex programs cannot influence the way a fragment is calculated, all you can change is the vertex’s properties, such as position, color and texcoord.

with the vertex program you normally would calculate lightvector and the halfangle vector in texture space, then pass those out as texture coords.

you would then use cubemaps to actually get the normalized directions of those vectors. Using cubemaps you could use regular ARB_texture_env_combine, ARB_texture_env_dot3 to get a result, however the specular part might be tricky to do with regular ARB combiners

Or you use vendor specifc extensions, such as Nvidia’s register combiners/texture shaders
and ATI’s ATI_text_fragment_shader
however then your effect would only run on those vendor’s cards.
not sure if there is much more options… since there is no real pixelshader 1.x ARB equivalent

too much work for nothing… nevermind… i am not gonna add support for older cards. And If I did they gonna get 10-20fps… :stuck_out_tongue:

For video card like Radeon 8500 or Geforce 3/4, by using normalization cube maps and texture look up for specular, you can achieve a phong bump mapping with no problems … with DirectX Pixel Shader 1.4 in one pass (doing is Pixel Shader 1.1 is possible but requires more than 1 pass))
It’s not a ‘super’ quality but considered the hardware it’s a performance (thanks also to the HLSL compiler that is very handy because writing PS1.4 shader is not a easy task sometime).

But doing the same code in OpenGL requires some skills.

First you need to do an nVidia and an ATI version (as said previous post).

For nVidia cards, you can have a look at Cg that can even convert DirectX Graphics pixel shader into register combiners.

Register combiners is painful to use and ATI_text_fragment_shader is only supported on MacOS and is not very well documented.

I looked into source of the XEngine http://xengine.sourceforge.net

and it does use ati_text_fragment_shader functionality on regula ati_fragment_shader, the engine is supposed to work on windows and linux. And the “special” about it is that it supports older ATI’s pixel shaders when using Cg, by converting them to DirectX pixel shaders, and then back to Ati fragment shader

So it seems that we get ATI_text_fragment on win/linux too ?

According Delphi3D It’s not supported on Windows.
And according OpenGL Extensions Viewer GL_ATI_text_fragment_shader is only supported on MacOS X (on ATI 9600 and ATI 9800).
However, I don’t know if Linux supports it.

Also for Cg, I know that it can converts DX pixel shader, but PS1.4 is not supported.