Jump to content

Recommended Posts

Posted

I'm just taking a look at Shadmar's Day Night code to recreate it in my C++ project and trying to make sense of this this line, but can't work out where the .k is coming from? I can see where all the others are though

 

 

self.dir = Vec3(light.mat.k.x,light.mat.k.y,light.mat.k.z):Normalize()

 

 

 

 

 

 

Script.DaySpeedXYZ=Vec3(0.1,0.0,0.0)--Vec3
Script.FollowCamera=true--bool
Script.mieDirectionalG=0.8--float
Script.mieCoefficient=0.02--float
Script.turbidity=4.0--float
Script.reileighCoeff=3.0--float
Script.luminance=0.7--float
Script.yoffset=200.0--float
Script.bloomadjust=1.0--float
Script.cloudspeed=0.08--float
Script.cloudcover=0.6--float
Script.cloudthickness=1.0--float
Script.cloudheight=0.08--float
Script.cloudscale=0.05--float
Script.cloudmix=1.0--float
Script.cloudcolor=Vec3(.7,.7,.7)--Vec3
Script.bloomvalues=Vec3(0.11,0.158,0.298)
function Script:Start()
self.mat=Material:Load("Materials/DayNight/daynight.mat")
self.shader=self.mat:GetShader()
self.world=World:GetCurrent()
--load fog shader so we can color the fog.
--self.fog=Shader:Load("Shaders/PostEffects/EffectClass/_klepto_fog.shader")
end
function Script:UpdateWorld()
--Day cycle
self.entity:Turn(self.DaySpeedXYZ.x*Time:GetSpeed(),self.DaySpeedXYZ.y*Time:GetSpeed(),self.DaySpeedXYZ.z*Time:GetSpeed())
--Get Sun vector
light=self.entity
self.dir = Vec3(light.mat.k.x,light.mat.k.y,light.mat.k.z):Normalize()
--Send sun vector to shader
self.shader:SetVec3("sunPos",Vec3(-self.dir.x,-self.dir.y,-self.dir.z))

 

 

Cheers

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...