
spot light
Posted Sunday, 5 July, 2009 - 15:24 by Alina| Project: | The Open Toolkit library |
| Version: | 0.9.9-0 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | critical |
| Assigned: | Alina |
| Status: | closed |
Description
I want to have a light similar with a street lamp. Please help. Thanks !


Comments
#1
It's difficult to tell what the problem is without some code. What are the light parameters?
A screenshot would also help identify the cause of the issue.
One potential problem is that the lighting equations built into OpenGL need relatively well-tesselated geometry to function. For example, if the street consists of only two triangles, the whole street will be lit by the street light, as the equations are only evaluated at the triangle vertices.
#2
I attach a screen shot. I disable the textures, the light color is red and it is placed inside the lamp. I think I have to use per pixel points lights, but I don't know how.
#3
I attach a new file with the result that I want to obtain. (light only in the selected areas).
#4
Ok, the screenshot looks definitely wrong. The road receives no light from the lamp, which either means it has incorrect normals or that its tesselation is too low.
Is it possible to increase the tesselation of the road? If not, as far as I know per-pixel lighting is the only solution.
#5
Hello again ! The road and the building is built in 3D studio Max and each separate object is exported into .txt format(points, polygons, normals, texture coordinates). The road has only 2 polygons in order to have a minimum number of polygons and increase the speed. I'll try per-pixel lighting, but I have any idea how I could do this. I found this tutorial but there are few methods and variables that I can't understand. Have you know another tutorials about per-pixel lighting ? Thanks !
#6
I kinda liked typhoon lab's shading language course (5 chapters), if you are looking more for a c&p solution take a look here.
But imho you want a huge point light originating from the lamp, not a spotlight. A spotlight pointing downwards would not illuminate the tree next to the lamp.
#7
GLSL has an initial learning curve, but the results are worth it once you get it working. Plus, it can simplify OpenGL code a lot, if you code with GLSL in mind.
OpenTK comes with a simple GLSL example that could help you get started: SimpleGLSL.cs.
A quick overview:
In other words, the main change is that you have to add calls to UseProgram, ActiveTexture and Uniform to your drawing code.
#8
Closing issue after a month with no activity.