Is it possible to draw 3D2D stuff with lighting enabled? using .png materials

Title pretty much explains it. I’m trying to draw a .png texture using 3D2D and it comes up as fullbright.


On the left is a cube that I drew with Material(“testpng.png”,“vertexlitgeneric”) and render.DrawBox().
On the right is a surface.DrawTexturedRect with the same material

So I’m wondering if its possible to have lighting enabled for them so theyre not fullbright? I know that if I create a vmt with vertexlitgeneric and a vtf texture it will work when drawing a cube, but I’m trying to do this with pngs and isn’t the ‘vertexlitgeneric’ pngparameter with the Material function supposed to do the same thing??

Disclaimer: Some of what I’m about to say may be misleading, wrong, or outright bullshit. I would appreciate any and all corrections from more knowledgeable members of the community.

With that out of the way…

Short answer: No.

Long answer: Lighting only works on entities (including clientside entities). What you might be able to do, though I haven’t tested this, is create a clientside entity which is just a textured plane, give it a uniquely-named material with a uniquely-named texture created via GetRenderTarget / GetRenderTargetEx, and draw your stuff onto that texture.

You can of course do the same thing with a box or any shape entity you want - but in both cases, you have to create the models yourself, or find ones that fit your needs (you can apply a material to any model using SetMaterial).

If you need simple geometric shapes, maybe the modeling section will help out.

Ok, thanks for verifying its not possible this way! I actually thought I had to do something like what you suggested, so I’ll look into it.