godlikepanos / anki-3d-engine

AnKi 3D Engine - Vulkan backend, modern renderer, scripting, physics and more

Home Page:http://www.anki3d.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GBufferPost using wrong GBuffer layout

SergioAlapontARM opened this issue · comments

The way GBufferPost.ankiprog stores data in GBuffer attachments now is out of date.

	const ANKI_RP Vec3 spec = texture(u_specularRoughnessDecalTex, u_trilinearRepeatSampler, specUv).rgb;

	// Update diffuse
	ANKI_RP F32 f = decalDiff.a * decal.m_blendFactors[0];
	diffuse.rgb = diffuse.rgb * (1.0 - f) + decalDiff.rgb * f;
	diffuse.a *= (1.0 - f);

	// Update specular
	f = decalDiff.a * decal.m_blendFactors[1];
	roughnessMetallicF0.rgb = roughnessMetallicF0.rgb * (1.0 - f) + spec.rgb * f;
	roughnessMetallicF0.a *= (1.0 - f);
}

out_diffuse = diffuse;
out_roughnessMetallicF0 = roughnessMetallicF0;

Gbuffer layout is packed as follows for the RT0 and RT1:

  • RT0: Diffuse (RGB) A (Metallic & Subsurface)
  • RT1: Roughness (R), Fresnel (G), Emissive (BA