Page 1 of 2

Understanding visual effects

Posted: Wed Feb 08, 2012 9:19 pm
by Smivs
This thread is a synthesis of posts from the Progress thread and the Shaders’ Outpost thread.
Ahruman wrote:
Ahruman wrote:
The overall goal here is to allow most of the effects used by Griff’s ships to be done without custom shaders.
I’d like to highlight the fact that this is awesome. :-)
It sounds it, but I have to confess I don't understand any of it :(
Will there be a guide or tutorial or something to help?

Re: Progress

Posted: Wed Feb 08, 2012 9:28 pm
by JensAyton
I can only provide tools and specifications. We need the artiste himself to explain what the effect maps do. But obviously that requires the new stuff to be complete and the ships to be translated to it first.

Re: Progress

Posted: Thu Feb 09, 2012 12:33 pm
by submersible
Ahruman wrote:
I can only provide tools and specifications. We need the artiste himself to explain what the effect maps do. But obviously that requires the new stuff to be complete and the ships to be translated to it first.

I am only just beginning to come to grips with shaders and uv-mapping - if it were possible to blend between two materials using a map that would also be rather awesome.

And while I am requesting pie-in-the-sky features I have almost no hope of helping with.... emission / normal / specular / parallax maps for planets would be really quite awesome too.

Re: Progress

Posted: Sat Feb 11, 2012 6:06 pm
by Okti
Will transparency be supported?

Re: Progress

Posted: Sat Feb 11, 2012 6:11 pm
by JensAyton
Okti wrote:
Will transparency be supported?
No. This restriction has nothing to do with shaders.

Re: Progress

Posted: Sun Feb 12, 2012 5:37 pm
by JensAyton
As I said above, the goal (or rather, a goal) is to support most of what Griff’s ships do without requiring shaders. My main test is the Adder, which does most of the “normal” Griffly things without anything too exotic (like, say, the Thargoids and Morays).

Here is my current Adder material specification.
  • Diffuse colour, normal mapping and specular highlights work. As of r4780, this includes the metallic (self-colouring) effect thanks to the new self_color and scale_factor attributes.
  • I haven’t done anything for paint mapping or decals yet. I intend to do paint maps (and remove some of their current limitations). I’m not sure about decals.
  •  Also as of r4780, arbitrarily many light maps can be used, as shown. The conditional_color, binding, damage_flicker and simple_mode attributes aren’t implemented yet; when they are, the glows will respond to the environment in the same way as the standard Griff Adder. As it stands, you just get all four effects on full blast. All these light maps work like emission maps; adding illumination_mode = true turns them into illumination maps.
I realise there are a lot of weird magic words to take in at once. If you want to understand what’s going on here and don’t, please ask specific questions. :-)

Code: Select all

{
    diffuse_map = "oolite-adder-diffuse.png";
    normal_map = "oolite-adder-normal.png";
    specular_color_map =
    {
        name = "oolite-adder-diffuse.png";
        extract_channel = "a";
        self_color = true;  // Modulate specular colour with diffuse colour.
        scale_factor = 6;   // Multiply all channels by a constant.
    };
    specular_exponent = 5;
    
    light_map =
    (
        {
            // Light map 1: lamp/window glow map.
            name = "oolite-adder-effects.png";
            extract_channel = "a";
            
            // Base colour is yellow-white.
            color = (0.9926, 0.9686, 0.7325);
            
            // Turn red (and subtract base green and blue) in combat. Ignored in simple shader mode.
            conditional_color =
            {
                binding = "hasHostileTarget";
                color = (1.5, -0.4, -0.4);
            };
            
            // Flicker on and off while throwing sparks.
            damage_flicker = true;
        },
        {
            // Light map 2: cyan engine glow, full shaders only.
            name = "oolite-adder-effects.png";
            extract_channel = "b";
            color = (0.4, 1.4, 1.8);
            
            // Intensity is controlled by speedFactor.
            binding = "speedFactor";
            
            // Flicker on and off while throwing sparks.
            damage_flicker = true;
            
            // Disable in simple shader mode.
            simple_mode = false;
        },
        {
            // Light map 3: orange engine heat glow, full shaders only.
            name = "oolite-adder-effects.png";
            extract_channel = "r";
            color = (1.5, 0.55, 0.2);
            
            // Intensity is controlled by speedFactor.
            binding = "speedFactor";
            
            // Disable in simple shader mode.
            simple_mode = false;
        },
        {
            // Light map 4: red laser heat glow, full shaders only.
            name = "oolite-adder-effects.png";
            extract_channel = "g";
            color = (1.38, 0.35, 0.20);
            
            // Intensity is controlled by laser temperature.
            binding = "laserHeatLevel";
            
            // Disable in simple shader mode.
            simple_mode = false;
        }
    );
};

