Not logged inOpenClonk Forum
Up Topic Easier Shading Concept

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Zapper

>And FoW will be applied automatically, there won't be a way inside the shader code to apply it manually. Just a flag to turn it on or off.


For Caedes I had a shader that showed the outline of objects/landscape through FoW (see attachment). So that wouldn't be possible anymore?

>so if you wanted an overlay on top, you'd have to copy the whole shader modify it to serve that purpose.


So that doesn't make the shaders shorter and less error prone but it makes them longer and you have to adjust more when things change? That is exactly what the slices should prevent.

>I like this style of writing everything in separate functions, because I think it is easy to read.


The slices are basically different functions. I don't see the difference between
#include DefaultShader_Preprocessing
#include DefaultShader_Texture
foo.xyz = coolComicShadingEffect();
#include DefaultShader_Modulation
#include DefaultShader_Postprocessing
#include DefaultShader_FoW


and

slice (texture + 1)
{
    foo.xyz = coolComicShadingEffect();
}


I mean, I completely get what you mean: the current shaders are hard to understand. But I just fear that your solution is to make them easier to understand by removing all the features.

PS: The code for the landscape FoW thing is this: (currently you have to add it to CommongShader.glsl)
slice(color+6)
{
#ifdef OC_LANDSCAPE
  float edgeHighlighting = edgeFactor * edgeFactor;
  if (edgeHighlighting > 0.3) edgeHighlighting = 0.0;
  fragColor.rgb = max(lightBright, edgeHighlighting) * materialPx.rgb * (matEmit + lightColorNorm * spotLight);
  float mincol = min(fragColor.rgb[0], min(fragColor.rgb[1], fragColor.rgb[2]));
  float fading = min(lightBright + 0.8, 1.0);
  fragColor.rgb = fading * fragColor.rgb + (1.0 - fading) * vec3(mincol, mincol, min(1.0, mincol + 0.4));
#endif
}

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill