Jump to content
  • Advertisement
Sign in to follow this  

Area light set up

This topic is 3168 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

Hi everyone As i know, DirectX have the D3DLIGHTTYPE which can help you to set up the Point light, Directional Light, Spot Light. However, i want to set up an Area Light. For example i have a rectangular with the coordinate {(x1,y1,z1),(x2,y2,z2),(x3,y3,z3),(x4,y4,z4)}. I want to use this rectangular as the light source in my scene. How can i do that?? Thanks for your help. P/s: Some example code will be better :D

Share this post

Link to post
Share on other sites
The fixed function pipeline only supports those kinds of lights, however you can emulate other kinds of lights via projective texture mapping.

Alternatively, if you use shaders you can implement any kind of light that you want.

Share this post

Link to post
Share on other sites
Area lights are quite computationally heavy. Especially if you want them also to cast proper shadows.

While a point light is just one light source, area lights will probably have to be implemented as many individual (close to each other) lights. The number would ideally be infinite, but replacing the area with a matrix of "lights" will do the job, too.

Do you really need them?

Do you need to simulate the proper shading caused by area lights or do you just want soft shadows?
- If the former and you want to use the fixed pipeline, you can try placing point lights over the rectangle, start with a lower number (maybe 5, one in each corner and one in the middle) and if the result is not good enough (won't be if the rectangle is large in comparison with the scene) add more. Don't forget that there is a limit on the number of lights the fixed pipeline can use.
- If the later, there are methods of rendering soft shadows with standard light sources (of course not physically accurate).

Share this post

Link to post
Share on other sites
Thanks for your quick reply.

Actually i have to implement the "Real-time,All frequency shadows in Dynamics Scenes"

Here is the link of this paper

This paper is the soft version of Convolution Shadow Maps (CSM). I have implemented the Convolution Shadow Maps. Now i have to implement this.

And yes, i must use Are light, not "as many individual lights". So i need to know how to set up Area Light.

I went around and come with this:

+ Create a object with a mesh
+ Define the Object light properties like this

struct Light
float3 positionWS;
float3 directionWS;

float3 positionVS;
float3 directionVS;

float4 Ke;
float4 Ka;
float4 Kd;
float4 Ks;

float4 lightColor;
float4 globalAmbient;

float shininess;
float cosineTheta;
float lightAttenuationBegin; // 10.0
float lightAttenuationEnd; // 20.0

Is this correct??

Share this post

Link to post
Share on other sites
It seems in the article they consider only the shadows, not how area lights affect lighting (shading) of the geometry.
You'll have to try to understand and reproduce the method of shadow rendering they described there. The way how you decribe the area light in your code (your last post) is, IMHO, the least important problem here ;)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!