Sign in to follow this  

Pixel Shader Of Spotlight

This topic is 2634 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2634 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this