Jump to content


Photo

Desaturated light shader


7 replies to this topic

#1 Durandall

Durandall

    Member

  • Member
  • PipPip
  • 94 posts

Posted 22 March 2018 - 06:06 PM

Is it possible to create a greyscale light shader or do we already have one?

It would make for a great moonlight effect.

I tried messing around with the shaders to average the colors, but I have no experience with shaders and everything I try leads to no effect or a shader error.

 

Also, how might one go about altering the hue of an existing texture?

I tried this as well, but the results are a mess. I don't know if I need to alter it's shader or something.

We only have one good set of manor wood texture and it's that same orange.

Some color modification would give some nice variety.

 



#2 Spooks

Spooks

    Member

  • Member
  • PipPip
  • 466 posts

Posted 22 March 2018 - 07:05 PM

You can tint a diffuse texture inside the material file with the "rgb" keyword -- several of our textures use this method, like the darkbrown wood panels. It's, of course, limited by the original color of the diffuse, so your mileage will vary.

 

As for a shader, do you mean a type of light that desaturates the colors it shines on? That sounds pretty interesting, but I don't know if it would simulate moonlight that well. Perhaps something like a filter light might do it... but as far as shaders go, not sure anyone would be up for making one from scratch for this sort of thing.


My FMs: The King of Diamonds (2016)

 

Visit my Mapbook thread sometimes!


#3 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 8867 posts

Posted 22 March 2018 - 07:44 PM

The makeIntensity keyword can turn any uncompressed image to greyscale.

https://www.iddevnet...3/materials.php

You can then add a color image and use the RGB keyword to reduce the influence of the color stage in the shader
 
Example:
 
lights/desaturated_test
{

lightFalloffImage _noFalloff // by default, stay bright almost all the way to the end

        {
                map makeIntensity(lights/example_color_tex)
                colored
                zeroClamp
                rgb 0.7
        }

        {
               map lights/example_color_tex
               colored
               zeroClamp
               rgb 0.3
        }
}

Another option is to create override cubicLight ARB shaders and change the way color is processed there.
You'd just have to give up on Cubemap lights working and use the extra "light type" slot for your custom version.

And yet another option is to override the post process shader with changes discussed here:

http://wiki.thedarkm...isuals_Tweaking
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...)

#4 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1526 posts

Posted 23 March 2018 - 01:20 AM

For a true desaturated look, or any other kind of color grading, what you want is Rich's awesome Color Grading Shader:

 

http://forums.thedar...grading-shader/

 

It has huge potential in giving each mission a unique look, or at least scenes inside a given mission, like a dream sequence you want to have in black and white or something.

 

As for the moonlight, Im sure there must be more missions nowadays that use it, though I havent played any. But you can always check out mine and see if that one works for you. Just copy and paste it into your map.



#5 Durandall

Durandall

    Member

  • Member
  • PipPip
  • 94 posts

Posted 23 March 2018 - 04:54 PM

Rich's awesome Color Grading Shader won't work as I don't want the entire mission in greyscale.

Just wanted moonlight from windows and outdoors, but it's low priority, so I'll check into it further later.

I assume makeIntensity would work, but the doc description is rather vague.

I must admit, I'm not even certain what a "texture map" is. preposition

 

I got the polished_shiny floor texture hue shifted this time, I'm not sure what I did differently.

I might need to consider tga format as recompressing the dds is noticeable.

Now I just need to get consistent results for all the orangy manor textures...

I'll look into the rgb keyword first though. I can only imagine it's going to be a nightmare restarting the engine to view the textures each change.

 

One final off topic question.

I have a light source above a building and it casts a moonlight shadow.

This kills the framerate.

Well, at certain very specific locations. I'm going to look into various maps tonight and gather some info.

I find it strange that most positions and view angles have no trouble.

Is this kind of light a bad idea or do I have something weird going on?



#6 Spooks

Spooks

    Member

  • Member
  • PipPip
  • 466 posts

Posted 23 March 2018 - 05:33 PM

 

I'll look into the rgb keyword first though. I can only imagine it's going to be a nightmare restarting the engine to view the textures each change.

 

You don't have to, type ReloadDecls, ReloadImages or ReloadSurface when the crosshair is over the texture, to reload it in-game. As for the question, the light probably calculates the shadows from everything inside and that's causing the catastrophic drop in frames. Not sure why it's only noticeable at some points (probably visleaf related), but yes, kind of a bad idea. You could make a bunch of smaller lights that cover the areas you want to be moonlit and drag their light_origin points to the same place. I'm certain that'd alleviate at least some of the lag.


Edited by Spooks, 23 March 2018 - 05:34 PM.

My FMs: The King of Diamonds (2016)

 

Visit my Mapbook thread sometimes!


#7 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1526 posts

Posted 23 March 2018 - 05:53 PM

The color grading shader isnt about greyscale, it can give the mission any tint you want, as was demonstrated in the thread. You could have it sepia, or natural colors but slightly desaturated, increase the contrast, or maybe you want the dark colors to be blueish, etc. 

 

As for the things you want to achieve, unless you want to be able to look through those windows directly to the outside and thats crucial to your gameplay idea, you would be better off using an opaque window glass texture and fake the moolight by using a light with texture beaming inside. Loads of examples to look into. Outside, you would need a parallel light, sure. Since it showers everywhere, it will be hitting a lot of geometry, so you have to take care all unnecessary props will be noshadow, etc. It will get into unsealed rooms as well, maybe thats what is giving you bad performance (as the geometry adds up or other lights are getting overlapped). Just seal everything. Make sure your exterior is not a single space with the house in the middle, break it up into narrower sections, spaces you can seal with visportals.



#8 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1264 posts

Posted 24 March 2018 - 01:44 AM

I would add a custom ARB interaction shader for this. Copy paste interaction.vfp, add greyscale converter in the end and assign to your light.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users