FOnline Development > 3D Development

Shaders and effects

<< < (10/16) > >>

baaelSiljan:

--- Quote from: Lexx on December 16, 2011, 04:21:18 pm ---If it's done via shaders, it is optional. Everyone can write and use their own shaders or no shaders at all, because it's client side.

--- End quote ---

And here comes question (cause I'm noob in this matter) - how to apply custom shaders?

friday, friday, fun, fun... posterization applied into game as hlsl shader :)



but need to be fixed more, and gamma should be set correctly..

simpliest wat to do that is add this code to 3D_SpecularMapping.fx and 3D_Default.fx to end of


--- Code: ---
PSNormal


--- End code ---

   function before line:


--- Code: ---
return output;


--- End code ---


--- Code: ---
float3 transformedColor = output.rgb; // by mistake I placed here output.xyz

// set number of colors
float numberOfColors = 12;

// set gamma
float gamma = 0.5;

transformedColor = pow(transformedColor, gamma);
transformedColor = transformedColor * numberOfColors;
transformedColor = floor(transformedColor);
transformedColor = transformedColor / numberOfColors;
transformedColor = pow(transformedColor,1.0/gamma);
output.rgb = transformedColor;


--- End code ---


and now noise (it may be hard):




HOOOAH!!!

first successfull run with noise





http://rudo-brody.pl/uploads/2011-12-16_2159.mp4

nightvision fun :P


more work with shaders more fun :D


tomorrow I will place here fully functional and refactored code

Karpov:
Oh, that's great. Good work

Johnnybravo:
What do you use for the noise? Bitmap? Noise function? Or you just calculate it for every pixel?

Posterization filter gets quite some nice low color image, kudos for that :d. (though it's not correct, because this would better be with a palette lookup, but that's just slow for realtime anyway so I guess this is good enough).

baaelSiljan:

--- Code: --- float rand(float2 co)
{
return frac(sin(dot(co.xy ,float2(12.9898,78.233))) * 43758.5453);
}

float noise(float2 co)
{
return rand(floor((co * 500.0) + (8.0*co)));
}

--- End code ---

that's noise :) it is multipled per color (r,g,b) in pixel shader

better posterisation than nothing, it works very similar and looks very similar to pallette cut

Luther Blissett:
This looks very promising! The texture on that coat could also be improved a little both tonally and in terms of the colour range (I made it, so I assume the comment won't offend anyone). It was made before the specular shaders were implemented, so includes a lot of "painted on" highlight and shadow, which is now a little too "old school" now we have the engine responding to lighting.

If the original .PSD file would be useful for your testing, I can send that along. Otherwise, feel free to redo / improve the texture as necessary :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version