Jump to content

Weird black lines on images


alberto2345

Recommended Posts

I've noticed an issue with my custom blips. This tend to happen when the image is on a certain angle.

e68011ebc9.jpg

6034aaff68.jpg

As you can see in the first image, the blue picture doesnt have the line, then when I moved alittle, the black line appears (as seen in the second image).

Here is the original image from the source, and I don't see any lines on the website or when I download.

http://www.flaticon.com/free-icon/medic ... osition=17

Colour code: #52FFA3

I'm not sure whether its something to do with them also being transparent as I've seen this happen to another transparent image on another server.

Has this happened to anybody else and is there a way to fix this?

Also my resolution is 1280x72x32 windowed.

Thanks.

Link to comment

As from what I know this is common for older graphics cards / low resolution clients. And yes, it is an issue with transparency, the image draw bounding is moved down revealing black background from Microsoft's DirectX (afaik).

Other than changing resolution or display more (or trying on another machine) I have no suggestion to overcome this issue.

I hope this helped at least a little.

Regards.

Link to comment

Thanks for your reply.

From what you've said, I'd say its because of the resolution I have. My system isn't that old (3rd gen i5 processor, GTX 970) so it wouldn't be that.

I'll put my res up and see if it disappears.

Thanks!

EDIT: Perhaps I was wrong. I changed my resolution to 1920x1080 (my native resolution) and it still occurred. I also tried setting it to full screen, borderless windowed and windowed, all still showed the lines.

Link to comment

I had a similar problem, but the black lines was just if i move the image

What i did is the actual image size was 1000x1000 i added around 2 pixles more for every side up down left and right and used dxDrawImageSection instead of dxDrawImage to draw the image without the 2 pixles that i have added

Link to comment
Try using dxCreateTexture with textureEdge argument to "clamp".

Your texture idea works like a charm, thanks for that!

If anybody is wanting to fix this for customblips specifically, then add/change this to the onClientRender in imagelib.lua

  
local texture = dxCreateTexture(self.strPath, "argb", true, "clamp") 
dxDrawImage ( x,y, width, height, texture, self.fRot, self.fRotXOff, self.fRotYOff, tocolor(unpack(self.tColor)), self.bPostGUI ) 

Link to comment

Hi,

If anybody has used my code that I posted above for the texture, PLEASE REMOVE IT.

I think it may be the cause as to why my MTA has been crashing the last couple of days.

I've made a fix for it that hasn't caused any issues SO FAR.

Here is what I've done:

In the table at the top of the file of imagelib.lua, add texture to the table like this:

local defaults = { 
    fX                          = 0.5, 
    fY                          = 0.5, 
    fWidth                      = 0, 
    fHeight                     = 0, 
    bRelativePosition           = true, 
    bRelativeSize               = true, 
    fRot                        = 0, 
    fRotXOff                    = 0, 
    fRotYOff                    = 0, 
    strPath                     = "", 
    tColor                      = {255,255,255,255}, 
    bPostGUI                    = false, 
    bVisible                    = true, 
    texture                     = false, 
} 

Then, in the dxImage:create function, add this:

new.texture = dxCreateTexture(path, "argb", true, "clamp") 

I put mine just after new.id variable

Then, at the onClientRender, change the dxDrawImage to this:

dxDrawImage ( x,y, width, height, self.texture, self.fRot, self.fRotXOff, self.fRotYOff, tocolor(unpack(self.tColor)), self.bPostGUI ) 

This will get rid of the lines and (I think) remove the CPU usage issue that I had before (as it was constantly recreating the texture within the renderer)

I've tested it and it seems to work fine.

Sorry to anybody who has chosen to use my method in my other post.

Link to comment

I don't see any problems in your previous code

Did you put the whole code in onClientRender?!

addEventHandler("onClientRender",root, 
function() 
local texture = dxCreateTexture(self.strPath, "argb", true, "clamp") 
3dxDrawImage ( x,y, width, height, texture, self.fRot, self.fRotXOff, self.fRotYOff, tocolor(unpack(self.tColor)), self.bPostGUI ) 
end 
) 

Is that what you did?

Link to comment
I don't see any problems in your previous code

Did you put the whole code in onClientRender?!

addEventHandler("onClientRender",root, 
function() 
local texture = dxCreateTexture(self.strPath, "argb", true, "clamp") 
3dxDrawImage ( x,y, width, height, texture, self.fRot, self.fRotXOff, self.fRotYOff, tocolor(unpack(self.tColor)), self.bPostGUI ) 
end 
) 

Is that what you did?

Yes, he said he did that, you should never be creating a new texture every frame. Just put the dxCreateTexture above the event handler and it will work fine.

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...