Team Spartan Cookies & Milk Forums
Clarification about textures & materials - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Clarification about textures & materials (/thread-3781.html)



Clarification about textures & materials - The17thDoctor - 26-04-2023

When I'm creating special effects, I really enjoy browsing the tons of materials and textures available (using mat_texture_list 1) but I'm quite confused as there's a ton of them that will simply not render.

Is there any "rule" that could tell if a certain texture / material can or cant be used with SF ?


RE: Clarification about textures & materials - Person8880 - 27-04-2023

If you're trying to set the material on an entity, then it has to be in the material tool whitelist. Otherwise, as long as it's not using a light map shader then it won't be directly blocked. However, that doesn't mean it will render correctly.

Do you have an example of a material you think should work but doesn't, and the code you're trying to use to render it?


RE: Clarification about textures & materials - The17thDoctor - 27-04-2023

(27-04-2023, 04:51 PM)Person8880 Wrote: If you're trying to set the material on an entity, then it has to be in the material tool whitelist. Otherwise, as long as it's not using a light map shader then it won't be directly blocked. However, that doesn't mean it will render correctly.

Do you have an example of a material you think should work but doesn't, and the code you're trying to use to render it?

Well actually I was curious about whether lua-generated textures (such as the ones for the spore drive) are usable or not.
I've tried to use them in the past but to no avail. Although I guess its not really meant to be used anyway.


RE: Clarification about textures & materials - Person8880 - 27-04-2023

Ah, yes. Lua generated materials are also not exposed as they're not guaranteed to have a consistent name, and ultimately they're an internal detail of various entities.


RE: Clarification about textures & materials - The17thDoctor - 27-04-2023

I also thought about :
Would there be a way to use all sorts of animated textures ? So far unless there is a material using the texture's animation, you cannot have it be animated (for instance sprites/physbeam )


RE: Clarification about textures & materials - Person8880 - 29-04-2023

Animations are defined by textures, not materials. Any material using an animated texture will cycle through the frames in the texture. The physbeam texture doesn't have any animation frames.


RE: Clarification about textures & materials - The17thDoctor - 29-04-2023

Well I'm confused then, when looking at sprites/physbeam using the mat_texture_list 1 command, you can see that the texture has an animation.


RE: Clarification about textures & materials - Person8880 - 29-04-2023

Looks like GMod overrides the material for sprites/physbeam to use a static texture, whereas the Half-Life 2 texture is indeed animated. If you ask for sprites/physbeam, it's resolving the material, not the texture, hence why it's static.

If you want the animated variant, use the trails/physbeam material instead.

Edit: Actually, it turns out there is a material-level setting needed to get animations to play (specifically, it needs the "AnimatedTexture" proxy). I didn't find this when searching the Valve wiki originally. Looks like none of the materials that use the physbeam texture have this proxy so it's never animated (not even the original Half-Life 2 material). I'd assume the texture list UI is using knowledge of the VTF file to render its animation frames, which isn't something that's exposed to Lua (can only see the number of frames on a texture, but textures can only be retrieved from materials, not file paths).

Thus the only way to get this to be animated would be to generate a new material for it with the animated texture proxy, which isn't exposed to SF.


RE: Clarification about textures & materials - Person8880 - 29-04-2023

I've added some functions that allow for manual alterations to the texture frame of the currently set material (both 2D and 3D). See the changelog for details.


RE: Clarification about textures & materials - The17thDoctor - 30-04-2023

Thanks o7