project-navigation
Personal tools

Author Topic: New Feature: "Glow" textures  (Read 60690 times)

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
Re: New Feature: "Glow" textures
« Reply #75 on: April 19, 2010, 10:41:59 am »
it would be nice if the GLOW in the shaders would be a float and would be controllable via material system parameter - because the mapper might want to decrease or increase the glow strength on a per-map-basis without changing textures. would that be possible?
I think indeed that is the best idea regarding the glowing-strength ;)
Maybe it would be nice also to be able to have the glow-strength fluctuate a little bit over time, so the effect would be even better...

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: New Feature: "Glow" textures
« Reply #76 on: April 19, 2010, 10:53:01 am »
Another question. Could the glow post processing be applied to particles? I think the plasma and PBW particles could benefit from glow postprocessing.
« Last Edit: April 19, 2010, 04:39:34 pm by BTAxis »

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: New Feature: "Glow" textures
« Reply #77 on: April 19, 2010, 11:22:21 am »
Well, I feel bad throwing another feature request at you now that everyone's got another request for the glow system. But that's a sign that everyone really likes your work arisian (including me).

The request I'd like to add is to be able to specify the intensity via the material system (as Mattn describes using a float), but to have separate values for day and night. Things glow depending on the relative light value of things around them, so I'd like to be able to specify a big glow for night but just the tiniest glow for day.

Thanks again arisian.

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: New Feature: "Glow" textures
« Reply #78 on: April 19, 2010, 11:32:45 am »
Wouldn't that effect already be there what with the lightmap?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: New Feature: "Glow" textures
« Reply #79 on: April 19, 2010, 12:30:36 pm »
Well, I feel bad throwing another feature request at you now that everyone's got another request for the glow system. But that's a sign that everyone really likes your work arisian (including me).

The request I'd like to add is to be able to specify the intensity via the material system (as Mattn describes using a float), but to have separate values for day and night. Things glow depending on the relative light value of things around them, so I'd like to be able to specify a big glow for night but just the tiniest glow for day.

Thanks again arisian.

that's not something for glow in particular, that's something i will implement for all material settings.

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: New Feature: "Glow" textures
« Reply #80 on: April 19, 2010, 12:46:31 pm »
Wouldn't that effect already be there what with the lightmap?

I have to admit I don't understand what lightmaps do. The materialsystem documentation on the wiki is kind of sparse for the non-techie. I don't know what "statically computed lighting information" is, where it's computed from or what it's meant to do. Mattn told me to remove the lightmap from my adverts to make them light up, but from the description it sounds like it the lightmap stage should be there to make them light up.

that's not something for glow in particular, that's something i will implement for all material settings.

Great! I was hoping for this.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: New Feature: "Glow" textures
« Reply #81 on: April 19, 2010, 01:11:45 pm »
I have to admit I don't understand what lightmaps do. The materialsystem documentation on the wiki is kind of sparse for the non-techie. I don't know what "statically computed lighting information" is, where it's computed from or what it's meant to do. Mattn told me to remove the lightmap from my adverts to make them light up, but from the description it sounds like it the lightmap stage should be there to make them light up.

the lightmap is computed on a per-surface base for your map. think about it as a second texture layer that is added to those textures you've applied to surfaces via uforadiant. the normal surface texture and lightmap data (which is a special encoded image) is blended onto each other. in most cases the lightmap will add shadows to surfaces. thus in a dark area you can make one particular surface standing out a little bit brighter if you don't blend the lightmap onto the texture.

If this makes things clearer for you, please extend the wiki with your own words - others might have the same problems with the existing description - and if you have more questions or problems with this explaination, please don't hesitate to ask.

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: New Feature: "Glow" textures
« Reply #82 on: April 19, 2010, 01:50:01 pm »
the lightmap is computed on a per-surface base for your map. think about it as a second texture layer that is added to those textures you've applied to surfaces via uforadiant. the normal surface texture and lightmap data (which is a special encoded image) is blended onto each other. in most cases the lightmap will add shadows to surfaces. thus in a dark area you can make one particular surface standing out a little bit brighter if you don't blend the lightmap onto the texture.

If this makes things clearer for you, please extend the wiki with your own words - others might have the same problems with the existing description - and if you have more questions or problems with this explaination, please don't hesitate to ask.

Possibly, let me see if I've got it: To generate the appearance of light on a surface, it blends an image of light and shadow onto the existing texture. By removing the lightmap from any material stages, it makes the staged texture appear with no lighting on it (because it's usually shadows, therefore, it usually brightens the texture). Is that correct?

One more question, then I'll edit the wiki and stop sidetracking this thread: If I have a material definition without any other texture blending going on, should I still include the lightmap parameter in the material, or does this only effect the blend stages? (ie - if a material without any stages doesn't have the lightmap parameter, will no lighting appear on it? I ask because many of my materials don't have the lightmap parameter but I haven't noticed that they "lack" any lighting...)


Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: New Feature: "Glow" textures
« Reply #83 on: April 19, 2010, 02:59:19 pm »
depends - for normal texture blending this isn't needed, but it's e.g. needed for terrain and dirtmap afaik (but i might be wrong here)

