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

Vulkan: Viewport's keep_3d_linear property not reimplemented yet #41406

Open
Calinou opened this issue Aug 20, 2020 · 10 comments
Open

Vulkan: Viewport's keep_3d_linear property not reimplemented yet #41406

Calinou opened this issue Aug 20, 2020 · 10 comments

Comments

@Calinou
Copy link
Member

Calinou commented Aug 20, 2020

Godot version: Git 4e52c75

OS/device including version: Fedora 31, GeForce GTX 1080 (NVIDIA 440.100)

Issue description: Viewport's keep_3d_linear property hasn't been reimplemented yet in the Vulkan renderer. That property is available in 3.2.2.

Steps to reproduce: Search for keep_3d_linear in the editor help.

Minimal reproduction project: N/A

@Calinou Calinou added this to the 4.0 milestone Aug 20, 2020
@clayjohn
Copy link
Member

I think reduz intentionally got rid of it. I remember discussing this when he was first making the Vulkan Renderer.

@thunderk
Copy link

The hdr property is gone too, I guess they are related.

A potential use-case for these properties is to bake an HDRi panorama sky from a scene, by using HDR-enabled viewports.

@Calinou
Copy link
Member Author

Calinou commented Oct 18, 2021

The hdr property is gone too, I guess they are related.

A potential use-case for these properties is to bake an HDRi panorama sky from a scene, by using HDR-enabled viewports.

HDR is now always enabled in viewports. Unlike GLES3 in 3.x, there is no way to disable HDR in the Vulkan renderer.

@thunderk
Copy link

Oh sorry, I thought the viewport was not HDR-enabled because the texture I retrieved from it was in RGBA8 format. I created another issue #54122 regarding this, as it's not really related.

@SmartySmart702
Copy link

Is there a replacement or workaround? I need this for portals and right now the colors are off.

@Calinou
Copy link
Member Author

Calinou commented Jun 17, 2022

Is there a replacement or workaround? I need this for portals and right now the colors are off.

You should be able to implement sRGB-to-linear or linear-to-sRGB conversion in the shader displaying the portal texture (on the ALBEDO color). The formulas for doing this are well-known:

vec3 linear_to_srgb(vec3 color) {
return max(vec3(1.055) * pow(color, vec3(0.416666667)) - vec3(0.055), vec3(0.0));
}
vec3 srgb_to_linear(vec3 color) {
return color * (color * (color * 0.305306011 + 0.682171111) + 0.012522878);
}

@clayjohn
Copy link
Member

Will be fixed by #70970 in 4.1

@RichMakeGame
Copy link

it would be fantastic to see this feature re-added, the conversion workaround is causing issues for my use case with the loss of precision

@RichMakeGame
Copy link

is there any other workaround for uses where viewport texture is being used for alternative purposes? converting back to linear bunches all the precision toward 0 and values approaching 1 are too 'chunky'

@Arnklit
Copy link
Contributor

Arnklit commented Feb 12, 2024

I have been dealing with this issue for getting my addon Waterways running correctly in Godot 4.x and I hadn't been able to get it work work no matter what conversions I did.

I realised it was because tonemapping was playing into it as well. if you don't have a environment inside your viewport, it will use an external one or a default one with filmic tonemapping. Be sure to make an environment with linear tonemapping inside your viewport.

Also it appears that the "Use HDR 2D" setting works with 3D and keeps it linear as well now. you just still have to ensure no tonemapping is happening.

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

7 participants