Jump to content

[HELP]Replace car paintjobs?


irinel1996

Recommended Posts

I suppose it depends if the existing DFF has the right mapping to allow the paintjob to be applied directly (thus you'd need to add the other vehicle textures to the paintjob TXD) or if GTA has some special inbuilt support for it. If not, you could probably change the DFF to accept that, although paintjobs might then become universal since you'd be forcing the same modified DFF for everyone. I've never tried modifying paintjobs for vehicles in MTA.

Link to comment

You would have to apply the paintjobs manually. So you would have to load the paintjob txds all at once at the beginning, and later on import the txd when your paintjob changes. Since I just realised paintjobs are nothing more than just another texture for the same vehicle.

Link to comment

Yes, but a paintjob TXD only contains the paintjob, not any of the other stuff. So if you forced a TXD replacement of the paintjob over the vehicle's existing TXD, indeed the paintjob may become visible but all of the other textures (seats, dashboard, engine compartment, underside etc) would be white. That was why I suggested that it may be necessary to add all those textures to the paintjob TXD. And that still wouldn't change universal replacement.

Link to comment

Oh ok ^_^ I thought it contained all the other stuff (seats, dashboard, engine compartment, underside etc [yes i copied from ur post]) too... You could use dxCreateTexture and apply stuff through images..but that is kinda advanced.. I don't know how to use it.

Link to comment

Replacing the paintjobs does work, subenji99 did it. HOWEVER the paintjob id's are NOT the vehicle ID's.

You need to use the new replacing shader functions.

for the life of me i dont know how its done, (benji did it) but i do know our textures are just .png images.

For example "elegy2.txd" as its called in the gta3.img, with just the texture extracted to .png is: elegy2body256.png

then you replace "elegy2body256" with that somehow in shaders (someone who knows will be able to help you with that)

and TADA! custom paintjob.

Doing it this way ONLY replaces the SINGLE paintjob. Not all 3.

t_mta-screen_2011-09-05_20-55-05.png

tn_mta-screen_2011-09-13_00.jpg

  • Thanks 1
Link to comment

Yes, it's possible by way of shaders in MTA 1.1. Here is the shader fx code you need (provided with no restrictions by Gamesnert):

texture gTexture; 
  
technique TexReplace 
{ 
    pass P0 
    { 
        Texture[0] = gTexture; 
    } 
} 

As you can see, all it does is substitute the texture it would have used for the one you provide.

In lua, you use it like so:

addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
     
        texture = dxCreateTexture ( "path/to/imagename.png/.jpg/.bmp" ) 
        shader, tec = dxCreateShader( "texturereplaceshader.fx" ) 
         
        --bit of sanity checking 
        if not shader then 
            outputConsole( "Could not create shader. Please use debugscript 3" ) 
            destroyElement( texture ) 
            return 
        elseif not texture then 
            outputConsole( "loading texture failed" ) 
            destroyElement ( shader ) 
            tec = nil 
            return 
        else 
            engineApplyShaderToWorldTexture ( shader, "internalfilenamewithoutextension" ) 
            dxSetShaderValue ( shader, "gTexture", texture ) 
        end 
         
    end 
) 

dxCreateTexture is quite versatile for what filetypes it will take, but it will not accept txd files, and the files given should be in sizes of a power of 2. (1,2,4,8,16,32,64,128,256...) If you don't want a texture to be stretched/cropped, it should match the size of the texture you're replacing.

You can call the shader file whatever you want, as long as it's referenced correctly in the code and the meta.xml. Use the tag.

The internal texture file name can be retrieved in one of 2 ways: the 'hard' way of calling https://wiki.multitheftauto.com/wiki/Eng ... xtureNames and trying to identify which one in the list you are after,

or how DazzaJay hinted at above, open the relevant TXD file in an editor and see what the filename is for the texture you want to replace. Don't append an extension.

The dxSetShaderValue line actually passes the texture data to the shader. If you want an animated texture, you can keep calling this function. (this is what Gamesnert's nyancat resource does) the "gTexture" string is a reference to the texture variable defined in the shader file.

Remember to also send your clients the image file! Again, use the tag.

common names for car paintjobs:

body256

e.g.:

elegy2body256

flash3body256

jester1body256

stratum2body256

sultan2body256

Link to comment

in theory this doesnt even replace a single paintjob, ~100(probably less)lines of script, and you could make infinite ammount of paintjobs qunique for each vehicle, without replacing a single PJ id.

some more fancy scripting and nfs style strechable/cropable/zoomable stickers could be made.

probably even bump mapping textures(bump mapping shader isn't that advanced) could make infinite ammount of possible body tuning.

Link to comment
  • 2 months later...

You want huge chunk, the Initial D server we have yet to update, now that's a huge download, 14 custom high poly cars, 2 ENTIRE MOUNTIAN racetracks, that's 130MB.

Some people can download it in a matter of seconds, some people cant.

Don't worry about the size, well, do worry about the size, but try to keep it under 5MB. - even then some impatient 13 year old ADHD sufferers will still bitch about it taking so long, but that's their problem.

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