adrian.licuriceanu Posted November 23, 2021 Share Posted November 23, 2021 Hi, I have an object extern which has a alpha blending material, something very similar with the old 2D clouds (actually is a resurrection of the old 2d volumetric clouds with some modifications): <base_material name="vstep_volume_clouds" editable="0"> <options two_sided="1" transparent="2" order="10" depth_mask="0" cast_shadow="0" receive_shadow="0" cast_world_shadow="0" receive_world_shadow="0"/> <blend src="src_alpha" dest="one_minus_src_alpha"/> <state name="surface" internal="1" type="switch" items="sphere,clouds,shadow">0</state> <state name="ambient" type="switch" items="none,default" title="Environment and Emission" group="Light Passes" tooltip="Environment and emissions">1</state> <state name="volume" internal="0" type="toggle" title="Soft Interaction" group="Options" tooltip="<p>Enable soft depth interaction.</p>">0</state> <state name="turbulence" internal="0" type="toggle" group="Options" tooltip="<p>Enable the turbulence effect.</p>">1</state> <state name="geodetic" internal="1" defines="name">0</state> <!-- textures --> <texture name="noise" surface="0" filter="linear">core/textures/sky_base_noise.dds</texture> <texture name="volume" surface="0" filter="linear" wrap="clamp_z">core/textures/sky_base_volume.dds</texture> <texture name="density" surface="0" filter="linear">core/textures/sky_base_density.dds</texture> <texture type="opacity_depth" unit="15"/> <!-- parameters --> <group name="Transform"> <float4 name="volume_transform" expression="1" title="Volume" tooltip="<p>Transformation of the volumetric clouds mask.</p>">vec4(2,2,sin(time*0)*0+time*0.005*sin(2.61799),cos(time*0)*0+time*0.005*cos(2.61799))</float4> <float4 name="noise_transform" title="Noise" tooltip="<p>Transformation of the volumetric noise texture.</p>">12.0f 12.0f 1.0f 1.0f</float4> </group> <group name="Volume"> <color name="volume_0_color" title="Color 0" tooltip="<p>Color of the volumetric clouds.</p>">1.0 1.0 1.0 1.0</color> <color name="volume_1_color" title="Color 1" tooltip="<p>Color of the volumetric clouds shadowed areas.</p>">0.321569 0.396078 0.498039 1</color> <slider name="volume_01_scale" min="0.0" max="4.0" max_expand="1" title="Multiplier" tooltip="<p>Volumetric clouds color multiplier.</p>">1.0</slider> <slider name="volume_alpha" min="0.0" max="2.0" max_expand="1" title="Alpha" tooltip="<p>Volumetric clouds alpha value.</p>">0.15</slider> <slider name="volume_turbulence" min="0.0" max="2.0" max_expand="1" title="Turbulence" tooltip="<p>Volumetric clouds turbulence noise.</p>">0.45</slider> <float2 name="volume_fade" title="Volume Size" tooltip="<p>Controls the fading of the clouds as we go through them.</p>">300 1000</float2> </group> <group name="Options"> <slider name="volume_scale" volume="1" min="0.0" max="128.0" max_expand="1" title="Soft Interaction" tooltip="<p>Clouds soft interaction scale.</p><p>Depth factor that controls the volumetric clouds dispersal depending on their position relative to the object.</p>">64.0</slider> </group> <shader pass="ambient" node="object_extern" surface="0" turbulence_defines=",TURBULENCE" volume_defines=",VOLUME" ambient="1" vertex="data/Common/Materials/Sky/Clouds/vertex/volume.vert" fragment="data/Common/Materials/Sky/Clouds/fragment/volume.frag"/> <shader pass="reflection" node="object_extern" surface="0" turbulence_defines=",TURBULENCE" volume_defines=",VOLUME" defines="BASE_REFLECTION" planar_reflection="1" vertex="data/Common/Materials/Sky/Clouds/vertex/volume.vert" fragment="data/Common/Materials/Sky/Clouds/fragment/volume.frag"/> </base_material> All is working fine for normal rendering, but the clouds never show in any 2D planar reflection surfaces. Debugging the code I can see that only surfaces with deferred pass are considered to be added to reflection_surfaces for the RenderScene. So my question is: what is missing from my material to make the alpha blended surface show in reflections? Do I need to add a deferred pass? And if so what this actually do? As seen above I've added a reflection pass but I guess this is to be added to surfaces actually doing the reflection (and not the reflected ones)? Regards, Adrian L. Link to comment
andrey-kozlov Posted November 23, 2021 Share Posted November 23, 2021 Hello Adrian, I don't think there should be additional considiration to make alpha blend objects appear in planar reflection. Planar reflection just renders scene from another camera. If you add for example volume_cloud_base object (which defines only ambient pass and a couple of debug ones), it will appear in the reflection. Reflection pass is responsible for applying planar reflection, not participating in it. reflection_surfaces correspond to those surfaces which define that pass So we'll probably need some sort of reproducer to find out the reason why it doesn't appear. Link to comment
adrian.licuriceanu Posted November 23, 2021 Author Share Posted November 23, 2021 Hi, thank you for the support. Found the issue, incorrect viewport mask setup. Regards, Adrian L. 2 Link to comment
Recommended Posts