Bikerdude Posted September 6, 2015 Report Share Posted September 6, 2015 Eleven years working on this mod and I still don't understand shaderparms.You, me and a lot of other people. I would hazzard a guess and say that this is one of the few wholy under used features of the engine. Quote Link to comment Share on other sites More sharing options...
VanishedOne Posted September 6, 2015 Report Share Posted September 6, 2015 (edited) Especially the way they interact with lookup tables. https://www.iddevnet.com/doom3/materials.phpintroduces tables by saying, 'In Quake3, you could do all kinds of neat things with sin waves, saw tooth waves, square waves and other types of waves'--but doesn't say what they are. (Edit: by the second 'they' I mean the neat things in all their kinds, not the wave types.) Edited September 6, 2015 by VanishedOne Quote Some things I'm repeatedly thinking about... - louder scream when you're dying Link to comment Share on other sites More sharing options...
rich_is_bored Posted September 6, 2015 Report Share Posted September 6, 2015 ShaderParms, tables, and a handfull of internal variables are used in mathematical expressions. Anywhere in a material shader where a numerical value is used, you can usually substitute it with an expression. Because expressions are evaluated every frame it means you have the ability to animate some aspects of materials. time: Forever increasing floating point value that returns the current time in secondsparm0-parm11: Parameters that can be set a number of ways (discussed above)global0-global7: Not used right nowfragmentPrograms: Constant that is 1 if ARB fragment programs are available. This is mostly used for disabling a stage by specifying "if ( fragmentPrograms == 1 )"sound: The current sound amplitude of the entity using this material. This is used to create light materials that pulse with the sound. A cursory look over the material keywords that accept numerical values will give you an idea of what can be animated. A few examples of properties you could animate would be rotation, scale, translation, shear, brightness, and transparency. Time is used in virtually every expression. It's similar to a frame counter. It starts at zero and increments. Still with me? Good. Here's where we test what you've learned. Here's a stage with an expression... { translate time, time map textures/custom/foo.tga }What's this doing? Remember, time starts at zero. Then it's one. Then two, three, four, and so on. If you said scroll the texture horizontally and vertically you'd be correct. Okay. One more example that's a bit more difficult. { translate time * 0.1, time * 2 map textures/custom/foo.tga } If you said scroll the texture slowly on the horizontal, and fast on the vertical you'd be correct. It helps a great deal if you have a mathematical mind, are familiar with operators like modulo (%), and can graph functions. It's algebra and you're solving for x. Tables are just that. Tables with values in them. table myNumbers {0.5, 1, 0.5, 1, 0.6, 1, 0.5, 0.8, 0.5, 1, 0.5, 0.6 }You might use these values to make something flicker... { rgb myNumbers[time] map textures/custom/foo.tga }In this case, time is the index. It's asking for the value in position zero. Then one, two, and so on. 1 Quote ModWiki Link to comment Share on other sites More sharing options...
VanishedOne Posted September 6, 2015 Report Share Posted September 6, 2015 table myNumbers {0.5, 1, 0.5, 1, 0.6, 1, 0.5, 0.8, 0.5, 1, 0.5, 0.6 } table myNumbers {{0.5, 1, 0.5, 1, 0.6, 1, 0.5, 0.8, 0.5, 1, 0.5, 0.6 }} Quote Some things I'm repeatedly thinking about... - louder scream when you're dying Link to comment Share on other sites More sharing options...
Springheel Posted September 7, 2015 Report Share Posted September 7, 2015 It helps a great deal if you have a mathematical mind I definitely do not. But I do understand most of what you posted already...just not how shaderparms fit into that. Are they just floating values that can be added to an entity by a spawnarg somehow? Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps Link to comment Share on other sites More sharing options...
rich_is_bored Posted September 7, 2015 Report Share Posted September 7, 2015 It's another set of parameters you can use in your expressions. The difference being that these parameters are set at the entity level. For example, say you have two lights that pulse using the same material shader. If "time" is the only parameter you're using to control the effect, then all lights using that shader will pulse in sync. Maybe you don't want that. So you use a shaderparm to act as an offset. Maybe the original expression looks kinda like this... sinTable[time * 0.01]You'd modify it like this... sinTable[(time + parm1) * 0.01]And now in DR you can simply add a parm1 key/value pair to every light using this material to change it's offset. 1 Quote ModWiki Link to comment Share on other sites More sharing options...
grayman Posted September 7, 2015 Report Share Posted September 7, 2015 While the syntax in the material shader is 'parmN', the syntax for the matching entity spawnarg is 'shaderparmN'. Quote Link to comment Share on other sites More sharing options...
Nico A. Posted September 7, 2015 Report Share Posted September 7, 2015 Just to check, though: are you looking at the inherited spawnargs list, and still seeing the old setting greyed out? No, it changes to black (as it should I guess). I haven't noticed that problem, but I always hit Enter to set a spawnarg. You can see whether it's changed if you look at the panel above (you might need to turn off inherited spawnargs). Maybe that was the problem. I always looked at the gray value and it didn't seem to change... Thanks! Quote Link to comment Share on other sites More sharing options...
VanishedOne Posted September 7, 2015 Report Share Posted September 7, 2015 Shaderparms can also be used conditionally, as in this example from id's page: models/weapons/soulcube/soulcube3fx { noSelfShadow translucent noShadows { if ( parm7 > 3 ) blend add map models/weapons/soulcube/soulcube3fx rgb scTable[ time * .5 ] } } The entire blend add stage gets drawn or not drawn depending on the current value of parm7. Quote Some things I'm repeatedly thinking about... - louder scream when you're dying Link to comment Share on other sites More sharing options...
Springheel Posted September 7, 2015 Report Share Posted September 7, 2015 It's another set of parameters you can use in your expressions. The difference being that these parameters are set at the entity level. For example, say you have two lights that pulse using the same material shader. If "time" is the only parameter you're using to control the effect, then all lights using that shader will pulse in sync. Maybe you don't want that. So you use a shaderparm to act as an offset. Maybe the original expression looks kinda like this... sinTable[time * 0.01]You'd modify it like this...sinTable[(time + parm1) * 0.01]And now in DR you can simply add a parm1 key/value pair to every light using this material to change it's offset.That's helpful, thanks. Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps Link to comment Share on other sites More sharing options...
Netos Posted September 7, 2015 Report Share Posted September 7, 2015 Hello, I am back with another mapping question:I made some readables, but I want some of them not to be frobable (for instance, on a bulletin board, the player should be able to read 2 of them, not all 10). How do I accomplish this? (I tried using 'frobable 0' but that makes the readable blank) Quote Link to comment Share on other sites More sharing options...
grayman Posted September 7, 2015 Report Share Posted September 7, 2015 I never noticed this before, but you're right. Apparently being frobable tells the renderer to paint the text even when the readable isn't highlighted. Not frobable = no text painting. Since the renderer will paint the text even when the readable isn't highlighted, there's nothing that forces the player to frob the readable in order to read the text. He could just stand there and read it. Is that unacceptable? Quote Link to comment Share on other sites More sharing options...
Springheel Posted September 7, 2015 Report Share Posted September 7, 2015 Since the renderer will paint the text even when the readable isn't highlighted, there's nothing that forces the player to frob the readable in order to read the text. He could just stand there and read it. That's the way it is designed to work. The play can potentially use the spyglass to read things from a distance. I think what he's trying to do is make a readable that can ONLY be read from a distance, not frobbed and read close-up. Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps Link to comment Share on other sites More sharing options...
grayman Posted September 7, 2015 Report Share Posted September 7, 2015 I think what he's trying to do is make a readable that can ONLY be read from a distance, not frobbed and read close-up. Correct. But even if it's frobable, and lights up when the player is near it, it's still readable w/o the player actually frobbing it. I guess we need to hear why this isn't acceptable. Quote Link to comment Share on other sites More sharing options...
VanishedOne Posted September 7, 2015 Report Share Posted September 7, 2015 Do you get the same behaviour from the readables/sign_text_decals prefabs? Quote Some things I'm repeatedly thinking about... - louder scream when you're dying Link to comment Share on other sites More sharing options...
grayman Posted September 7, 2015 Report Share Posted September 7, 2015 Rather than creating a readable, you can use this method to create text of any size on any background. Place a model sheet of paper on a wall, and create the text gui and place it right up against the paper. You'll be able to read the text w/o anything being frobable. Quote Link to comment Share on other sites More sharing options...
Netos Posted September 7, 2015 Report Share Posted September 7, 2015 Thanks for the answers, I will use decals for signs, as well as for unimportant notes that are not meant to be frobable. Quote Link to comment Share on other sites More sharing options...
VanishedOne Posted September 13, 2015 Report Share Posted September 13, 2015 From left to right: what I drew in Krita, what I see after saving as TGA and loading in IrfanView, and what I see when loading the TGA in an in-game GUI.I can fix the brightness in IrfanView, but is there anything that can be done about the colour banding in the right-hand image? Quote Some things I'm repeatedly thinking about... - louder scream when you're dying Link to comment Share on other sites More sharing options...
SteveL Posted September 13, 2015 Report Share Posted September 13, 2015 On my monitor, there's banding in the original too. Less visible than in #3, but that could be due to the brightness difference. Subtle colour gradients don't look good brightened. #2 looks like the bands have been hidden by oversaturation. The gradient has been lost too, but that could just be in the screenshot given that some detail is back in #3 -- hard to tell without seeing what #3 looks like when the brightness is lowered again. You can tweak the rgb channels in the material shader. Quote Link to comment Share on other sites More sharing options...
SteveL Posted September 19, 2015 Report Share Posted September 19, 2015 Does anyone know a way to force textures to be opaque in DR? The "forceOpaque" keyword is used by dmap, but it seems it doesn't work in DR. I tried changing portalsky to be a blended material to fix a problem with it drawing over lit decals, but now it's semi-transparent in DR which might drive people nuts. Quote Link to comment Share on other sites More sharing options...
Springheel Posted September 19, 2015 Report Share Posted September 19, 2015 now it's semi-transparent in DR which might drive people nuts. I noticed and I'm not a fan. Not sure how DR handles it though. Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps Link to comment Share on other sites More sharing options...
nbohr1more Posted September 19, 2015 Report Share Posted September 19, 2015 Is the editor image transparent? Maybe just pointing at another one in the material def will resolve that? Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...) Link to comment Share on other sites More sharing options...
SteveL Posted September 19, 2015 Report Share Posted September 19, 2015 The editor image is opaque (well, a normal image), but DR is rendering it 50% transparent presumably because its only diffuse stage is a blend stage. I could try hacking it around, but I wondered if there was an editor_ keyword or some other good way to fix it. Quote Link to comment Share on other sites More sharing options...
Goldwell Posted September 27, 2015 Report Share Posted September 27, 2015 Does anyone know of an FM that has water flow? i'm trying to get it to work myself but it just doesn't work.. I've created the func_forceshield as per the wikis recommendation but it just doesn't flow... as soon as the player hits the water flow it just slowly moves them. Thanks! Quote Shadows of Northdale Campaign ACT I: A Curious Mind | ACT II: Down The Rabbit Hole Stand Alone Missions Accountant 1: Thieves and Heirs | Accountant 2: New In town | Spring Cleaning | Lord Edgar's Bathhouse | Snowed Inn | Noble Affairs Link to comment Share on other sites More sharing options...
Bikerdude Posted September 27, 2015 Report Share Posted September 27, 2015 Does anyone know of an FM that has water flow?Yes, Arcturus made a demo map and I have a copy. I never got around to learning how it worked so I could implement it in a map etc. I've included a copy of the famous grass map with the fish in the pond. - - mega Quote Link to comment Share on other sites More sharing options...
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.