• render.RenderView doesn't work on cam.Start3D2D
    10 replies, posted
Hello all, I hope someone will be able to answer me. So I made a cam.Start3D2D to create a screen on a security cam screen model. The cam.Start3D2D pos/angles/scale is ok. But render.RenderView won't render in this cam.Start3D2D it alway renders in my HUD with removing my first person models ! Here is my code : [code] //Function called like ENT:Draw() function ENT:CustomDraw() local ent = Entity(self:GetNWInt("BoundCam")) local pos = self:LocalToWorld(Vector(6.6, -5.4, 4.9)) local ang = self:GetAngles() ang:RotateAroundAxis(ang:Forward(), 90) ang:RotateAroundAxis(ang:Right(), 270) cam.Start3D2D(pos, ang, 0.1) if (IsValid(ent)) then local CamData = {} CamData.angles = ent:GetAngles() CamData.origin = ent:GetPos() CamData.x = 0 CamData.y = 0 CamData.w = 90 CamData.h = 90 render.RenderView(CamData) else draw.RoundedBox(8, 0, 0, 90, 90, Color(255, 255, 255)) end cam.End3D2D() end [/code] [editline]19th March 2015[/editline] Nobody ? So nobody has used the RenderView before me ?
Anyone ? I really need that for my gamemode...
Still nobody ?! [editline]20th March 2015[/editline] Why are you ignoring my post ! I saw another post which is the same problem !! And you have never solved the problem. So I re ask you again : Why do you just ignore this topic ?????!!!!!
[QUOTE=Yuri6037;47360461]Still nobody ?! [editline]20th March 2015[/editline] Why are you ignoring my post ! I saw another post which is the same problem !! And you have never solved the problem. So I re ask you again : Why do you just ignore this topic ?????!!!!![/QUOTE] Because, We don't know the solution, not everyone can solve all problems here. TIP: Research and test.
I already searched and even tested but all I can get is render.RenderView function ignored, hl2.exe has stopped working, all view models deleted, and render.RenderView not changing anything with game laggy at 5 FPS !!!!
I managed to make part of this function working however it's TERRIBLY laggy !! Normaly I have arround 90~100 FPS. Using render.RenderView working version it drops directly to 60~50 FPS. Spawn 3 of these entities and enjoy your 20~30 FPS !!! Players are however invisible, only the Physgun glowing effect is visible on the cam. Here is the new code I managed to get : [code] function ENT:Initialize() self.Texture = GetRenderTarget("realistic_cam_" .. self:EntIndex(), 128, 128, false) self.Mat = CreateMaterial("realistic_cam_mat_" .. self:EntIndex(), "UnlitGeneric", {["$basetexture"] = self.Texture:GetName()}) end hook.Add("HUDPaint", "RenderViewTest", function() for k, v in pairs(ents.FindByClass("realistic_camera_screen")) do if (v:GetPos():Distance(LocalPlayer():GetPos()) > 100) then continue end local ent = Entity(v:GetNWInt("BoundCam")) if (IsValid(ent)) then local cur = render.GetRenderTarget() local CamData = {} CamData.angles = ent:GetAngles() CamData.origin = ent:LocalToWorld(Vector(10, 0, 0)) CamData.x = 0 CamData.y = 0 CamData.w = 128 CamData.h = 128 render.SetRenderTarget(v.Texture) render.RenderView(CamData) render.SetRenderTarget(cur) end end end) function ENT:CustomDraw() local ent = Entity(self:GetNWInt("BoundCam")) local pos = self:LocalToWorld(Vector(6.6, -5.4, 4.9)) local ang = self:GetAngles() ang:RotateAroundAxis(ang:Forward(), 90) ang:RotateAroundAxis(ang:Right(), 270) cam.Start3D2D(pos, ang, 0.1) if (IsValid(ent)) then draw.RoundedBox(8, 0, 0, 90, 90, Color(255, 255, 255)) surface.SetMaterial(self.Mat) surface.DrawTexturedRect(0, 0, 90, 90) draw.DrawText("Cam #" .. ent:EntIndex(), "DermaDefault", 90, 80, Color(0, 0, 0), TEXT_ALIGN_RIGHT) else draw.RoundedBox(8, 0, 0, 90, 90, Color(255, 255, 255)) end cam.End3D2D() end [/code]
Well it is rendering everything again so what do you expect?
I don't know but on the CAP (CarterAddonPack), this was eating really no fps... You know the kino screen, it does not eat any fps... I tried to see their codes, but I can't find where they're rendering the kino screens...
[QUOTE=Yuri6037;47366648]I don't know but on the CAP (CarterAddonPack), this was eating really no fps... You know the kino screen, it does not eat any fps... I tried to see their codes, but I can't find where they're rendering the kino screens...[/QUOTE] As far as I know they aren't rendering that themselves, they're just using default rendertarget texture for screen and [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Global/UpdateRenderTarget"]Global.UpdateRenderTarget[/URL].
[QUOTE=mijyuoon;47367040]As far as I know they aren't rendering that themselves, they're just using default rendertarget texture for screen and [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Global/UpdateRenderTarget"]Global.UpdateRenderTarget[/URL].[/QUOTE] I just saw that. I advanced a bit with render.RenderView. I found a way to icrease a bit my FPS, instead of unplayable it's playable but still laggy. Indead, as strange as it seams, increasing texture size from 128x128 to 512x512 and by capturing on GM:PostRender, it brings me 5~10 FPS, which makes the game playable. However, now instead of not rendering player models it renders them but screwed up and in my HUD not in the rendertarget texture...
So after some more tests, it seams that the player model screwed up problem is only appearing when you're watching yourself through a screen...
Sorry, you need to Log In to post a reply to this thread.