   Lighting
  Hi all,I have a question about lighting, I have walls defined in my 3D application as two triangles as normal. When I apply lighting to these planes the light shines on the triangle and it becomes clear that the wall is made up of just two triangles. I saw a sample on the internet that uses alot more polgyons to approximate the light better (point light) so that the light casts a round shape on the wall.I wanted to know if this is the only way to get better looking lighting, I hope I have exaplined myself, thanks in advance.   
  The classic way to solve this would be to use per-pixel lighting.   ;  What you are looking for is probably per-pixel lighting. This computes lighting on a per pixel (actually per texel) basis, which means the number of polygons describing a flat wall will not matter.You probably want to look into basic pixel shaders.   ;  Could you recommend some good tutorials on per-pixel lighting for this case? I am looking to create it in directx10, how could you go about implementing lighting so that its regardless of complexity of the geometry? Thanks guys.   ;Quote:Original post by MaddiusCould you recommend some good tutorials on per-pixel lighting for this case? I am looking to create it in directx10, how could you go about implementing lighting so that its regardless of complexity of the geometry? Thanks guys.IMHO what are you searching is normal mapping in tangent space. Using a low poly count mesh and a normal texture generated from an high poly count to increase the details on a low level mesh.http://www.bencloward.com/tutorials_normal_maps1.shtmlthis tutorial is quite old, but it is fairly good at explaining the reasoning behind normal mapping and its usage.If you just need some lightning tutorial go here :http://xna-uk.net/blogs/randomchaos/archive/2008/11/24/basic-hlsl-lighting-techniques-episode-3-colour-glow-bump-and-reflective-texture-maps.aspx;  That seems like the bump mapping effect, I have done that it increases the detail on the actual texture relative to the light. But Im talking about the light shape being cast on the wall.For instance if you used a point light and shone it on the wall when its made up for just two triangles the wall will either be fully lit or one of the triangles will be lit which looks decidedly poor. What im trying to get at is, that I saw a program that used lots more polgons on the wall (even though its totally flat) to approximate the shape of the light better so it appears as a round shape.Now I have been told that this can also be done through the pixel shader, and I want to know what stages you must go through to approximate the light over the wall surface. Not to add detail to the surface itself but the way the light appears on the surface. Hope you get what I mean now.   ;  I think I have clicked what is going on. So after the vertex shader has completed a pixel shader will interpolate the data between the verticies essentially shading each pixel? So if you apply lighting in the pixel shader the lighting will be per pixel across the geometry giving the impress of high detail? Is that right?If so then this is solved, thanks all.   ;  As they say, you need to move the light calculations from the vertex shader to the pixel shader.You can compare the 2 samples from the directx sdk : BasicHLSL uses per vertex lighting, and ShadowMap uses per pixel, though it's more complicated with shadowing.Or you can look at the sample here. In the attached file (PerPixelLighting.zip) you'll find 2 fx files : VertexLighting.fx with the light computations in the VS, and PerPixelLighting. I've just found them now and haven't read it, but that's probably more helpful.edit: yes you're right, I'm a bit late   ;Quote:Original post by KOzymandiasAs they say, you need to move the light calculations from the vertex shader to the pixel shader.You can compare the 2 samples from the directx sdk : BasicHLSL uses per vertex lighting, and ShadowMap uses per pixel, though it's more complicated with shadowing.Or you can look at the sample here. In the attached file (PerPixelLighting.zip) you'll find 2 fx files : VertexLighting.fx with the light computations in the VS, and PerPixelLighting. I've just found them now and haven't read it, but that's probably more helpful.edit: yes you're right, I'm a bit lateThanks anyway mate.   