Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web export renders 1px wide textures completely black. #99399

Open
Tracked by #66458
varianttombstones opened this issue Nov 18, 2024 · 12 comments
Open
Tracked by #66458

Web export renders 1px wide textures completely black. #99399

varianttombstones opened this issue Nov 18, 2024 · 12 comments

Comments

@varianttombstones
Copy link

varianttombstones commented Nov 18, 2024

Tested versions

  • Reproducible in v4.3.stable.steam [77dcf97]
    (Unable to immediately test older versions)

System information

Windows 10 - v4.3.stable.steam [77dcf97] - Replicates on OpenGL

Issue description

If you set a StandardMaterial3D's texture to a 1 pixel thin texture and apply it to a mesh, it will render the mesh's material as completely black when playing via web.

In Editor as a single pixel thin texture:
image

In Desktop debug (Windows):
image

In web debug (Waterfox, but has been tested on Chrome, Edge, Firefox, etc, same result):
image

Steps to reproduce

  • Create a StandardMaterial3D
  • I set it to shading mode unshaded, but even if lit, it shows up as a slight dark grey/black.
  • Apply 1px wide texture

Minimal reproduction project (MRP)

minimal-reproduction-project.zip

@adamscott
Copy link
Member

@varianttombstones Please create and join a minimal reproduction project. I was about to test your issue, but there's no project file.

@varianttombstones
Copy link
Author

@varianttombstones Please create and join a minimal reproduction project. I was about to test your issue, but there's no project file.

Hey @adamscott , I have attached an MRP it's not specifically web exports the issue is present across the entire compatibility renderer.

@varianttombstones varianttombstones changed the title Web export renders materials with 1px thin textures as fully black Compatibility rendere renders materials with 1px thin textures as fully black Dec 3, 2024
@adamscott adamscott changed the title Compatibility rendere renders materials with 1px thin textures as fully black Compatibility renderer renders materials with 1px thin textures as fully black Dec 3, 2024
@adamscott
Copy link
Member

It seems to be related to the litteral "shading", as unshaded renders flawlessly.

Unshaded Per-pixel / Per-vertex
Image Image

@adamscott adamscott changed the title Compatibility renderer renders materials with 1px thin textures as fully black Compatibility renderer doesn't have default lighting Dec 3, 2024
@adamscott
Copy link
Member

adamscott commented Dec 3, 2024

Just found out that if you add a light source in Compatibility, it lights/shows up properly. It's not related to the texture size. I renamed the issue in consequence.

@adamscott adamscott changed the title Compatibility renderer doesn't have default lighting _Compatibility_ doesn't have default lighting Dec 3, 2024
@adamscott adamscott changed the title _Compatibility_ doesn't have default lighting Compatibility renderer doesn't have default lighting Dec 3, 2024
@Calinou
Copy link
Member

Calinou commented Dec 3, 2024

In web debug (Waterfox, but has been tested on Chrome, Edge, Firefox, etc, same result):

There's a shadow being cast, so default lighting is working. The plane also has a blue-ish hue, so it's taking the environment lighting in.

That said, remember that default lights don't apply to the running project, only the editor. It's why you need to add a DirectionalLight3D node from the editor preview. OP already did this because their lighting is working correctly when running the project on Windows.

@adamscott
Copy link
Member

I tried the MRP locally. There's no lights in the main scene.

  • the cube is black on Compatibility
  • the cube is lit on Forward+

@Calinou
Copy link
Member

Calinou commented Dec 3, 2024

I found the issue: when using Compatibility, the radiance map doesn't update according to the Default Clear Color project setting.

If you set the clear color in _ready() instead (or even in _init()), it'll work:

RenderingServer.set_default_clear_color(Color(1, 1, 1))

@varianttombstones
Copy link
Author

I tried the MRP locally. There's no lights in the main scene.

* the cube is black on _Compatibility_

* the cube is lit on _Forward+_

I want to alert both of you to the fact that my post originally said the issue is when testing web exports, I forgot to add lighting and got confused, so I guess it's 2 issues as I just tested the web exports based on both of your comments and even with lighting it renders pitch black just for 1 pixel thin textures.

@varianttombstones
Copy link
Author

Just found out that if you add a light source in Compatibility, it lights/shows up properly. It's not related to the texture size. I renamed the issue in consequence.

Desktop Testing
Image
Web Testing
Image

Both have lighting.
On the web export, texture size is still a problem.

@varianttombstones varianttombstones changed the title Compatibility renderer doesn't have default lighting Web export renders 1px wide textures completely black. Dec 3, 2024
@Calinou
Copy link
Member

Calinou commented Dec 3, 2024

The issue is likely fixed in 4.4.dev by properly handling VRAM-compressed textures that have a size that isn't a multiple of 4 pixels (the texture in the MRP is 1×10). In the meantime, switch to Lossless compression in the Import dock (you won't save any meaningful amount of VRAM on such a small texture anyway, it only loses quality).

@varianttombstones
Copy link
Author

Oh perfect! Could someone confirm its fully fixed on 4.4dev and then close the issue please, I tried but I couldn't get the web export template to run on 4.4dev, I might be able to check again later.

@adamscott
Copy link
Member

The issue is likely fixed in 4.4.dev by properly handling VRAM-compressed textures that have a size that isn't a multiple of 4 pixels (the texture in the MRP is 1×10).

It doesn't work, unfortunately. I'll investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants