grand-theft-auto-for-unity icon indicating copy to clipboard operation
grand-theft-auto-for-unity copied to clipboard

Texture Error

Open emre1601 opened this issue 4 years ago • 9 comments

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

emre1601 avatar Sep 15 '20 20:09 emre1601

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

mukaschultze avatar Sep 15 '20 21:09 mukaschultze

@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?

emre1601 avatar Oct 15 '20 08:10 emre1601

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

projectrift avatar Jul 14 '23 13:07 projectrift

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

emre1601 avatar Jul 14 '23 15:07 emre1601

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

projectrift avatar Jul 15 '23 01:07 projectrift

@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

mukaschultze avatar Jul 15 '23 02:07 mukaschultze

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

projectrift avatar Jul 15 '23 09:07 projectrift

@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

projectrift avatar Jul 15 '23 12:07 projectrift

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

gjamesgoenawan avatar Oct 19 '23 09:10 gjamesgoenawan