DeusXIncognita Posted April 29, 2015 Report Posted April 29, 2015 (edited) (I am not sure the Thread is right here, if somewhere else is better, please move it) I try to fit a laboratory, and when using the glass laboratory equipment (The flasks) I noticed they glow even when in the dark (noticed that in other missions too). I tried to make a crude model with patches myself, and found that all simple glass textures glow from itself too. The glass windows don't glow itself, and one of them looks pretty interesting for a glass container(textures/darkmod/glass/stained_glass_clear_2sided). I am still looking for other non glowing glass though.Are there any simple glass textures that don't glow, that I might have missed? If not, can someone nudge me in a direction where I could learn to manipulate a glass texture? Edited April 29, 2015 by DeusXIncognita Quote
Dunedain19 Posted April 29, 2015 Report Posted April 29, 2015 (edited) I'm not sure if this will help you, but in my WIP I was looking for a way to make the glass windows mimic the colour of the night sky so that they didn't appear 'white' (the 'glow' effect, if I'm understanding your post correctly). For my windows (as seen on page 252 in the 'So what are you working on right now?' thread) I used the texture textures/darkmod/glass/colored. To get this work properly, it is crucial that you convert the window pane to a func_static and then attach the spawnarg '_colour' to it. From there, select the colour you desire and the 'glow' effect should vanish - at least in my case it solved the problem. I hope this helps! Edited April 29, 2015 by Dunedain19 1 Quote
DeusXIncognita Posted April 29, 2015 Author Report Posted April 29, 2015 [...]For my windows (as seen on page 252 in the 'So what are you working on right now?' thread) I used the texture textures/darkmod/glass/colored. To get this work properly, it is crucial that you convert the window pane to a func_static and then attach the spawnarg '_colour' to it. From there, select the colour you desire and the 'glow' effect should vanish - at least in my case it solved the problem. I hope this helps!Thanks, its not exactly what I am looking for, but definitly a step in the right direction. (After I found out that the colors are fractions of 1, was a bit weird when i tried to put in the spawnarg manually and all looked the same (150 50 50 is still full white with this one cause its over 1 - [it was _color actually]). Surely helps with quite a few effects I could want to achieve, so its very useful knowledge, thanks. Quote
DeusXIncognita Posted April 29, 2015 Author Report Posted April 29, 2015 (edited) I just found out that the problem I have isn't directly related to the texture.When using the textures on a flat surface, they look pretty good. It starts when using it on a flask, that goes all round, that it starts to really light itself.I had no idea that could happen, and hadn't used glass on flat surfaces before, and so hadn't noticed it. Still interesting that there are textures where it doesn't happen.If I find out anything more I will post it here. [if someone can adapt the Title (If i can do it myself i haven't found it) to something like: "Looking for glass that doesn't self light on a flask", it would be nice] Edited April 29, 2015 by DeusXIncognita Quote
nbohr1more Posted April 29, 2015 Report Posted April 29, 2015 Try the material that's used for the glass in the hourglass model. 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...)
SteveL Posted April 29, 2015 Report Posted April 29, 2015 What texture are you using exactly? I mean the one that's glowing on the flask but not on a flat patch.A good trick with most glass materials is to make your own version of the material def (renaming the material) and change the line "blend add" (which gives the default lit glass) to "blend blend" (which will make for fairly clean looking glass) or "blend filter" (which will make dark, dirty looking glass). You can tweak the color and brightness and transparency using other settings in the same place. I did some experiments on this a year ago... I'll try to find my test map. 1 Quote
DeusXIncognita Posted April 29, 2015 Author Report Posted April 29, 2015 Try the material that's used for the glass in the hourglass model.Thank, that looks quite well - have to look up how I can get "into" the model to find out what it is though.What texture are you using exactly? I mean the one that's glowing on the flask but not on a flat patch.I was using / testing all, for example clear, clear_warp, hazy_warp, milky, milky_warp, stained_glass_clear_2sided.All did glow more or less, but the ones for stained glass windows, all of those didn't glow. stained_glass_clear_2sided makes a really interesting looking flask, sadly if I try to put some "liquid" (just a colored patch inside it) in it, it gets distorted very much.A good trick with most glass materials is to make your own version of the material def (renaming the material) and change the line "blend add" (which gives the default lit glass) to "blend blend" (which will make for fairly clean looking glass) or "blend filter" (which will make dark, dirty looking glass).Thanks, I will try that as soon as I am sure enough on how to do it (I did look at it already, compared different definitions, etc.) without breaking anything.Its quite interesting working out how all that works.You can tweak the color and brightness and transparency using other settings in the same place. I did some experiments on this a year ago... I'll try to find my test map.Would be nice and interesting to see that.I just found out, that I can use the _color spawnarg on most glasses, so many glasses can be made to look darker - with that they also don't glow as much when made into a flask. Combining warp and other textures slowly advances near a good effect (for me). Quote
SteveL Posted April 29, 2015 Report Posted April 29, 2015 (edited) Oops, I see now looking at it again that I misremembered the setup slightly. Most of the textures in tdm_glass.mtr don't use "blend add", they use "blend gl_dst_color, gl_one" in the place I was thinking about.You can still try the alternative settings I mentioned in place of that line. "blend gl_dst_color, gl_one" is in between "blend add" (bright glow) and "blend blend" (clear glass, neither glowing nor dark) on the scale.You can also tweak the brightness using the "_color" spawnarg on your entity -- try starting with 0.1 0.1 0.1 -- but for full control you can make your own material:If you are using a separate folder for your map in the darkmod/fms folder, create a "materials" folder in there next to your "maps" folderOtherwise, if your map is in the default darkmod/maps folder, create or use the "darkmod/materials" folderCreate a text file in that folder. You can call it anything you like as long as the extension is .mtrThat's where you'll put the material definition that you want to tweak. TDM glass textures are found in tdm_textures_base01.pk4\materials\tdm_glass.mtr, but the easiest way to get at them is to find the material that you want to modify in DR's media browser, right-click and choose "Show shader definition". Select all the text, copy to clipboard, and paste into your empty text file.The first line will read something like "textures/darkmod/glass/hazy_warp". Rename the material by changing the last segment, i.e. something like "textures/darkmod/glass/my_hazy_warp"You now have a texture called "my_hazy_warp" that you'll see in DR alongside the other glass textures, and that you can modify at will. You'll have to either restart DR or reload the materials from the File menu.The section that controls colour in most glass textures looks like this: // now use the alpha mask to add some fake reflections { blend gl_dst_alpha, gl_one maskalpha cubeMap env/gen2 // tone down the reflection a bit red Parm0 * 0.3 green Parm1 * 0.3 blue Parm2 * 0.2 texgen reflect } // add our texture on top { blend gl_dst_color, gl_one map textures/darkmod/glass/crystal_milky red Parm0 * 0.3 green Parm1 * 0.3 blue Parm2 * 0.25 } Each of those two segments contributes to the glow. The first section controls the faked reflections that get added to the glass. You can reduce the brightness EITHER by making the "red green blue" numbers smaller in the material file, or by setting the "_color" shaderparm on your func_static. Whichever option you choose, all the numbers must be in the range 0 (no brightness) to 1 (full brightness). The second section controls the colour of the glass itself. Again you can adjust the brightness by changing the same numbers or by setting the same spawnarg in DR. The ratio of the numbers is what controls the hue. In the example above, it's mostly white but slightly yellowish (more red and green than blue). To turn off the glow though, you'd change the line "blend gl_dst_color, gl_one" That tells the graphics card how to mix the colour of the glass (first parameter, gl_dst_color in this example) and the colour of the scene behind (second parameter, gl_one). "blend add" (bright glow) is short for "blend gl_one, gl_one" which means add the full colour of the glass to the background colour. Take nothing away. So the glass is completely clear (no background colour blocked) and looks lit from inside (it adds it's own colour/light to the scene). "blend blend" is short for "blend gl_src_alpha, gl_one_minus_src_alpha). That's the classic formula for clear glass, where the transparency at each point is controlled by the texture's alpha level. The glass colour (src) uses the alpha channel to say how much it adds. If alpha is 0 (fully transparent) the glass adds no colour, because its colour is multipled by 0. If 1 (fully opaque) the glass adds all its colour. As for the background scene, it's using one minus the alpha, so in the places where the glass is fully opaque, it adds nothing (1 - 1 = 0), and where the glass is fully transparent, its entire colour shows through (1 - 0 = 1). Alpha values between 0 and 1 will mix the two colours together proportionately. "blend filter" is short for "gl_dst_colour, gl_zero", which means the glass colour gets multiplied by the background colour, and then nothing extra gets added from the background in the second step (gl_zero). When you multiply 2 colours together you always get a result that's darker than either, so this makes for a dark looking dirty glass effect, where the glass is taking away brightness from the background. Edited April 29, 2015 by SteveL 1 Quote
SteveL Posted April 29, 2015 Report Posted April 29, 2015 I forgot to mention: you can test your new material in game very easily using TDM in windowed mode. If you change the material file, you don't have to reload your map or TDM. You can just enter "reloaddecls" on the console and it'll make the changes right there and then, so it's quick to try out different numbers while you are tweaking, by alt-tabbing between TDM and your text editor. 1 Quote
DeusXIncognita Posted April 29, 2015 Author Report Posted April 29, 2015 Thanks a lot, these explanations are really helpful. especially the blend types and the tip with "reloaddecls"Guess its experiment time, and being able to see differences at runtime will save a LOT of time. (I was always dmapping to try different textures) Quote
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.