Jump to content

Recommended Posts

Posted (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:

 

obraz.png

 

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:

obraz.png

 

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 by Judith
Posted

This is the diffuse texture of this lamp. It's unwrapped and the largest brown rectangle is the lightbulb part (unlit):

obraz.png

 

This is emissive texture for this material:

obraz.png

 

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:

obraz.png

 

 

So in idtech4 material syntax it might look like this:

 

(...)

qer_editorimage textures/cor_lamp01_d
bumpmap textures/cor_lamp01_n
diffusemap textures/cor_lamp01_d

emissivemap textures/cor_lamp01_em

(...)

 

Or to be precise:

 

{

blend emissivemap

map textures/cor_lamp01_em

rgb 7

}

Posted (edited)

In the UDK example, the glow goes beyond model boundaries. In idtech4 the lightbulb just goes white, there's no bigger glow.

Edited by Judith
Posted

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?

Posted

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.

Posted

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.

Posted (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 by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Posted

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.

Posted

 

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

Posted

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.

  • Like 2

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

Posted

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.

Posted (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 by Spooks

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

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?

Posted

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#L2283

Understandably, 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.

Posted

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.

Posted

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?

  • Like 1
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • JackFarmer

      "The Year of the Rat." 
      😄

      Al Stewart must be proud of you!
      Happy testing!
      @MirceaKitsune
      · 1 reply
    • datiswous

      I posted about it before, but I think the default tdm logo video looks outdated. For a (i.m.o.) better looking version, you can download the pk4 attached to this post and plonk it in your tdm root folder. Every mission that starts with the tdm logo then starts with the better looking one. Try for example mission COS1 Pearls and Swine.
      tdm_logo_video.pk4
      · 2 replies
    • JackFarmer

      Kill the bots! (see the "Who is online" bar)
      · 3 replies
    • STiFU

      I finished DOOM - The Dark Ages the other day. It is a decent shooter, but not as great as its predecessors, especially because of the soundtrack.
      · 5 replies
    • JackFarmer

      What do you know about a 40 degree day?
      @demagogue
      · 4 replies
×
×
  • Create New...