Color format not working?

Started by
11 comments, last by DesignerX 18 years, 6 months ago
Quote:Original post by MrDoomMaster
Quote:Original post by Source
Well, take into account that fixed-function (per-vertex) lighting will only work on the vertexes, so scanning a point-light across a long line will have no effect whatsoever on the line centre.

If you set the normals up correctly then there is no real reason why lighting should fail on line primitives. If all of the line point normals are in the opposite direction to your light direction (ie [1,1,1]) then they will always be lit - unless they fall outside of the light's range.

Also remember that [1,1,1] is not actually normalised - so this may give strange results.

To get proper lighting on a line you will probably have to resort to using a fragment shader to achieve simple per-pixel lighting.


Well I have never heard of fragment shaders, so if you could point me to a tutorial or something I would really appreciate it. Thank you very much for your help!

I'm not 100% sure of the details, but "fragment shaders" are OpenGL's equivalent of Direct3D's "Pixel Shaders". Check out Pixel Shader Basics in the documentation if you've not come across them yet [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Advertisement
Yes I'm sorry i've been doing some cross-API work recently, so I just tend to refer to all per-pixel programs as fragment programs/shaders - Direct3D calls them pixel shaders, though i'm sure using them for the results you probably want is overkill - especially if you've never used them before.
Quote:
Also, I've been wanting my lines to work with lighting enabled. This way, if I
scan a point light across my lines, only the part of the line receiving light will emit. My grid is along the X-Z plane, and my directional light source is pointing at (-1, -1, -1). Any advice?


Do you want the grid always to be lit , no matter whats the light status is ?
Cause if so, you can turn off light before rendering the grid, and then enable it exactly after. (though, I don't know if disabling and enabling light slows things or not)
There is nothing that can't be solved. Just people that can't solve it. :)

This topic is closed to new replies.

Advertisement