Pixel Shader Of Spotlight

Started by
2 comments, last by Dawoodoz 13 years, 6 months ago
I am trying to make a spotlight for a racing car, and i am not doing a good job at it.


The problem is that my ground plane is a 4000 x 5000 meter plane of just 4 vertices, when my spotlight is lit, since the vertex is at the corners, the area from the spotlight position till the end gets lit up.

The problem is also present in while using Vertex based fog.

Please help in solving this issue.

[Edited by - duskndreamz on September 27, 2010 1:40:38 AM]
Advertisement
This isn't a bug so theres no "fix".

Your mesh either needs to be tesselated very finely so you have lots of vertices inside your spotlight cone, or you need to do the lighting in the pixelshader.

There are examples (with source) for how to write a pixelshader light in the DX docs or you can doutbless find them in the developer areas of all the main graphics card peoples' websites.
------------------------------Great Little War Game
I believe no one still uses vertex lighting... You must start pixel lighting....
It lags like hell (50 FPS) but you can make per pixel raytraced fog. Calculate the amount of fog using the length of the pixel's position in camera space and calculate the fog's brightness by sampling many points from the camera to the point on the surface. This can be used with cascaded depth shadows.

This topic is closed to new replies.

Advertisement