5 registered members (AndrewAMD, ozgur, Ayumi, 2 invisible),
690
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Questions about lights in shaders
#286694
08/26/09 15:44
08/26/09 15:44
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
OP
Serious User
|
OP
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
hello conitec,
currently I have some problems with getting different types of lights work properly in my shader and hope you have some answers to it.
The first problem is, that I can't separate between the different kinds of lights, so I have no Idea how to execute different code for directional, point- and spotlights. Currently I just treat everything as a pointlight.
The second thing is about the sun in combination with pointlights. If I treat the sun as a biiig pointlight (which is the default, because it's in the vecLightPos array) it's deactivated when the model is in the range of too many other lights, because it has the biggest distance. It looks really strange if the sunlight suddenly disappears. Maybe that could be fixed by making the sun the first light in the list.
I thought also about using vecSunDir and calculate it as a real directional light, but then you calculate the sunlight twice, because the sun position is still in the list of lights, which is of course not acceptable.
So, till now I didn't found a satisfying solution to this problem and hope, you can clear things up a little Scorpion
|
|
|
Re: Questions about lights in shaders
[Re: Scorpion]
#286699
08/26/09 16:13
08/26/09 16:13
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Im still new at shaders, but as for using VecSunDir, I think it may be possible.
I dont know about the programming side of it, but from a concept point of view, couldnt you process VecSunDir first, and then process all the VecLight's next. But only process the VecLight if(VecLightPos[x]!=VecSunPos). That way the sun will only be processed once, whether it is in the VecLight list or not. I have no idea on the efficiency of this concept though.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|