Jump to content

How to make skydome dynamically transparent?


Tomas
 Share

Recommended Posts

Script.a=0
Script.mtl=NULL
Script.srf=NULL

function Script:Start()
	self.srf = self.entity:GetSurface(0);
	self.mtl=self.srf:GetMaterial()
end



function Script:UpdateWorld()
	self.mtl:SetColor(255,255,255,self.a)
	self.a=self.a+0.001	
end

That's the lua skydome code I have so far.

It goes from transparent to solid, but theres no texture, just color. If I remove "SetClolor()" the texture is back to place. Any ideas?

 

 

Link to comment
Share on other sites

Finally sorted this out myself. That's the code now:

Script.a=0
Script.mtl=NULL
Script.srf=NULL
Script.col=Vec4()
function Script:Start()
	self.srf = self.entity:GetSurface(0);
	self.mtl=self.srf:GetMaterial()
end



function Script:UpdateWorld()
	self.col=self.mtl:GetColor()
	self.col.r = self.col.r
	self.col.g = self.col.g
	self.col.b = self.col.b
	self.col.a = self.col.a-self.a
	self.mtl:SetColor(self.col)
	self.a=self.a+0.0001	
end

 

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...