🔒 Locked
EMBM Code
Advertisement
Original Post
I recently found this code on the net for doing EMBM rendering with OpenGL without the use of pixel or vertex shaders.. But it uses a few ATI specific texture combiners. I was wondering if anyone knows how to perform EMBM without using these types of extensions. Here's the code glActiveTexture(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); envMap->setCurrent(); glActiveTexture(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); baseTexture->setCurrent(); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE0_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_PRIMARY_COLOR_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_PRIMARY_COLOR_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_OUTPUT_RGB_ATIX, GL_TEXTURE0_ARB); glActiveTexture(GL_TEXTURE2_ARB); glEnable(GL_TEXTURE_2D); bumpMap->setCurrent(); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_BUMP_ENVMAP_ATI); glTexEnvi(GL_TEXTURE_ENV, GL_BUMP_TARGET_ATI, GL_TEXTURE0_ARB); static float f = 0; f += 0.001f; float rotMatrix[4]; rotMatrix[0] = 0.01f; rotMatrix[1] = 0; rotMatrix[2] = 0; rotMatrix[3] = 0.01f; glTexBumpParameterfvATI(GL_BUMP_ROT_MATRIX_ATI, (float *) &rotMatrix); glBegin(GL_QUADS); glMultiTexCoord2f(GL_TEXTURE0_ARB,0.5,0); glMultiTexCoord2f(GL_TEXTURE1_ARB,0.5f * f,0); glMultiTexCoord2f(GL_TEXTURE2_ARB,2 * f,0); glVertex3fv((GLfloat *) &v[0]); glMultiTexCoord2f(GL_TEXTURE0_ARB,1,0.5); glMultiTexCoord2f(GL_TEXTURE1_ARB,0.5f * f+1,0); glMultiTexCoord2f(GL_TEXTURE2_ARB,2 * f+2,0); glVertex3fv((GLfloat *) &v[1]); glMultiTexCoord2f(GL_TEXTURE0_ARB,0.5,1); glMultiTexCoord2f(GL_TEXTURE1_ARB,0.5f * f+1,1); glMultiTexCoord2f(GL_TEXTURE2_ARB,2 * f+2,2); glVertex3fv((GLfloat *) &v[2]); glMultiTexCoord2f(GL_TEXTURE0_ARB,0,0.5); glMultiTexCoord2f(GL_TEXTURE1_ARB,0.5f * f,1); glMultiTexCoord2f(GL_TEXTURE2_ARB,2 * f,2); glVertex3fv((GLfloat *) &v[3]); glEnd(); } Basically all the code does is render a water plane with a texture being perturbed by the bump map and it looks really cool.
You can get it trough GL_NV_texture_shader(2,3) on GF3 and 4.
Well I have a Radeon 9800. I am making a game, and I'd like to have nice water in it and still support a range of graphics cards without the use of pixel shaders.
I remember seeing a demo from ATI a long time ago for their 7500 card I think, and they had EMBM in the demo. You think they were using ATI specific extensions even back then?
I remember seeing a demo from ATI a long time ago for their 7500 card I think, and they had EMBM in the demo. You think they were using ATI specific extensions even back then?
Quote:
Original post by Ingenu
EMBM = Environnement Mapped Bump Mapping, it does dot3 and lookup in a cube map, it's not an "hack"
EMBM by itself is not a hack, but the way ATI implemented it is. Do you see a cubemap anywhere in his code. With GL_NV_texture_shader(1/2/3) you can do both, "hacked" and real verison. But it's a bit more work to do it (not directly exposed as on ATI).
Quote:
I remember seeing a demo from ATI a long time ago for their 7500 card I think, and they had EMBM in the demo. You think they were using ATI specific extensions even back then?
If the demo was running in front the OpenGL API, then yes.
Quote:
EMBM = Environnement Mapped Bump Mapping, it does dot3 and lookup in a cube map, it's not an "hack", Emboss Bump Mapping or UV Bump Mapping are hacks.
The meaning of EMBM as exposed by this extension is the meaning of DX6's BumpEnv. And this is a real hack. There is very little physical coherency in this model. Mark Kilgard demonstrated it in a paper discussing bump-mapping techniques. Even emboss bump mapping is a "better" (read as : "more realistic", physically speaking) model.
Not really. The DOT3 capability itself is not enough. You also need texture-dependant read capability.
For instance, GeForce and GeForce2 can perform dot products but can't perform texture-dependant reads, so these graphics cards can't render EMBM.
Through vendor-specific extension, you can perform such lookups on a GeForce3 and up (not GeForce4MX though) thanks to the the aforementioned NV_texture_shader extensions, and on the ATi side you can use ATI_fragment_shader for Radeon8500 and up. And for GeForceFX (and up) and Radeon9500 (and up) you can use the ARB_fragment_shader extension (sometimes referred as 'pixel shaders').
For instance, GeForce and GeForce2 can perform dot products but can't perform texture-dependant reads, so these graphics cards can't render EMBM.
Through vendor-specific extension, you can perform such lookups on a GeForce3 and up (not GeForce4MX though) thanks to the the aforementioned NV_texture_shader extensions, and on the ATi side you can use ATI_fragment_shader for Radeon8500 and up. And for GeForceFX (and up) and Radeon9500 (and up) you can use the ARB_fragment_shader extension (sometimes referred as 'pixel shaders').
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement