Rendering

From wowdev
Revision as of 01:16, 30 November 2016 by Fallenoak (talk | contribs) (Created page with "This page covers general rendering concerns that are not specific to model formats. = Model Specific Rendering = More information about rendering specific model formats can...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page covers general rendering concerns that are not specific to model formats.

Model Specific Rendering

More information about rendering specific model formats can be found at the following pages:

Screen Effects

EffectGlow

This fullscreen effect controls both the bloom-esque appearance of the game, as well as how blurred the screen gets due to player state like inebriation.

To apply the effect, the game creates 3 new render targets:

  • RT 0: Already exists, and holds the output of rendering the given world scene
  • RT 1: Created by passing RT 0 through the FFXGauss4 pixel shader (4-tap gaussian blur)
  • RT 2: Created by passing RT 1 through the FFXGauss4 pixel shader (second pass)
  • RT 3: Created by passing RT 0 and RT 2 through the FFXGlow pixel shader (both targets are sampled)

TODO: Explain how FFXGauss4 works

FFXGlow

#version 150

#extension GL_ARB_separate_shader_objects : require
#extension GL_ARB_explicit_attrib_location : require

layout(location = 1) in vec2 in_screenCoord;
layout(location = 2) in vec2 in_blurCoord;

layout(location = 0) out vec4 out_result;

layout(std140) uniform ps_cb0
{
  vec4 pc_blurAmount;
};

uniform sampler2D pt_screenTex;
uniform sampler2D pt_blurTex;

void main()
{

  vec4 screenColor = texture(pt_screenTex, in_screenCoord);
  vec3 blurColor = texture(pt_blurTex, in_blurCoord).rgb;

  float blurFactor = pc_blurAmount.z;
  float glowFactor = pc_blurAmount.w;

  // Calculate the glow color
  vec4 glowColor = (blurColor * blurColor) * glowFactor;

  // Blur the screen color (to handle effects like inebriation)
  vec4 workingColor = vec4(mix(screenColor.rgb, blurColor, vec3(blurFactor)), 0.0);

  // Apply the glow color
  workingColor = (workingColor + glowColor) - ((workingColor * glowColor) * 0.5);

  out_result = vec4(workingColor.rgb, screenColor.a);

}