• Render Target Displacing View Model
    0 replies, posted
I am working on making an entity that has a render target screen that is linked to another entity acting as a camera. I have the actual screen rendering working and the tracking of the camera entities view. The issue I am experiencing is that when I actually look at the render target my view model disappears and when I enter the view of the rt it appears displaced to the top left of my screen. When I phys gun the actual entity I am rendering the screen on the render fills my screen. I am stumped on this one and am not sure what's causing the issue. Here are examples of what I am talking about View Model disappearing Render taking up whole screen Here is my code I am using. local CamData = {} CamData.x = 0 CamData.y = 0 CamData.w = 512 CamData.h = 512function ENT:Draw() local ent = self:GetNWEntity("cam") self:DrawModel() if !IsValid(ent) then return end CamData.angles = ent:GetAngles() CamData.origin = ent:GetPos() old = render.GetRenderTarget( ) self.rtmat:SetTexture("$basetexture", self.RT) render.SetRenderTarget(self.RT) render.ClearDepth() render.RenderView( CamData ) render.SetRenderTarget( old ) cam.Start3D2D(self:GetPos(), self:GetAngles(), 0.2) surface.SetDrawColor(255,255,255,100) surface.SetMaterial(self.rtmat) surface.DrawTexturedRect(-w/2,-h/2,w,h) cam.End3D2D() end
Sorry, you need to Log In to post a reply to this thread.