File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -323,6 +323,19 @@ ${array.join('')}
323
323
`${ pad } color3f inputs:diffuseColor.connect = </Materials/Material_${ material . id } /Texture_${ material . map . id } _diffuse.outputs:rgb>` ,
324
324
)
325
325
326
+ // Include alpha input
327
+ if ( material . transparent || material . alphaTest > 0.0 ) {
328
+ inputs . push ( `${ pad } float inputs:opacity.connect = </Materials/Material_${ material . id } /Texture_${ material . map . id } _diffuse.outputs:a>` ) ;
329
+ }
330
+
331
+ // Check if alpha test is bigger than minimum of 0.01, if not and it is transparent still apply a 0.01 alpha clip in order to remove white blur in transparent place.
332
+ if ( material . alphaTest > 0.01 ) {
333
+ inputs . push ( `${ pad } float inputs:opacityThreshold = ${ material . alphaTest } ` ) ;
334
+ }
335
+ else if ( material . transparent || material . alphaTest > 0.0 ) {
336
+ inputs . push ( `${ pad } float inputs:opacityThreshold = 0.01` ) ;
337
+ }
338
+
326
339
samplers . push ( this . buildTexture ( material , material . map , 'diffuse' , material . color ) )
327
340
} else {
328
341
inputs . push ( `${ pad } color3f inputs:diffuseColor = ${ this . buildColor ( material . color ) } ` )
@@ -412,6 +425,7 @@ ${samplers.join('\n')}
412
425
413
426
this . textures [ id ] = texture
414
427
428
+ // Add the alpha output for when transparency is set or the alpha test is above 0
415
429
return `
416
430
def Shader "Transform2d_${ mapType } " (
417
431
sdrMetadata = {
@@ -436,6 +450,7 @@ ${samplers.join('\n')}
436
450
float outputs:g
437
451
float outputs:b
438
452
float3 outputs:rgb
453
+ ${ material . transparent || material . alphaTest > 0.0 ? 'float outputs:a' : '' }
439
454
}`
440
455
}
441
456
You can’t perform that action at this time.
0 commit comments