PDA

View Full Version : DOT3 Bump (Normal)Mapping Example


isgoed
2005.04.10, 02:09 PM
Hi all i ported a normal mapping example from a pc demo. It is on my website + source code. It uses GL extensions ARB_texture_env_dot3, ARB_multitexture, ARB_texture_cube_map and ARB_texture_env_combine. I never used any of this before and don't have the faintest idea what they do. I just ported it, so don't ask me for advise.

I have problems with my website so i post two links (one with www and one without)

http://revaro.net/developer/images/SimpleBump.jpg
http://www.revaro.net/developer/images/SimpleBump.jpg

Source code and app:

http://revaro.net/developer/SimpleBump.zip
http://www.revaro.net/developer/SimpleBump.zip

To be complete I also add the text of the readme (since I am not the official author of the code)

Simple bump ReadMe:

A mac port of the simple bump example by Steven Verstoep. (10 april 2005)

Credits:
(+ source code simplebump.zip )
http://www.paulsprojects.net/tutorials/simplebump/simplebump.html

All the important OpenGL code is in BumpMapping.c. There you will also find some usefull links to some webpages.

This program is build and works correctly on a Powerbook 550Mhz. (Ati Rage M6 16mb video (I believe that, that is a Radeon 7000)).

It requires OpenGL extensions. I know nothing about it. I just used the same code as in the tutorial by Paul.

Known Issues:
the depth buffer is not initialised. (I should probably call my OpenGL init function with some request for an depth buffer)

This program can only launch if your desktop resolution is 32 bit.

Lighting does not work. (If you render the torus without a bump map nothing appears). Probably some matrix that is not properly initialised. Note that for bump map lighting you do the light calculations yourself so OpenGL does not do it for you.

There is no Specular lighting on a bump map. (This requires an additional texture pas. This is my first app that uses GL extensions so I have no idea how to do that. I have doubts about it being possible since specular lightning requires an exponential calculation)

Required OpenGL extensions:

/* Required extensions:
ARB_multitexture
ARB_texture_cube_map
ARB_texture_env_combine
ARB_texture_env_dot3
*/

Steven Verstoep
Revaro Software
www.revaro.net

It works on a redeon 7000 ! :)

Still I have some requests:

Can Anyone Add code for Spectacular lighting? That would be real sweet.
I have a lot of regular textures which I would like to have bump mapped. Is there any tool that has an algorithm for generating bump maps from a 2D texture? Note that converting it to grey values and using a height map to normal map converter doesn't work. A topdown view of a pyramid for example would in a height map just be 4 triangle planes of the same height. What you want is sloped plains with the brightest point in the center. Also such a tool needs to be able to ignore decals and surfacecolors. I know this is a pretty impossible task. The human eye can make up a 3D representation of a 2D image, but for a computer algorithm it is pretty complicated.

arekkusu
2005.04.10, 04:59 PM
a. Specular lighting.

b. analysis of 2D images to extract depth information is cutting edge research (http://www.tomshardware.com/hardnews/20050315_203333.html). I don't know of any simple tool to do it.

Tobi
2005.04.10, 06:16 PM
Works very nice in 32-bit. Crashes when monitor is set to 16-bit but tells you why it crashed so it's not too bad. Getting a bump-map from existing 2D textures isn't possible for most images. You'll have to use 3D models and render them three times with one light source placed on top, front and the side and save each grayscale image into the RGB channels of the normal texture.

hangt5
2005.04.10, 09:10 PM
This might help you out: http://members.shaw.ca/jimht03/normal.html

Danlab
2005.04.10, 10:27 PM
really nice demo

isgoed
2005.04.11, 04:09 AM
This might help you out: http://members.shaw.ca/jimht03/normal.htmlYeah, those tutorials require me to have 3D geometrical data. I haven't seen any tutorial that takes a 2D texture as a base starting point. My best bet is just to make greyscale images of the textures I have and use those as height maps which I can use to generate normal maps. For textures for which this is not possible I must manually create them in a paint program or recrete the geometry in a 3D program and then render it as a normal map.