Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Prototype Day/Night system MMF2.


Recommended Posts

1.) Create black box over screen.

2.) Set semi-transparency of box to that of relevant alterable value.

3.) Add "1" to alterable value every 'x' seconds, minutes, etc.

4.) Program certain events to only happen when "time" (alterable value) is between "x" and ""x".

Boom, instant extra replayability to any game.

Link to comment
Share on other sites

I personally feel this is the sort of thing that would look better if you took direct control of the palette. I'm not sure that's doable in MMF though (possibly with the shader extension?). Ideally though you'd have different palette maps for morning, mid day, afternoon, evening, night, and some number of in betweens and you'd interpolate each color between the steps based on their time.

Not to knock your method of doing it of course. It just seems to overwhelm the picture a little too much for my tastes.

Link to comment
Share on other sites

I personally feel this is the sort of thing that would look better if you took direct control of the palette. I'm not sure that's doable in MMF though (possibly with the shader extension?). Ideally though you'd have different palette maps for morning, mid day, afternoon, evening, night, and some number of in betweens and you'd interpolate each color between the steps based on their time.

Not to knock your method of doing it of course. It just seems to overwhelm the picture a little too much for my tastes.

This. I would love the ability to do palette swaps in real time, because then we could animate things like waterfalls, blinking lights, and shiny crystals without making them active objects. ^_^

Link to comment
Share on other sites

This. I would love the ability to do palette swaps in real time, because then we could animate things like waterfalls, blinking lights, and shiny crystals without making them active objects. ^_^

There's is a palette swap for Shader for MMF2, however, you can have up to 7 colors I think.

https://dl.dropbox.com/u/32409323/PaletteReplacer.7z

// Pixel shader input structure

struct PS_INPUT

{

float4 Position : POSITION;

float2 Texture : TEXCOORD0;

};

// Pixel shader output structure

struct PS_OUTPUT

{

float4 Color : COLOR0;

};

// Global variables

sampler2D Tex0;

// Blue colors

float4 BDark;

float4 BMid;

float4 BLight;

float4 OutL;

float4 CDark;

float4 CMid;

float4 CLight;

PS_OUTPUT ps_main( in PS_INPUT In )

{

// Output pixel

PS_OUTPUT Out;

Out.Color = tex2D(Tex0, In.Texture);

// Do a sum of the r, g and b values, 1 check is quicker than 3

float sum = Out.Color.r + Out.Color.g + Out.Color.b;

// Look for the most common colors first, for efficiency, in those cases we can end the check early

// Based on X's standard pose:

// Outline (106 pixels in X)

if (sum>0.282 && sum<0.283)

{

Out.Color.rgb = OutL;

}

// Blue Dark (106 pixels in X)

if (sum>0.815f && sum<0.816f)

{

Out.Color.rgb = BDark;

}

// Blue Mid (48 pixels in X)

else if (sum>1.192f && sum<1.193f)

{

Out.Color.rgb = BMid;

}

// Blue Light (44 pixels in X)

else if (sum>1.474 && sum<1.475)

{

Out.Color.rgb = BLight;

}

// Cyan Mid (29 pixels in X)

else if (sum>1.882 && sum<1.883)

{

Out.Color.rgb = CMid;

}

// Cyan Light (22 pixels in X)

else if (sum>2.258 && sum<2.259)

{

Out.Color.rgb = CLight;

}

// Cyan Dark (15 pixels in X)

else if (sum>1.129 && sum<1.130)

{

Out.Color.rgb = CDark;

}

return Out;

}

// Effect technique

technique tech_main

{

pass P0

{

// shaders

VertexShader = NULL;

PixelShader = compile ps_2_0 ps_main();

}

}

[code]

Also, you have to manually edit the the .fx and

xml files.

In the fx file, you'll see something like "(sum>0.282 && sum<0.283)". Example. Mecha Sonic's lightest blue colors is

128,132,232. You add those 3 values together. You divide the sum by 255. Then you take the first for numbers and write that down. This shader was written by someone at Sprites-Inc forums, so I'm going off memory.

128+132+232 = 492 /255 =[b]1.929[/b]411764705882= 1.929. Then you add it like this.

// Blue Dark (106 pixels in X)

if (sum>0.815f && sum<0.816f)

{

Out.Color.rgb = [color=red]BDark[/color];

}

That's the name you use in the xml file.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...