if the wiki isn't clear about this i will have to extend it i suppose ;)

Offline arisian

  • Rookie
  • ***
  • Posts: 91
    • View Profile
Re: New Feature: "Glow" textures
« Reply #84 on: April 19, 2010, 03:11:06 pm »
Wow, glad to see all the interest here!

I'll try to answer the questions I've spotted:

1.) None of the real-time glow stuff will ever work without GLSL.  There's just no way to implement those features without using shader programs (in particular, for the postprocessing step itself).  The only thing you can do without shaders is make sprite-style "glow," by slapping a transparent texture with pre-rendered glow effects on top of an object (this is the way the halos around lights are done now, as I recall).

2.) Having a parameter that lets you control intensity in the material shouldn't be too difficult; "pulse" animations already adjust intensity on the fly, and it shouldn't be too hard to add a parameter to control the "base" intensity to the .mat file.  By the way, the "pulse" effect should already allow glow to fluctuate over time.  The stretch, rotate, and scroll effects should work with glow-maps, too.

3.) There's no reason glow couldn't be applied to the particles.  Essentially, if you want something to glow, you just need to make sure the "glow" part gets rendered to the glow buffer, and everything else is taken care of by the existing post-processing code.  I know nothing about the particle system, so we'd have to figure out how glow should be specified there.

3.) The glow "radius" is something which can be adjusted in the code, but not on the fly (at least, not at the moment).  Reducing the intensity will reduce the effective distance that it spreads, though.  In terms of what the glow radius is, there's a tradeoff between performance, quality, and size.  You can adjust any one of those three parameters, but doing so will affect the other two.  For example, right now there's a sort of "sparkle" effect to the glow when you move the camera, particularly if you have small, bright spots of glow.  This is essentially an aliasing artifact; it's easy to reduce, but doing so would either decrease the glow radius, or increase the computational cost of doing the postprocessing.  If you want to play around, look at the DOWNSAMPLE_PASSES and DOWNSAMPLE_SCALE macros in r_state.h, as well as the FILTER_SIZE macro in r_program.c

4.) I'm disinclined to decouple glow-maps from normal textures too much, so I don't want to have one-to-many mappings (ie. one "normal" texture with several "glow" textures for animation frames).  However, I think it should be possible to add a material parameter that would cause the "standard" textures to be rendered to the glow-buffer.  This would let you have only the textures you needed for your animation frames, if I understand what you're asking for.  

5.) Mattn, I've got no idea what's going on for you; let me know if you figure anything out, or want help.

If I've missed any other questions, I appolagize; there were a lot of them :)

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: New Feature: "Glow" textures
« Reply #85 on: April 19, 2010, 03:43:54 pm »
Wow, glad to see all the interest here!

5.) Mattn, I've got no idea what's going on for you; let me know if you figure anything out, or want help.

that's because we all like what we are seeing from your work ;)

i'll try to recheck in the evening when i'm in the hotel and let you know about any problems (if there are any left after your latest changes).

Offline arisian

  • Rookie
  • ***
  • Posts: 91
    • View Profile
Re: New Feature: "Glow" textures
« Reply #86 on: April 19, 2010, 05:15:34 pm »
Okay, glow-map intensity can now be scaled in materials.  The parameter "glowscale" is what you want to set; it will be multiplied, so 1.0 is the default.  0.5 will mean half intensity, and so forth.  The glowscale parameter can be applied either at the material level or at the stage level; if it appears in both, they will be multiplied to get the value used for a given stage.  As an example, in the following material, the texture "grass_gm" will be multiplied by 0.1 (since 0.5 * 0.2 = 0.1) when it is being rendered to the glow-buffer.  Note that this only works for materials; this won't let you scale the glow on models or surfaces, for example.

{
   material tex_nature/grass001
   hardness 0.2
   specular 0.2
   glowscale 0.5
   {
      texture tex_nature/grass
      dirtmap 1.0
      lightmap
      glowscale 0.2
   }
}

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: New Feature: "Glow" textures
« Reply #87 on: April 19, 2010, 05:38:27 pm »

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: New Feature: "Glow" textures
« Reply #88 on: April 19, 2010, 06:29:51 pm »
Great, easy to use.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: New Feature: "Glow" textures
« Reply #89 on: April 19, 2010, 07:16:16 pm »
retried latest revision - same result (or better, even worse, because now all brushes (regardless whether they have a glowmap or not) are now glowing. no warnings on the console, shaders compile fine.

it's an ati card (mobility radeon hd 4670), gl version 2.1, glsl version 1.4 - fglrx driver.
« Last Edit: April 19, 2010, 07:18:15 pm by Mattn »