Armikron Posted July 20, 2023 Share Posted July 20, 2023 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: 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 Posted July 20, 2023 Share Posted July 20, 2023 Armikron Looks like a typical shader error involving inf/NaN. Need to find the exact place where it occurs. Thanks for providing the sample material, sent it to the QA team for validation. 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Armikron Posted July 20, 2023 Author Share Posted July 20, 2023 Thanks, looks like it was indeed division by zero. Added checks and problem disappeared. 1 Link to comment
silent Posted July 20, 2023 Share Posted July 20, 2023 Great, problem solved then :) How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts