Jump to content

[SOLVED] Basemat (mesh_unlit) problem


photo

Recommended Posts

Windows 10, Unigine 2.17.0.1 Community

Just started learning making material Basemat-way and getting strange problem. Black artifacts progressively take over screen:

basemat_mesh_unlit.thumb.jpg.bff35a1663ffc35e88f96f09ef413635.jpg

 

Material:

BaseMaterial <parent=Unigine::mesh_unlit>
{
	// options
	Option blend = [src_alpha one_minus_src_alpha]
	
	Group "Base"
	{
		Color color = [1 0 1 1]
		Slider opacity = 1.0f
	}
	
	Shader vertex_struct =
	#{
		INIT_BASE_DATA
	#}
	
	Shader common =
	#{
		float3 palette( in float t, in float3 a, in float3 b, in float3 c, in float3 d )
		{
    			return a + b*cos( 6.28318*(c*t+d) );
		}

		float4 function(float2 in_uv, float iTime)
		{
			float3 finalColor = float3(0.0, 0.0, 0.0);
			float2 uv = in_uv;
			uv = (uv - 0.5) * 2;
			float2 uv0 = uv;
			for (float i = 0.0; i < 4.0; i++)
			{
				uv = frac(uv*1.5) - .5;
	
				float3 a = float3(.5, .5, .5);
				float3 b = float3(.5, .5, .5);
				float3 c = float3(1., 1., 1.);
				float3 d2 = float3(.263, .416, .557);
	
				float d = length(uv) * exp(-length(uv0));
				float d0 = length(uv0);
	
				float3 color = palette(d0 + i * .4 + iTime * .4, a, b, c, d2);
	
				d = sin(d * 8.0 + iTime) / 8.0;
				d = abs(d);
				d = pow(.01 / d, 1.0);
	
				finalColor += color * d;
			}
	
			return float4(finalColor, 1.0);
		}
	#}
	
	Shader vertex =
	#{
	#}

	Shader fragment =
	#{
		OUT_FRAG_EMISSION = function(DATA_UV.xy, s_game_time).rgb;
		OUT_FRAG_OPACITY = var_opacity;
	#}
}

If parent material is just mesh, then it doesn't happen.

Link to comment
  • silent changed the title to [SOLVED] Basemat (mesh_unlit) problem
×
×
  • Create New...