Jump to content


Photo

Feature request: emissive materials/volumetric lights

emissive postprocess effects

197 replies to this topic

#1 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 24 September 2018 - 09:55 AM

As per Duzenko's request here: http://forums.thedar...e-2#entry427749

 

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, 24 September 2018 - 09:58 AM.


#2 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1630 posts

Posted 24 September 2018 - 12:31 PM

I have no experience with UDK or other engines.

Can you tell me more about the desired effect?

What gets multiplied by what?



#3 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 24 September 2018 - 01:33 PM

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

}



#4 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1630 posts

Posted 24 September 2018 - 01:51 PM

Umm

So how is it different to e.g. regular material with the same "rgb 7"?



#5 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 24 September 2018 - 01:56 PM

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, 24 September 2018 - 01:57 PM.


#6 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1630 posts

Posted 24 September 2018 - 02:13 PM

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?



#7 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 24 September 2018 - 02:17 PM

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.



#8 HMart

HMart

    Advanced Member

  • Member
  • PipPipPip
  • 708 posts

Posted 24 September 2018 - 02:23 PM

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.   



#9 VanishedOne

VanishedOne

    Advanced Member

  • Member
  • PipPipPip
  • 842 posts

Posted 24 September 2018 - 02:25 PM

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, 24 September 2018 - 02:29 PM.

Some things I'm repeatedly thinking about...

- louder scream when you're dying


#10 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 24 September 2018 - 02:29 PM

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.



#11 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1630 posts

Posted 24 September 2018 - 02:37 PM

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?



#12 VanishedOne

VanishedOne

    Advanced Member

  • Member
  • PipPipPip
  • 842 posts

Posted 24 September 2018 - 02:47 PM

Is there anything relevant in this (from the olden days of 2004) or is that a different topic? https://www.gamasutr...altime_glow.php


Some things I'm repeatedly thinking about...

- louder scream when you're dying


#13 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 24 September 2018 - 03:10 PM

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



#14 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1630 posts

Posted 24 September 2018 - 03:39 PM

Can we have a test map for this?



#15 HMart

HMart

    Advanced Member

  • Member
  • PipPipPip
  • 708 posts

Posted 24 September 2018 - 08:35 PM

 

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



#16 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5682 posts

Posted 25 September 2018 - 01:57 AM

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.


  • HMart and duzenko like this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#17 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 25 September 2018 - 03:06 AM

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.


  • HMart and duzenko like this

#18 HMart

HMart

    Advanced Member

  • Member
  • PipPipPip
  • 708 posts

Posted 25 September 2018 - 07:17 AM

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. 



#19 Spooks

Spooks

    Member

  • Member
  • PipPip
  • 487 posts

Posted 25 September 2018 - 08:24 AM

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, 25 September 2018 - 08:29 AM.

My FMs: The King of Diamonds (2016)

 

Visit my Mapbook thread sometimes!


#20 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 8993 posts

Posted 25 September 2018 - 08:30 AM

Here's a very old example of volumetric lighting:

 

http://www.humus.nam...p?page=3D&ID=36


  • RPGista likes this
Please visit TDM's IndieDB site and help promote the mod:

http://www.indiedb.c...ds/the-dark-mod

(Yeah, shameless promotion... but traffic is traffic folks...)

#21 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 25 September 2018 - 08:32 AM

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?



#22 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1630 posts

Posted 25 September 2018 - 09:42 AM

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/d...erial.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.



#23 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 25 September 2018 - 09:51 AM

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.



#24 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1630 posts

Posted 25 September 2018 - 12:58 PM

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?


  • RPGista likes this

#25 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1596 posts

Posted 25 September 2018 - 02:05 PM

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.





Reply to this topic



  



Also tagged with one or more of these keywords: emissive, postprocess, effects

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users