AB4D Forum
PhysicallyBasedMaterial with Transparency - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.DXEngine (https://forum.ab4d.com/forumdisplay.php?fid=11)
+--- Thread: PhysicallyBasedMaterial with Transparency (/showthread.php?tid=4188)



PhysicallyBasedMaterial with Transparency - Alex3d - 04-12-2020

I try the demo of DxEngine for rendering PhysicallyBasedMaterial with Transparency.
But adding an opacity file doesn't affect to result.


Code:
shaderResourceView = Ab3d.DirectX.TextureLoader.LoadShaderResourceView(device, oneFileName);
var texture = new TextureMapInfo(textureType, shaderResourceView, null, oneFileName);
physicallyBasedMaterial.TextureMaps.Add(texture);

Thanks for your support.

[attachment=159]

[attachment=158]


RE: PhysicallyBasedMaterial with Transparency - abenedik - 04-14-2020

To use transparent textures you only need to set the HasTransparency to true:
physicallyBasedMaterial.HasTransparency = true;

This will use the alpha blending.

In the next version of the Ab3d.DXEngine the LoadShaderResourceView method will be updated so it will also get the hasTransparency parameter based on the loaded image.


RE: PhysicallyBasedMaterial with Transparency - Alex3d - 04-14-2020

(04-14-2020, 10:14 AM)abenedik Wrote: To use transparent textures you only need to set the HasTransparency to true:
physicallyBasedMaterial.HasTransparency = true;

HasTransparency already is set to true.
This doesn't help


RE: PhysicallyBasedMaterial with Transparency - abenedik - 04-14-2020

I understand now - you wanted to provide a texture that would represent transparency.

This is not supported by the PBR shader in DXEngine.
If you check the description of the Transparency value in the TextureMapTypes enum, you will see that it is written as: "Transparency (not supported)". It is there if you would use that enum for your own shader.

So to use the transparency in the PBR, you will need to bake it into the base color texture's alpha channel (and also have the HasTransparency set to true).


RE: PhysicallyBasedMaterial with Transparency - Alex3d - 04-14-2020

Great!
Thank you!