I've currently setup a method to look at two objects to see if they share any vertices (like two wall segments touching) and if so, take the normals at those vertices and add them together to smooth out the seam where they touch. This is like a bumpy cave wall, and I believe I've reached the desired affect.

What I'm not sure on is if I should be normalizing the normal values after adding them together. When reading the documentation on glNormal(), which I'm not using, it states that, "[n]ormals specified with glNormal need not have unit length. If GL_NORMALIZE is enabled, then normals of any length specified with glNormal are normalized after transformation."

It appears that enabling GL_NORMALIZE does have a positive affect on my results. Just to show what I mean, here's some screens:

So I guess the end of all this... is the question of how much overhead I'm looking at with GL_NORMALIZE enabled? I can easily (as soon as I figure what the fixed point math will look like, I'm not using floats) perform the normalization prior to the rendering loop but would just as well move on to bigger things if I don't need to do that.

Thanks again,
Jeremiah

05-06-2010, 08:14 AM

maximus-dev

Re: Normals and Normalization

A mod should really expand the time you're allowed to edit posts...

I tried to remove the paragraph where I mention I'm not using glNormal because it wasn't very clear. I'm using glNormalPointer and the docs for glNormalPointer don't mention the affect of GL_NORMALIZE. My tests pretty much show it does have an affect so this paragraph was unnecessary to even include.

05-14-2010, 02:17 PM

dattrax

Re: Normals and Normalization

depends on your hardware.

A fixed function pipeline will probably just have a pipeline stage to do the normalization, so no cost.

If you are running 1.1 on 2.0 hardware, then normally the 1.1 implementation is just a shader program dynamically compiled in the driver for you. This will probably have a cost, at best it will be a few shader cycles.

so the answer is to benchmark, or post your platform.

05-14-2010, 08:59 PM

maximus-dev

Re: Normals and Normalization

Unfortunately, there's no hardware yet. Right now I'm just running tests on an android emulator. The bottom line, I guess, is that I've already got the code in to correct the normals and it's all done pre-rendering/game loop so I'm planning on just leaving it in and keeping GL_NORMALIZE disabled.