View Full Version : cg lighting shader
12-05-2004, 06:13 AM
i have a cg shader that does a simple lighting, and the geometry i need to "lighten up" is a display list.
The geometry lighting is correctly displayed, but the object has no textures.
Perhaps, when generating the display list, i have to bind textures using the ARB extension instead of a simple glBindTexture function ?
12-06-2004, 04:51 PM
That shouldn't matter.
Are you using a fragment program? If so, you have to declare your texture sampler, use a texture read instruction, and multiply with the light contribution yourself. Don't forget to set the uniform for the texture sampler to the index of the texture unit that contains the texture image you want, either.
12-11-2004, 04:59 AM
Yes i'm using a fragment program. However, what are the benefits of using a lighting shader instead of conventional lighting ?
Speed, quality or else ?
12-11-2004, 07:51 AM
If you're using a shader, the "regular lighting" will be disabled, and the shader HAS to do it. It's in the spec. It's one of the bits of the pipe that's subsumed by adding a shader. Similarly, you HAVE to do texturing. It's another bit that's subsumed. Thus, if your shader doesn't calculate light and texture data, then your object won't be rendered with lighting and texturing.
The advantage of using shaders is that you have better control over the lighting model and equation, and you can do things like per-pixel normal-mapped Phong, or spherical harmonics-based radiance transfer, or some other scheme you dream up. "better" or "different" really is in the eye of the beholder :-)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.