Document conversion function needed for normal texture in CompositorEffect
This commit is contained in:
parent
1bd740d18d
commit
abe8d2c719
|
@ -57,6 +57,17 @@
|
|||
var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
|
||||
var roughness_buffer = render_scene_buffers.get_texture("forward_clustered", "normal_roughness")
|
||||
[/codeblock]
|
||||
The raw normal and roughness buffer is stored in an optimized format, different than the one available in Spatial shaders. When sampling the buffer, a conversion function must be applied. Use this function, copied from [url=https://github.com/godotengine/godot/blob/da5f39889f155658cef7f7ec3cc1abb94e17d815/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl#L334-L341]here[/url]:
|
||||
[codeblock]
|
||||
vec4 normal_roughness_compatibility(vec4 p_normal_roughness) {
|
||||
float roughness = p_normal_roughness.w;
|
||||
if (roughness > 0.5) {
|
||||
roughness = 1.0 - roughness;
|
||||
}
|
||||
roughness /= (127.0 / 255.0);
|
||||
return vec4(normalize(p_normal_roughness.xyz * 2.0 - 1.0) * 0.5 + 0.5, roughness);
|
||||
}
|
||||
[/codeblock]
|
||||
</member>
|
||||
<member name="needs_separate_specular" type="bool" setter="set_needs_separate_specular" getter="get_needs_separate_specular">
|
||||
If [code]true[/code] this triggers specular data being rendered to a separate buffer and combined after effects have been applied, only applicable for the Forward+ renderer.
|
||||
|
|
Loading…
Reference in New Issue