Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Terrain texture painting produces NaN/black screen

Discussion in 'High Definition Render Pipeline' started by PurpleGoop, Oct 14, 2023.

  1. PurpleGoop

    PurpleGoop

    Joined:
    Apr 30, 2018
    Posts:
    16
    I have this terrain that i cannot paint textures on or i get black patches that also turn my whole scene black if im looking at them with postProcessing active. I get an error (see pics below) whenever i try to paint on the terrain, even if i have only 1 terrain layer in the terrain material. The material itself works fine and shows the main textures, but painting on it is the problem.
    I tried:
    -creating a new terrain
    -creating a new material
    -creating new terrain layers
    -going into a new scene

    to be clear, the terrain used to work just fine, i have no idea what could have caused this as i have not been fiddling again with it until recently.
    Cannot seem to find anything online so i hope someone can understand what is going on here.
    Below pictures of the problem and the console errors

    Thanks

    PS: in case you ask, changing texture resolution to full in the Quality settings does not work
    unity version 2022.3.11f1 (just updated trying to fix the bug)
     

    Attached Files:

    Last edited: Oct 14, 2023
  2. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    591
    I'd start looking at the textures import settings and ensure MIPs are active, might be project wide settings if you've been tuning it, or a default imported setting you've created or was included with a 3rd party asset. Remember to check all three textures as well.

    If you've done most local check then the last is a project wide setting.

    What it looks like to me is that you could have generate MIPs off on a or all textures for the terrain layer but the terrain is asking for them cause it needs them. I can't say I've seen this myself though in 2022.3.11 or ever. Let us know your findings :)
     
  3. PurpleGoop

    PurpleGoop

    Joined:
    Apr 30, 2018
    Posts:
    16
    Thank you HIBIKI

    i have tried again to switch from Half to full mip map global limit, and it works, i thought it didnt work before because the error doesnt go away when you switch, you have to paint over it again to make the black disappear.
    That said, this still looks like a bug, i should be able to use my global settings without the terrain freaking out like this.
    What can i do here? do i file a ticket?

    Picture of the terrain painting working below
     

    Attached Files:

  4. PurpleGoop

    PurpleGoop

    Joined:
    Apr 30, 2018
    Posts:
    16
    EDIT: as i suspected, i can now confirm that my textures are not the problem, what i think is the problem is the underlying texture that unity must be using as a mask to define how much of each layer must show in the terrain.
    I say this because i have created a mip map limit group in the project setting (right below global mipmap settings) and noticed that applying the full mipmap res. override to the only texture i was using (after re-enabling the standard global half-resolution limit) did not fix anything.
    So i think the global mipmap setting must be affecting this hidden mask texture of the terrain (i think its this "control texture" in the terrain settings) which is causing the bug.

    EDIT: i didnt mean to make a new reply, i messed up
     

    Attached Files:

    Last edited: Oct 16, 2023
    HIBIKI_entertainment likes this.
  5. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    591

    Nice investigation, and interesting finds too.
    Usually, the RGBA splat (x2) gets clamped 0-1, it kind of sounds a bit like it's not in this instance, you should be able to see the splat texture and all the channels if you save your project, when when you look at the terrain assets ( the green icons) you should see a expand arrow, you should be able to check each channel there for any more noticeable errors. in the mean time, absolutely file a bug with a repro so i can be checked, posted the case ID on your OP as well can come in handy. i usually only see this kind of thing from third party content, but since you're using all the default stuff, the only other thing i can thing of is the terrain system is bugged.

    You might be able to install Terrain Tools from the package manager registry, not that i think it overrides any core terrain features and is more its own standalone tool, but you never know!
     
  6. PurpleGoop

    PurpleGoop

    Joined:
    Apr 30, 2018
    Posts:
    16
    Yeah i was trying to find the splat map, didnt know were to look for it, but it doesnt seem like a can do anything significant with it with the red channel being the only one affected, changing those texture settings definitely doesnt affect the bug, so i guess ill file that bug report.
    Those terrain tools look interesting though, i wanted more control over the terrain tools and this looks like it (did not fix the issue unfortunately).
    Thanks for the help and info, i still got something out of this even though i didnt fix the bug.:)

    EDIT: i just realized i cant really do a bug report because i do not know what caused this, so i dont have steps to reproduce
    EDIT2: created a new project and no bug, looked in the project settings and noticed the full res mipmaps set by default, so i set it to half. Bam, bugged again, so i guess i do have steps to reproduce then
     

    Attached Files:

    Last edited: Oct 16, 2023