Jump to content

LoadMaterial() vs Creating same material in code


Rick
 Share

Recommended Posts

1. I try to create the material from code (to try and remove an external mat file dependency) but when I do it, it doesn't seem to have transparent BG. (I apply this to a plane created in the transparent world of the framework.

 

My code

mat = CreateMaterial();
SetMaterialKey(mat, "depthtest", "1");
SetMaterialKey(mat, "overlay", "1");
SetMaterialKey(mat, "blend", "alpha");
SetMaterialKey(mat, "zsort", "0");
SetMaterialKey(mat, "castshadows", "0");
SetMaterialKey(mat, "collisiontype", "0");
SetMaterialShader(mat, LoadShader("abstract::mesh_diffuse_billboard.vert","abstract::mesh_diffuse.frag"));

 

Mat File, that when loaded, works perfectly

 

texture0="abstract::nametag.dds"

depthtest=1

overlay=1

blend=alpha

zsort=0

castshadows=0

collisiontype=0

shader="abstract::mesh_diffuse_billboard.vert","abstract::mesh_diffuse.frag"

 

 

 

Note that the texture is just a dummy placeholder as we replace that with a buffer later. So in the mat file above it's really pointless.

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...