godotengine / godot

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

Viewport setsize errors on simple project with Camera2D and MeshInstance3D #91462

Open catafest opened 5 months ago

catafest commented 5 months ago

Tested versions

v4.3.dev5.official [89f70e98d]

System information

Windows 10 Pro, NVIDIA GeForce GTX 950

Issue description

I tried to use Subviewport with Camera2D and Quadmesh I tested and I followed some issues: https://github.com/godotengine/godot/issues/40651 https://github.com/godotengine/godot/issues/54122 https://github.com/godotengine/godot/issues/50296 https://github.com/godotengine/godot/issues/55471 I got these errors : image Maybe this is not a real bug and is a bad practice. No matter how you use it, there should be no size setting errors...

Steps to reproduce

See the project I added in the section: Minimal reproduction project (MRP) :

Minimal reproduction project (MRP)

SubViewport_Bug_001.zip

Sauermann commented 5 months ago

Possibly a duplicate of #66247

graphific commented 3 months ago

I'm having the same issue on v4.3beta1. fix for me as mentioned in https://github.com/godotengine/godot/issues/66247

func update_material():
    var shader_material = ShaderMaterial.new()
    shader_material.shader = load("res://objects/video.gdshader")
    shader_material.set_shader_parameter("portal_texture", sub_viewport.get_texture())
    mesh_instance.material_override = shader_material

shader

shader_type spatial;
render_mode unshaded;

uniform sampler2D portal_texture;

void fragment() {
    vec4 texture_color = texture(portal_texture, UV);
    ALBEDO = texture_color.rgb;
    ALPHA = texture_color.a;
}