peter_spy 1602 Posted September 24, 2018 Report Share Posted September 24, 2018 (edited) As per Duzenko's request here: http://forums.thedarkmod.com/topic/19650-glsl-custom-shaders-a-mapper-wanted/page-2?do=findComment&comment=427749 Currently we can't use bloom with lights as efficiently as in other engines. Blend add mode, along with emissive texture does not allow the light to be bigger than actual bounds of a model, even with high bloom intensity settings. Example: Now in other non-PBR engines like UDK, you have Emissive slot in your material definition, and you can use that texture with multiply operation to achieve this effect: In TDM, you have to fake this effect with transparent particle, which takes more time to make, adds resources and needs more processing power. It would be great to have this effect only through post processing, as in image above. Edited September 24, 2018 by Judith Quote Misc. assets for TDM Link to post Share on other sites
duzenko 659 Posted September 24, 2018 Report Share Posted September 24, 2018 I have no experience with UDK or other engines.Can you tell me more about the desired effect?What gets multiplied by what? Quote Link to post Share on other sites
peter_spy 1602 Posted September 24, 2018 Author Report Share Posted September 24, 2018 This is the diffuse texture of this lamp. It's unwrapped and the largest brown rectangle is the lightbulb part (unlit): This is emissive texture for this material: Now in order to get that glow I had to use the multiply (math operation) on that texture, and plug it in the material emissive slot. In UDK material editor it looks like this: So in idtech4 material syntax it might look like this: (...)qer_editorimage textures/cor_lamp01_dbumpmap textures/cor_lamp01_ndiffusemap textures/cor_lamp01_demissivemap textures/cor_lamp01_em(...) Or to be precise: { blend emissivemap map textures/cor_lamp01_em rgb 7} Quote Misc. assets for TDM Link to post Share on other sites
duzenko 659 Posted September 24, 2018 Report Share Posted September 24, 2018 UmmSo how is it different to e.g. regular material with the same "rgb 7"? Quote Link to post Share on other sites
peter_spy 1602 Posted September 24, 2018 Author Report Share Posted September 24, 2018 (edited) In the UDK example, the glow goes beyond model boundaries. In idtech4 the lightbulb just goes white, there's no bigger glow. Edited September 24, 2018 by Judith Quote Misc. assets for TDM Link to post Share on other sites
duzenko 659 Posted September 24, 2018 Report Share Posted September 24, 2018 In the UDK example, the glow goes beyond model boundaries. In idtech4 the lightbulb just goes white, there's no bigger glow.So what are the rules for going beyond?Radius, opacity, etc.And why the multiply? What is multiplied to what? Quote Link to post Share on other sites
peter_spy 1602 Posted September 24, 2018 Author Report Share Posted September 24, 2018 Not sure what you mean. All I know that in UDK higher RGB value of emissive texture allows the light to glow beyond the volume of the model. In idtech4 you can't do that, even if you have something like this in your material: { blend add map textures/cor_lamp01_em rgb 7 } The result is as in the first screen, first post. Quote Misc. assets for TDM Link to post Share on other sites
HMart 334 Posted September 24, 2018 Report Share Posted September 24, 2018 That bigger glow can be faked using the idtech 4 "flare" material, but is really not a post process Bloom shader like UDK is just a material trick, there's many different types of flares materials in Doom 3 because of that. Here is a example textures/sfx/flare2 { noshadows translucent nonsolid deform flare ( 16 + parm4 ) qer_editorimage textures/editor/flare.tga { blend add map _quadratic colored vertexcolor } } Almost all Doom 3 flares have "_quadratic" has the map, so that must be important for the desired effect. Quote Link to post Share on other sites
VanishedOne 546 Posted September 24, 2018 Report Share Posted September 24, 2018 (edited) Yes, I was about to post about deform flare too. The main limitation with that is that only rectangular surfaces can be transformed into flares. Edit: _quadratic gives a nice effect, but it isn't an absolute requirement. I used a couple of flare materials in In The Black, and one uses textures/darkmod/sfx/candleglow.tga instead. Edited September 24, 2018 by VanishedOne Quote Some things I'm repeatedly thinking about... - louder scream when you're dying Link to post Share on other sites
peter_spy 1602 Posted September 24, 2018 Author Report Share Posted September 24, 2018 But that's adding another texture and material, which should not be necessary. We already have particles for that, but that's not optimal solution. The point of this thread is to save on additional model, texture, and material drawcalls. Quote Misc. assets for TDM Link to post Share on other sites
duzenko 659 Posted September 24, 2018 Report Share Posted September 24, 2018 How about making flare to apply to a single stage as well as the entire material? Probably not such a good idea.How about creating a custom shader for this? Quote Link to post Share on other sites
VanishedOne 546 Posted September 24, 2018 Report Share Posted September 24, 2018 Is there anything relevant in this (from the olden days of 2004) or is that a different topic? https://www.gamasutra.com/view/feature/2107/realtime_glow.php Quote Some things I'm repeatedly thinking about... - louder scream when you're dying Link to post Share on other sites
peter_spy 1602 Posted September 24, 2018 Author Report Share Posted September 24, 2018 How about creating a custom shader for this? That might the best solution. Also, I've found this video on Storm Engine 2 (Doom 3 BFG fork, AFAIR), they seem to have this kind of bloom: https://youtu.be/0r-SOxXFM3c?t=11m2s Quote Misc. assets for TDM Link to post Share on other sites
duzenko 659 Posted September 24, 2018 Report Share Posted September 24, 2018 Can we have a test map for this? Quote Link to post Share on other sites
HMart 334 Posted September 25, 2018 Report Share Posted September 25, 2018 That might the best solution. Also, I've found this video on Storm Engine 2 (Doom 3 BFG fork, AFAIR), they seem to have this kind of bloom: https://youtu.be/0r-SOxXFM3c?t=11m2s Yes a shader is a good idea, making a post process Bloom shader seems the best bet, in that way level designers don't need to make special geometry or materials for it, just make the texture bright and the Bloom shader does the rest. https://learnopengl.com/Advanced-Lighting/Bloom About Storm Engine 2, is based on RBDoom3 BFG so supports full 64 bits HDR lighting and its Bloom features, TDM on the other end is based on the original idtech 4 engine so can't do the same things, but now that custom shaders are possible a HDR (faked) shader is not out of the question... ;P But duzenko already has other shaders to worry about, better not pestering him with many shader requests. ;D Quote Link to post Share on other sites
Obsttorte 1505 Posted September 25, 2018 Report Share Posted September 25, 2018 That bigger glow can be faked using the idtech 4 "flare" material, but is really not a post process Bloom shader like UDK is just a material trick, there's many different types of flares materials in Doom 3 because of that. Here is a example textures/sfx/flare2 { noshadows translucent nonsolid deform flare ( 16 + parm4 ) qer_editorimage textures/editor/flare.tga { blend add map _quadratic colored vertexcolor } } Almost all Doom 3 flares have "_quadratic" has the map, so that must be important for the desired effect. I don't think so. To me it appears that deform is the most important part that causes the effect. See here (search for deforms)For flare it states Build a translucent border that's always facing the viewer. This only works on quads (surfaces with 4 vertices). Used to make lens flares around lights.The parameter afterwards specifies the size. 2 Quote FM's: Builder Roads, Old Habits, Old Habits Rebuild Mapping and Scripting: Apples and Peaches Sculptris Models and Tutorials: Obsttortes Models My wiki articles: Obstipedia Texture Blending in DR: DR ASE Blend Exporter Link to post Share on other sites
peter_spy 1602 Posted September 25, 2018 Author Report Share Posted September 25, 2018 Can we have a test map for this? There you go: https://we.tl/t-iI9XF5mvGj The map contains a simple room with two lamps, one model uses material with white emissive, the other uses orange one. 2 Quote Misc. assets for TDM Link to post Share on other sites
HMart 334 Posted September 25, 2018 Report Share Posted September 25, 2018 I don't think so. To me it appears that deform is the most important part that causes the effect. See here (search for deforms)For flare it states The parameter afterwards specifies the size. Yes deform flare is the most important part and a requirement for the effect, and i know that the parameter afterwards specifies the flare size, i only refereed about _quadratic because even tho some don't use this keyword has a map, the majority of the Doom 3 flare materials do, so to me it indicated that was a important part in the overall look of the effect but not a required one. Quote Link to post Share on other sites
Spooks 703 Posted September 25, 2018 Report Share Posted September 25, 2018 (edited) Flares are sprites/billboards, emissive materials are indeed shader driven. The deform keywords are simply used to always make the texture face the viewer without having it be a decal in-editor (at least IIRC). I've never worked with UDK but I recall that Dishonored had volumetric looking glow for their hanging lamps that doesn't suffer the same problems as our glare particles. It might just be a nodraw model with an emissive material glow to fake volume. Tricks like this are what this would be most useful for, as our post processing already does a good enough job with bloom, esp. on 2.06. Emissive maps ought to be grayscale bitmaps with the shader handling them having some parameters like the spread of the glow (i'm thinking photoshop 'spread') and a strength value that doesn't modify the grayscale values of the map itself, so it won't just act like a Levels filter. e: yes, yes, Judith mentioned one of the test lamps had an orange emissive map, they should have some way to be colored, of course. Is allowing RGB images the best approach? That is a lot of data, but I suppose that can give you the most control (over tinting it in the material) if you're working on a set-piece model for something pagan, perhaps, so I correct myself on the grayscale part. Edited September 25, 2018 by Spooks Quote My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM! Link to post Share on other sites
nbohr1more 2160 Posted September 25, 2018 Report Share Posted September 25, 2018 Here's a very old example of volumetric lighting: http://www.humus.name/index.php?page=3D&ID=36 1 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 post Share on other sites
peter_spy 1602 Posted September 25, 2018 Author Report Share Posted September 25, 2018 Emissive maps can be RGB, both in idtech4 and UDK. But somehow idtech4 clamps these multiplied RGB values, while UDK uses them to blur the glow so it's around the model. Maybe it's what HMart says, the problem of the range and how idtech4 and Storm Engine 2 treats HDR. Can the SE2 code be of any help here? Quote Misc. assets for TDM Link to post Share on other sites
duzenko 659 Posted September 25, 2018 Report Share Posted September 25, 2018 Looking at the engine I can see one problem with this.Every surface we draw ATM can be either solid, or translucent.The solid surfaces must always pass the equal depth test. The translucent surfaces never write to depth and must pass the "less than" depth test.Now the problem here is the engine forces the same equal/less depth test for all stages on a material. So we can either write to depth or post-process.https://github.com/duzenko/darkmod-experiments/blob/e4f05ec7b92f103d0e1632c5ab3f2fd238090f9a/renderer/Material.cpp#L2283Understandably, this lock would have to be broken to go forward with the emission material.I don't know if it this lock has been there since 2004 or it was added by someone from TDM. I'm not sure if it's time to break it now or not.Now, can't we achieve the same halo effect with a fog light? BTW please create a separate thread for volumetric lighting ( I can get sidetracked easily ) unless volumetric lighting and halos are the same thing. Quote Link to post Share on other sites
peter_spy 1602 Posted September 25, 2018 Author Report Share Posted September 25, 2018 I think this is a postprocess issue, i.e. you can't get that bloom effect in UDK with postprocessing set to off. Since 2.07 is designed as stability release, this feature can easily wait until 2.08 or further. Quote Misc. assets for TDM Link to post Share on other sites
duzenko 659 Posted September 25, 2018 Report Share Posted September 25, 2018 So, the halo materials went to the dusty closet.Now the volumetric lights.Practically we could start with a simple spherical highlight based on the @nbohr1more's link above.We only need to add a new parameter to the light material (you decide on the name). @Judith, can you update the test map to have custom light materials? 1 Quote Link to post Share on other sites
peter_spy 1602 Posted September 25, 2018 Author Report Share Posted September 25, 2018 Sure, will simple material be enough? lights/glowtest/lamp01{ { forceHighQuality map lights/falloff_exp2 colored zeroClamp }} Here's the file: https://we.tl/t-FdhXMxAaRX Btw. AFAIK, volumetric lights are not cheap, performance-wise. It's a pity proper bloom is such a problem, as it's just a postprocess effect, and it's pretty cheap. Current solution with separate transparent texture and particle isn't cheap either. Quote Misc. assets for TDM Link to post Share on other sites
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.