• BUG while displaying Sprites after using render.RenderView()
    5 replies, posted
Hello everyone, I designed mirrors for vehicles in GMod. They use the function [I]render.RenderView()[/I] to render the mirror view and to capture it into a texture. But once I used this function, sprites disappear or sometimes appear while they should not, during the current frame. This bug affects [I]env_sprite[/I] entities as well as sprites created with [I]render.DrawSprite()[/I]. I believe (but I am not sure) that [I]render.RenderView()[/I] alters the internal engine function used by [I]util.PixelVisible()[/I], also causing [I]env_sprite[/I]s not to appear correctly. Here are sources so you can see by yourself: - For the mirrors, the ones included in my truck: [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=264862065"]MomoCars Truck Nuke for TTT, RP, Sandbox! (driveable)[/URL] - The mirrors manual: [URL="http://gmod-games.thouvest.dyndns.info/developpers/vehicle_mirror.php"]Working mirrors for vehicles in Garry's Mod[/URL] - For Lua sprites, simply use GMod lights in Sandbox - For [I]env_sprite[/I] sprites, you can use this map: [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=253540088"]RP_ChristmasTown Official[/URL] Note: the sprites blink because of the FPS limiter of the mirrors, because they only disappear when the mirror content is rendered. Note 2: the sprites do not appear in the mirrors neither. Screenshot: [IMG]https://www.dropbox.com/s/hu47youl0hxumy2/Truck_Nuke_Sprites_Bug.gif?dl=1[/IMG] Thanks for your helpful advices! Momo.
I'd like some info on this as well. I made a simple overhead mini-map that worked fine except it affected lights in a similar way as in your post. My issue was opposite though, the mini-map cam could see lights that the player could not. Because of this lights that should be behind walls would render for the player(you would see the glow through walls.)
Yeah, this is actually the same problem: the render origin for sprites visibility becomes incorrect. Maybe there is a {position / angle / FOV} that allows to restore the player's render origin for sprites visibility. But it is not easy to find it. You can do the [I]render.RenderView()[/I] once after all other ones with these special parameters. But I have no idea yet of what parameters to set.
You need a separate pixel visible handler per light. If you reuse the same pixel visible handler, you'll get these issues.
Okay, but... I am not responsible of lights, only of the mirrors!! And as you can see, the problem happens on [I]env_sprite[/I] entities spawned by the map, so I can do nothing... Also, it happens with [I]every[/I] sprite, even that from Sandbox lights and lamps! And I do not understand what you mean: in Sandbox lamps and lights, the hook [I]ENT:DrawTranslucent[/I] is used. As I understood, it is called on every render target (main view, reflections, etc.), and it is called again at least once when [I]render.RenderView()[/I] is called. If this is true then the PixVis handle is refreshed for each render target. Sorry but I can do nothing with your advice. But thanks for the information you brought me. :-)
Okay, I gave a try about the PixVis handle. I did something different. On the base of Sandbox lights and lamps for my truck, I tried in 2 ways not to use the PixVis handle (so I do not do the DrawTranslucent at all, by returning). It does not work. Sprites still disappear. Maybe I did not found the right test. I tested 2 things: - a flag that I set in the mirror while rendering, - the current render target If you have a better idea of a condition, I'm here to test it.
Sorry, you need to Log In to post a reply to this thread.