Skip to content

Commit

Permalink
bind lbuffer1 for refraction in forward rp;
Browse files Browse the repository at this point in the history
  • Loading branch information
e2002e committed Nov 16, 2023
1 parent f226d39 commit a60f458
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Sources/armory/renderpath/RenderPathForward.hx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RenderPathForward {
#if rp_render_to_texture
{
path.setTarget("lbuffer0", [
#if rp_ssr "lbuffer1", #end
#if (rp_ssr || rp_ssrefr) "lbuffer1", #end
#if rp_ssrefr "gbuffer_refraction" #end]
);
}
Expand Down Expand Up @@ -105,7 +105,7 @@ class RenderPathForward {
t.depth_buffer = "main";
path.createRenderTarget(t);

#if rp_ssr
#if (rp_ssr || rp_ssrefr)
{
var t = new RenderTargetRaw();
t.name = "lbuffer1";
Expand Down
8 changes: 4 additions & 4 deletions blender/arm/material/make_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def make_forward(con_mesh):
if rpdat.rp_ss_refraction:
mrt += 1
if mrt != 0:
index = 1
idx_refraction = 1
# Store light gbuffer for post-processing
frag.add_out(f'vec4 fragColor[{mrt}+1]')
frag.add_include('std/gbuffer.glsl')
Expand All @@ -557,12 +557,12 @@ def make_forward(con_mesh):
frag.write('fragColor[0] = vec4(direct + indirect, packFloat2(occlusion, specular));')
if rpdat.rp_ssr:
frag.write('fragColor[1] = vec4(n.xy, roughness, metallic);')
index += 1
idx_refraction += 1
if rpdat.rp_ss_refraction:
if parse_opacity:
frag.write(f'fragColor[{index}] = vec4(ior, opacity, 0.0, 0.0);')
frag.write(f'fragColor[{idx_refraction}] = vec4(ior, opacity, 0.0, 0.0);')
else:
frag.write(f'fragColor[{index}] = vec4(1.0, 1.0, 0.0, 0.0);')
frag.write(f'fragColor[{idx_refraction}] = vec4(1.0, 1.0, 0.0, 0.0);')

else:
frag.add_out('vec4 fragColor[1]')
Expand Down

0 comments on commit a60f458

Please sign in to comment.