Sign in to follow this  
Sylvek

Path quality problem

Recommended Posts

Hi!

Last time I scripted some gps script and it works really nice with nodes from default gps resource. Used this in map script where you can easily zoom and move around san andreas then just select waypoint for gps. Main issue is quality of drawed lines on path. I found on it some "bad pixels?" and another quality losses. Just take a look at this:

hgfQMka.png

You can easily see some type of jagged edges. You can now say that's the bend problem but on straight lines you can see this problem too.

From script side line is drawed on renderTarget then drawed with imageSection on map gui. Its just the line. Converting this to texture and using any color type or mipmaps doesnt work. I think shader will be good idea but which type?

Share this post


Link to post

I solved this problem with a 8x8 circle image. Added image to the every node position in RT and looks better.

What I mean?

 

dxSetRenderTarget(gpsRouteImage)
dxSetBlendMode("modulate_add")

for i = 2, #gpsLines do
	if gpsLines[i - 1] then
		local x0 = gpsLines[i][1] - routeStartPosX + 8
		local y0 = gpsLines[i][2] - routeStartPosY + 8
		local x1 = gpsLines[i - 1][1] - routeStartPosX + 8
		local y1 = gpsLines[i - 1][2] - routeStartPosY + 8

		dxDrawImage(x0 - 4, y0 - 4, 8, 8, "dot.png")
		dxDrawLine(x0, y0, x1, y1, tocolor(255, 255, 255), 9)
	end
end

dxSetBlendMode("blend")
dxSetRenderTarget()

 

  • Thanks 2

Share this post


Link to post

Wow. Really clever and simple. Really thanks. I think we can close this topic.

 

For close.

Share this post


Link to post

@Jayceon
Drawing a texture from a path is slow.
Use a texture created with dxCreateTexture instead.
And, drawing a whole map which is 3072x3072 is also slow.

  • Like 1

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.