Jump to content
Posted 04 May 2012 - 11:15 PM
Posted 05 May 2012 - 12:45 AM
Posted 05 May 2012 - 03:03 AM
I am not sure what I should be using to do this, but I have a star in space, and want it to be the source of light for all the planets and such. Do I want to use a point light for this? Or is there some better way? I am guessing directional isn't what I want due to the star should emit in all directions...
Problem is I would also like the sides of the planets that aren't facing the sun to be somewhat light so the player can see them easier....
Posted 05 May 2012 - 09:28 AM
Posted 05 May 2012 - 08:44 PM
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
Posted 06 May 2012 - 04:29 AM
Posted 08 May 2012 - 09:16 AM
const float3 sunPosition //sun position, I've used a constant here because I assume it doesn't move. float3 position //untransformed position at that point float3 lightDirection = normalize(position - sunPosition); //gets the direction the light will be travelling towards your object from the sun - push this to the pixel shader to get per-pixel light directions for each rendered pixel, then simply run the standard direction light code.
Edited by NickUdell, 08 May 2012 - 09:24 AM.