godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.05k stars 21.18k forks source link

Godot 3.2 mipmap forced to viewport texture when it used in environment #36718

Closed danilw closed 4 years ago

danilw commented 4 years ago

Godot version: 3.2 stable

OS/device including version: linux

Issue description: it does not happen in 3.1 set viewport texture as environment.background_sky.set_panorama mipmap will be forced on it mipmap forced 1 correct 2

Steps to reproduce:

    var iChannel=viewport.get_viewport().get_texture()
    camera.environment=load("res://default_env.tres") as Environment
    camera.environment.background_sky.set_panorama(iChannel)

Minimal reproduction project: I dont have minimal project for it, not minimal project link open it(Dynamic sky and reflection) in Godot 3.2 launch youl see-one sphere become black, and bugs on other figures then comment or delete line 51 in scripts/scene_cam.gd self.environment.background_sky.set_panorama(iChannel) everything will work

clayjohn commented 4 years ago

The panorama texture requires mipmaps in order to compute the sky radiance maps correctly. Computing mipmaps should be creating a big black sphere in the middle of the panorama though. There must be some other issue going on.

danilw commented 4 years ago

in that project I use same texture as background_sky.set_panorama and on objects, so I send it to many shaders as uniform

in Godot 3.2 mipmap forced on every next this texture usage after self.environment.background_sky.set_panorama() call

in Godot 3.1 it does not forced, every next texture usage reset its flags

obvious fix to it set iChannel.flags=Texture.FLAG_FILTER (iChannel is viewport texture) on each next this viewport texture usage.

so bug is - this does not happen on Godot 3.1

The panorama texture requires mipmaps in order to compute the sky radiance maps correctly.

this can not be reason.Godot do not compute radiance maps for dynamic viewport image (it black always)

clayjohn commented 4 years ago

It doesn't happen every frame, it happens when you call set_panorama().

set_panorama() calls sky_set_texture() which computes the radiance maps. The radiance maps need mipmaps from the panorama sky, so if they aren't enabled, it forces them on.

Again though. This won't cause the large black sphere you have appearing in that image. So there must be something else going on as well.

Generating mipmaps is not a bug.

danilw commented 4 years ago

ok nwm then my point is - this changed form Godot 3.1

can be closed idk, do as you wish

clayjohn commented 4 years ago

I'm just wondering if there is another bug? That first screenshot looks very broken.

danilw commented 4 years ago

there no other bugs, whole project logic is display single "procedural panorama" on shapes and environment this is only mipmap

I do not have time to test this "new feature" and why it happen, I already tell fix - just set texture flags before every next usage iChannel.flags=Texture.FLAG_FILTER (and I add this fix to linked project, so if you want test original version then remove this line from set_uniforms.gd file)

clayjohn commented 4 years ago

Ah, if that is the case then this isn't a bug and I will close this issue. But you have provided useful notes for others who may be experiencing the same thing. Thanks. :)