I had a question about exactly when I should use the MRT. This is not about rendering models, but about post-processing. For example, I need to draw some cubic textures (something like skybox rendering). And how much will drawing in one pass be faster than in several? And will it be faster?
When should MRT (Multiple Render Targets) be used?
My shaders looks like this:
vertex:
#version 330 core
layout(location = 0) in vec3 inPos;
out vec3 texCoords;
uniform mat4 transform;
void main() {
vec4 pos = transform * vec4(inPos, 1.0);
gl_Position = pos.xyww;
texCoords = inPos;
}
fragment:
#version 330 core
#define vecout vec3
#define OUT_COLOR_COMPONENT 0
in vec3 texCoords;
layout(location = OUT_COLOR_COMPONENT) out vecout fragColor;
uniform samplerCube cubemap;
uniform vecout color = vecout(1.0);
void main() {
fragColor = vecout(texture(cubemap, texCoords)) * color;
}
The simplest example - to fill g-buffer. http://ogldev.atspace.co.uk/www/tutorial35/tutorial35.html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement