• render.SetBlend not affecting certain textures in a DModelPanel
    0 replies, posted
As the title says, I'm currently writing a modified version of a DModelPanel for a gamemode I'm working on. I want models to be able to fade in and out and I've got that working almost perfectly, but some models are giving me trouble, as their eyes aren't fading in and out. Here's an example: [img]http://puu.sh/l5irT/feae31ee1f.png[/img] What I want to know is why the eyes aren't fading in and out, and how to fix them. Here's my code snippet for drawing the model. [code] cam.Start3D( self.vCamPos, ang, self.fFOV, x, y, w, h, 5, self.FarZ ) render.SuppressEngineLighting( true ) render.ClearDepth() --Clear depth buffer so we aren't hidden behind other modelpanels. render.ResetModelLighting( self.colAmbientLight.r/255, self.colAmbientLight.g/255, self.colAmbientLight.b/255 ) render.SetLocalModelLights( self.ModelLightData ) render.SetColorModulation( self.colColor.r/255, self.colColor.g/255, self.colColor.b/255 ) render.SetBlend( self.colColor.a/255 ) --Enable stencil operations for drawing the model. This is so if the model is transparent it will not merge drawing all of the polys occupying a pixel render.SetStencilEnable(true) render.OverrideDepthEnable(true, true) --Force all models drawn to write to the depth buffer, even if they're transparent. --Determining the render bounds of the panel through parents bounds local curparent = self local previous = curparent local leftx = 0 local topy = 0 local rightx = w local bottomy = h while curparent:GetParent() != nil do curparent = curparent:GetParent() local x, y = previous:GetPos() topy = math.Max( y, topy + y ) leftx = math.Max( x, leftx + x ) bottomy = math.Min( y + previous:GetTall(), bottomy + y ) rightx = math.Min( x + previous:GetWide(), rightx + x ) previous = curparent end render.SetScissorRect( leftx, topy, rightx, bottomy, true ) self.Entity:DrawModel() self:UpdateWeapons() --Custom stuff here. Drawing the weapons within the panel if they exist. if istable(self.Entity.Weapons) and istable(self.Bones) then for k, v in ipairs(self.Entity.Weapons) do if IsValid(v) then v:DrawModel() end end end if istable(self.Entity.Models) then for k, v in ipairs(self.Entity.Models) do if IsValid(v) then v:DrawModel() end end end render.SetScissorRect( 0, 0, 0, 0, false ) render.SuppressEngineLighting( false ) render.OverrideDepthEnable(false, false) render.SetStencilEnable(false) cam.End3D() [/code]
Sorry, you need to Log In to post a reply to this thread.