violgamba Posted May 24, 2024 (edited) I need to be able to modify parameters for a shader on a particular actor and/or sprite. Minimally, I need to enable/disable a shader at runtime, but if I can control it else-ways then I can simply have the shader bypass its effect when "disabled". The only information I've found regarding shader control has focused on post-processing shaders. What I've got is a "HardwareShader Sprite" gldef entry, which attaches the shader to a particular sprite. FYI, what I'm trying to do is to implement a hover-highlight effect on certain kinds of Actors. At worst, I can just add a "HardwareShader Sprite" gldefs entry for every sprite used by these Actors, but really I need to be able to toggle the shaders for this to work. I've tried highlighting the hovered Actor by pulsing its alpha, but while this works it really doesn't look good. Anybody know of a way to toggle a sprite shader? FYI, I am comfortable with ZScript. Edited May 28, 2024 by violgamba 0 Quote Share this post Link to post
kalensar Posted May 26, 2024 Oh man thats a rough one, no lie. So this type of action should be able to get handled with a function Similar to A_AttachLight and the trigger just depends on what you want to trigger the Function during a specific State of the actor entering or exiting. Best I can do is give you an example with no guarantee of it working. 1. Gldef file ------Define Hardware Shader Spoiler HardwareShader [Type] <LumpName> { Shader "<File>" } HardwareShader Sprite TROSA { Materials/Specualar/SpecualarImp.txt } --- Make a separate actor or copy the graphic/lump you want to attach the shader to that uses a different lump name EX: TROOa and TROSA where they are both the same actual graphic as TROOa (being Doom IMp frame A in this example) --- Then you need to write the action frames of the Actor to get the effect you are wanting to achieve EX: In the this case the Shader Sprite would hopefully be called during the "Spawn" State loop and any other time it calls the TROSA frame. Spoiler Actor Dumymp : DoomImp replaces DoomImp { States { Spawn: TROO A 2 A_look TROS A 2 A_Look // THis frame being the applied shader frame Loop } } 0 Quote Share this post Link to post
violgamba Posted May 28, 2024 (edited) Thanks for this suggestion, Kalensar. It seems like the best way to go, given the current interface. I can write a script to take a list of images that need to be highlighted, which duplicates each image (for the highlighted version) and generates a GLDEFS file for all images and their highlighted counterparts. FYI, I've coded a feature for GZDoom that addresses my issue and am hoping for feedback before I post a pull-request for it. I've added it to the ZDoom forums here. If you, Kalensar, or anyone else is interested in giving feedback or just a thumbs up, please check it out. Edited May 28, 2024 by violgamba 1 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.