Cyber14

Texture replacement problem

Recommended Posts

Hi, Im trying to import some objects from GTA IV to my MTA Server. I watched some videos and in result I made dff, col and txd file. When I uploaded it to my server the object model was exactly like I want it to be. The collision was working fine too, but the object texture was blank - it looks like the same with the txd file teplaced and without the txd file replaced, so I think that the problem is with this file. I was trying to find a solution but it didnt give an effect. For better clarity I'm explaining how I add an material to the object.

https://imgur.com/a/laikQkp - Please read the descriptions of the images, start reading from the bottom of the page.

Please help me and dont know what am I doing wrong.

Share this post


Link to post

Hi,

the function engineImportTXD should be called before loading the DFF. It's important to call the engine functions in certain order.

Edited by TEDERIs
  • Thanks 1

Share this post


Link to post
8 minutes ago, TEDERIs said:

Hi,

the function engineImportTXD should be called before loading the DFF. It's important to call the engine functions in certain order.

I changed the order to look like this:

 

addEventHandler ( "onClientResourceStart", getResourceRootElement ( getThisResource() ), function ()
	txd = engineLoadTXD ( "cam.txd" )
	if (engineImportTXD ( txd, 1237 )) then
		outputChatBox ( "TXD => TRUE")
	else
		outputChatBox ( "TXD => FALSE")
	end
	
	dff = engineLoadDFF ( "cam.dff" )
	if(engineReplaceModel ( dff, 1237 )) then
		outputChatBox ( "DFF => TRUE")
	else
		outputChatBox ( "DFF => FALSE")
	end
	
	col = engineLoadCOL( "cam.col" )
	if(engineReplaceCOL( col, 1237 )) then
		outputChatBox ( "COL => TRUE")
	else
		outputChatBox ( "COL => FALSE")
	end
end)

 

But now the camera object is black:

PzuVclv.jpg

Without the TXD replace function it's white as I show at beginning.

Edited by Cyber14

Share this post


Link to post

That's right, the TXD has not loaded right way before. At the moment TXD is loaded, but there is some other issue. It seems like that TXD or DFF texture section are invalid.

Share this post


Link to post

So what can I do now? It works in 3ds max as I have shown on my pictures earlier.

Share this post


Link to post

There is an amazing tool RW Analyze. So I would be sure that the DFF section is fine. A name in that section must be equal to a name of your texture in the TXD. Moreover, the TXD should have an SA type.

Share this post


Link to post

You could try running

inspect(engineGetModelTextureNames(1237))

via runcode client-run (/crun) to see whether the DFF actually loaded the texture "cam".

Edited by MrTasty

Share this post


Link to post
3 minutes ago, MrTasty said:

You could try running


inspect(engineGetModelTextureNames(1237))

via runcode client-run (/crun) to see whether the DFF actually loaded the texture "cam".

As you can see after TXD replacement I have a "cam" TXD in the table.

xrOjAKH.png

Im uploading my 3ds max project file + texture PNG file and files which I have done: https://www73.zippyshare.com/v/adVsokr6/file.html

Share this post


Link to post

Are the UV coordinates correct? Because it is possible to have all of UVs in the same point(0,0 for example). The texture at point (0, 0) is black, so it may be the reason.

Edited by TEDERIs

Share this post


Link to post

Could the issue be that you've used a Standard material in 3Ds (according to the screenshots) as opposed to a GTA Material (Kam's script)?

Share this post


Link to post

So isn't it possible to just drag the image on the model and have it done withour configuring UVs?

Share this post


Link to post

What you should do is select a default material, change it's type to GTA Material (by pressing the button next to the material name which says "Standard"), then click on the button on the right of color column which will by default say "None", and then select a bitmap texture. Then you need to rename the map from "Map #1" to the same as the texture name but excluding the file extension (not sure if this is required but I always do that). 

Share this post


Link to post
11 minutes ago, MrTasty said:

What you should do is select a default material, change it's type to GTA Material (by pressing the button next to the material name which says "Standard"), then click on the button on the right of color column which will by default say "None", and then select a bitmap texture. Then you need to rename the map from "Map #1" to the same as the texture name but excluding the file extension (not sure if this is required but I always do that). 

I did it and its still black.

UlrBrSU.png

@TEDERIs I have uploaded the another TXD file which (0,0) point was blue and the camera was still black.

Share this post


Link to post

@Cyber14, sorry, I haven't noticed that. This leads to a suspicious website where are plenty of buttons, so I couldn't find the right one.

Share this post


Link to post

@Cyber14, Nope, there was a message about it, but a download isn't started.

Share this post


Link to post

Okay, I have found the problem. I've just rebuilt the TXD by TXD Workshop 5.0.

Edited by TEDERIs
  • Thanks 1

Share this post


Link to post

I've loaded the file and in-game it seems to have some dark textures, wrongly mapped, however, afterwards I've increased the mipmaps to 1 (or any non-zero value) and it seems to load properly.

  • Like 1

Share this post


Link to post

@TEDERIs You are right, when I used TXD Workshop 5.0 it worked for me too. It turns out that the newest TXD Workshop version has some problems with that. Thanks for help to everybody, my problem is solved!

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

  • Recently Browsing   0 members

    No registered users viewing this page.