mukaschultze / grand-theft-auto-for-unity

Grand Theft Auto map loader for Unity Engine
84 stars 12 forks source link

Texture Error #2

Open emre1601 opened 4 years ago

emre1601 commented 4 years ago

Texture Error ! The texture on the whole map look like this.

SetPixels32 can only be called on a RGBA32, BGRA32, ARGB32, RGB24, BGR24 or Alpha8 texture but is being called on TextureFormat(7) UnityEngine.Texture2D:SetPixels32(Color32[]) GrandTheftAuto.Txd.Decoding.DXT1:DecodeTextureWithProcessor(BufferReader, Int32, Int32, RasterFormat) (at Assets/Scripts/Txd/Decoding/DXT1.cs:90) GrandTheftAuto.Txd.Decoding.Decoder:DecodeTexture(BufferReader, Int32, Int32, RasterFormat) (at Assets/Scripts/Txd/Decoding/Decoder.cs:40) GrandTheftAuto.Txd.Texture:Load() (at Assets/Scripts/Txd/Texture.cs:87) GrandTheftAuto.Txd.Texture:get_Texture2D() (at Assets/Scripts/Txd/Texture.cs:23) GrandTheftAuto.Txd.Texture:op_Implicit(Texture) (at Assets/Scripts/Txd/Texture.cs:134) GrandTheftAuto.Dff.Material:GetUnityMaterial(String) (at Assets/Scripts/Dff/Material.cs:64) GrandTheftAuto.Ide.ItemDefinition:CreateRenderer(Frame, GameObject, String) (at Assets/Scripts/Ide/ItemDefinition.cs:116) GrandTheftAuto.Ide.ItemDefinition:CreateTransform(Frame, Transform, String, Boolean) (at Assets/Scripts/Ide/ItemDefinition.cs:86) GrandTheftAuto.Ide.ItemDefinition:CreateObject(Boolean) (at Assets/Scripts/Ide/ItemDefinition.cs:63) GrandTheftAuto.Ide.ItemDefinition:GetObject(Boolean) (at Assets/Scripts/Ide/ItemDefinition.cs:49) GrandTheftAuto.Loader:Place(ItemPlacement, ProgressBar) (at Assets/Scripts/Loader.cs:125) GrandTheftAuto.Loader:Load() (at Assets/Scripts/Loader.cs:91) GrandTheftAuto.Editor.MenuItems:LoadMap(GtaVersion) (at Assets/Scripts/Editor/MenuItems.cs:165) GrandTheftAuto.Editor.MenuItems:LoadGTAVC() (at Assets/Scripts/Editor/MenuItems.cs:154)

Adsız

mukaschultze commented 4 years ago

You can change this method to always return TextureFormat.RGBA32. This will cause the textures to use a little more RAM and VRAM though.

emre1601 commented 4 years ago

@mukaschultze unfortunately, my problem is exactly the trees and the whole map, except 1 or 2 soil ground, turns yellow like this. Can you tell me exactly what code to change to fix this? If possible, can you send me the edited version of that script file?

projectrift commented 1 year ago

@emre1601 Have you fixed the error? I am trying to import map with ground and building textures

emre1601 commented 1 year ago

It's been a while since I stopped messing around, I don't even remember if we solved it

projectrift commented 1 year ago

@emre1601 Damn, i really need sa map, atleast heightmap lol but yeah creator went ded

mukaschultze commented 1 year ago

@emre1601 Damn, i really need sa map, atleast heightmap lol but yeah creator went ded

This should fix: https://github.com/mukaschultze/grand-theft-auto-for-unity/issues/2#issuecomment-692997301

projectrift commented 1 year ago

@mukaschultze which line to edit? My english understandings went rip.

projectrift commented 1 year ago

@emre1601 Damn, i really need sa map, atleast heightmap lol but yeah creator went ded

This should fix: #2 (comment)

@mukaschultze fixed using chatgpt, but there are so many missing models image

gjamesgoenawan commented 1 year ago

@projectrift

Setting the _Cutout value to 0 fixed the invisible texture problem. I've tried modifying the .shader file to no avail, hence this can be done directly by modifying Unity Scene file.

Simple script like this worked for me:

with open("Assets/Scenes/Default.unity") as f:
    f_list = list(f)

for n, k in enumerate(f_list):
    if "CUTOUT" in k.upper():
        if k[-2] == '1': # default value of _Cutout is 0.01
           f_list[n] =  k[:-2] + '0' + k[-1:] # change to 0.00

with open("Assets/Scenes/Default2.unity", "w+") as f:
    f.writelines(f_list)

Please note that you need to save your scene. Don't forget to duplicate the [YOUR_SCENE_NAME].unity.meta to avoid errors.