StarfallEx
StarfallEx copied to clipboard
RenderTarget is affected by HDR when rendered to itself.
I never noticed since I leave HDR off, but maybe needs http://wiki.garrysmod.com/page/Enums/CREATERENDERTARGETFLAGS to fix. dunno
~~Also doesn't seem to affect gm_flatgrass~~
it does affect in gm_flatgrass
Without HDR
With HDR
I'll look at it in the morning. Just finished the semester so should have some time.
I still can't reproduce it. Can I get a copy of some code to reproduce it with? (I think @Damianu gave me one, but I don't have it anymore).
I think it's because the background is pure black which makes HDR overcompensate. Look at the sky in the background, it turns white too.
I got to figure out why wire screens don't get affected this way though.
By the way, Matrix() returns an identity matrix.
I think the only difference between starfall and wiremod is they use cam.Start3D2D while starfall's uses 3D.
The render target stores the image after HDR processing. And because I reuse old render target image, it turns old pixels brighter and brighter in each frame. Wire screens don't reuse old render target images, so its not visible.
That's my guess.
So I need to modify RT textures to not do any HDR. I'll try
Not sure how. Tried this but no cigar.
GetRenderTargetEx( rtname, 1024, 1024,
RT_SIZE_OFFSCREEN,
0,
2048,
0,
IMAGE_FORMAT_DEFAULT
)
I'll see if anyone replies to https://facepunch.com/showthread.php?t=1508566&p=51570474&viewfull=1#post51570474 otherwise I'll make a request in the garrysmod requests.
Okay, I've found out that this only happens when you render the rendertarget to itself.
Actually it does not. For me it was enough to draw web image to renderarget and hold it in memory, then it goes darker but not full dark. When you render rendertarget to itself its more glitchy than HDR.
If I remember correctly, wire screens are affected similarly.
Going to leave it open for future reference.
If anyone wants to know the solution. Use a double buffer (i.e. two rendertargets).
There might be a material flag that can be applied to the rendertarget material to prevent this. I'm not yet willing to spend the time experimenting to test this theory yet, but it might be fixable.