Jump to content

renderTarget/dxSetBlendMode quality with fading


Overkillz

Recommended Posts

Hello dear community, Im having an issue with renderTargets.

Well, my problem is simple. Im trying to apply a fade effect to a renderTarget.

Well, I want to have a decent quality while drawing stuffs on it, so, Im forced to se the function dxSetBlendMode.

However, If I use it, I can't make fade animation.

Here is the wiki example with the fade animation

local myRenderTarget = dxCreateRenderTarget(500, 500, true)
local alpha = 0

function updateRenderTarget()
    dxSetRenderTarget(myRenderTarget, true)
    dxSetBlendMode("modulate_add")
	
		dxDrawRectangle(0,0,500,500,tocolor(255,0,0,255))
		dxDrawText("Testing "..getTickCount(), 0, 0, 0, 0, tocolor(255, 255, 255, 255), 2, "clear")

    dxSetBlendMode("blend")
    dxSetRenderTarget()
end

addEventHandler("onClientRender", root,
    function()
		alpha = math.min(alpha+10,255)
        dxSetBlendMode("add")
        dxDrawImage(100, 200, 500, 500, myRenderTarget, 0,0,0,tocolor(255,255,255,alpha))
        dxSetBlendMode("blend")
    end
)

updateRenderTarget()

Is there any way to fix it without losing the quality that brings dxSetBlendMode ?

Thanks for reading, best regards.

Link to comment

Might you can apreciate the difference due to you are using default fonts or not thing fonts, but look

oHoweBm.png

oNJIAFR.png

As you can see, the second image is clearer. Due to the image cut, might you cant difference the quality, but, if you would see the full tab, the quality lost is appreciable.

Anyways, I have done several test and ways to make it work, but nothing, texture shader doesn't work too ...etc So, maybe I will be forced to use module_add arg instead of add only.

Regards.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...