Re: Progress

Posted: Sun Feb 12, 2012 7:55 pm
by DaddyHoggy
Hi Ahruman, you wrote this: "...is to support most of what Griff’s ships do without requiring shaders"

But in the code I see this, in the comments:

Code: Select all

// Light map 2: cyan engine glow, full shaders only.
So, I don't understand what's different - apologies. (this could be because I never fully understood what Griff previously did with your earlier shady examples)

Re: Progress

Posted: Sun Feb 12, 2012 8:26 pm
by JensAyton
The word “custom” seems to have disappeared.

In 1.76, you get Griffy ships you need to write GLSL. With this, you tell the game what you want and it writes shaders for you. To benefit, you still have to understand what you want, but you don’t need to handle the optics and pixels yourself.

Re: Progress

Posted: Sun Feb 12, 2012 9:30 pm
by DaddyHoggy
Ahruman wrote:
The word “custom” seems to have disappeared.

In 1.76, you get Griffy ships you need to write GLSL. With this, you tell the game what you want and it writes shaders for you. To benefit, you still have to understand what you want, but you don’t need to handle the optics and pixels yourself.
Thank-you. I actually do understand now!

Re: Progress

Posted: Sun Feb 12, 2012 9:33 pm
by JensAyton
This is also something that could be relatively easily wrapped up in a third-party tool.

Of course, the last time someone tried to do that he ended up lead developer of Oolite. But that’s all right, we need a new one of those.

Re: Progress

Posted: Mon Feb 13, 2012 10:45 am
by Selezen
This all sounds like it might actually make shaders accessible to my luddite brain.

Is there any chance of a step-by-step tutorial on how to create shaders under your new regime, Ahruman? Please? It sounds like the old tutorial may be dated now.

Re: Progress

Posted: Mon Feb 13, 2012 11:01 am
by Smivs
Selezen wrote:
This all sounds like it might actually make shaders accessible to my luddite brain.

Is there any chance of a step-by-step tutorial on how to create shaders under your new regime, Ahruman? Please? It sounds like the old tutorial may be dated now.
This is something I would also appreciate, as I have no knowledge or understanding of such things. I would even like a simple explanation of the terminology and the functions of these things. Something like the code posted above for the adder but annotated/commented to describe the function of each element.

Re: Progress

Posted: Mon Feb 13, 2012 11:05 am
by JensAyton
Selezen wrote:
This all sounds like it might actually make shaders accessible to my luddite brain.

Is there any chance of a step-by-step tutorial on how to create shaders under your new regime, Ahruman? Please? It sounds like the old tutorial may be dated now.
I’m not sure why this is so hard to explain, but the point of the material model is that you don’t create shaders. It has not been necessary to write shaders for the most common effects for the last five years.

Re: Progress

Posted: Mon Feb 13, 2012 1:08 pm
by Selezen
As I said. Luddite brain. Ug.

Change "create shaders" in my last post to "make shaders work"? Would that be more accurate?

This was my secondary reason for stopping doing OXPs - I didn't/don't understand how to get glow maps and reflections working.

Re: Progress

Posted: Mon Feb 13, 2012 5:51 pm
by Svengali
Smivs wrote:
Selezen wrote:
This all sounds like it might actually make shaders accessible to my luddite brain.

Is there any chance of a step-by-step tutorial on how to create shaders under your new regime, Ahruman? Please? It sounds like the old tutorial may be dated now.
This is something I would also appreciate, as I have no knowledge or understanding of such things. I would even like a simple explanation of the terminology and the functions of these things. Something like the code posted above for the adder but annotated/commented to describe the function of each element.
This was one of the reasons for the [wiki]Cabal_Common_MaterialsFinder[/wiki]. Play with the included example and you'll get a feeling for the possibilities pretty soon, specially when using it side by side with the [EliteWiki] documentation for the materials.