git-svn-id: svn://db.shs.com.ru/libs@659 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -191,7 +191,7 @@ QVector<float> Framebuffer::grabF(int index) const {
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer::blit(int index_from, GLuint fb_to, int index_to, QRect from, QRect to, GLbitfield mask, GLenum filter) {
|
||||
void Framebuffer::blit(int index_from, GLuint fb_to, int index_to, QRect from, QRect to, GLbitfield mask, GLenum filter) const {
|
||||
if (index_from < 0 || index_from >= colors.size()) return;
|
||||
GLenum e = GL_COLOR_ATTACHMENT0 + index_to;
|
||||
f->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb_to);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
class Framebuffer
|
||||
{
|
||||
friend class FramebufferMipmap;
|
||||
public:
|
||||
Framebuffer(QOpenGLExtraFunctions * f_, int colorAttachments = 1, bool withDepth = true, GLenum colorFormat = GL_RGBA8, GLenum _target = GL_TEXTURE_2D);
|
||||
Framebuffer(QOpenGLExtraFunctions * f_, QVector<GLenum> colors_, bool withDepth = true, GLenum _target = GL_TEXTURE_2D);
|
||||
@@ -47,7 +48,7 @@ public:
|
||||
QVector<uint> getPoints() const;
|
||||
QImage getImage() const;
|
||||
int queriedPoints() const {return pbo_queried;}
|
||||
void blit(int index_from, GLuint fb_to, int index_to, QRect from, QRect to, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
|
||||
void blit(int index_from, GLuint fb_to, int index_to, QRect from, QRect to, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST) const;
|
||||
|
||||
void resize(int width, int height, bool force = false);
|
||||
void bind();
|
||||
|
||||
50
qglengine/core/glframebuffer_mipmap.cpp
Normal file
50
qglengine/core/glframebuffer_mipmap.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
QGLView
|
||||
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QOpenGLExtraFunctions>
|
||||
#include "glframebuffer_mipmap.h"
|
||||
#include <QTime>
|
||||
|
||||
|
||||
FramebufferMipmap::FramebufferMipmap(const Framebuffer & fb, int index_from_, int levels): src_fb(fb) {
|
||||
index_from = index_from_;
|
||||
for (int i = 0; i < levels; ++i)
|
||||
fbo << new Framebuffer(fb.f, 1, false, fb.color_formats[index_from]);
|
||||
}
|
||||
|
||||
|
||||
FramebufferMipmap::~FramebufferMipmap() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FramebufferMipmap::resize() {
|
||||
QSize sz = src_fb.size();
|
||||
for (int i = 0; i < fbo.size(); ++i) {
|
||||
sz /= 2;
|
||||
fbo[i]->resize(sz.width(), sz.height());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FramebufferMipmap::create() {
|
||||
if (fbo.isEmpty()) return;
|
||||
src_fb.blit(index_from, fbo[0]->id(), 0, src_fb.rect(), fbo[0]->rect(), GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
for (int i = 0; i < fbo.size() - 1; ++i)
|
||||
fbo[i]->blit(0, fbo[i + 1]->id(), 0, fbo[i]->rect(), fbo[i + 1]->rect(), GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
}
|
||||
49
qglengine/core/glframebuffer_mipmap.h
Normal file
49
qglengine/core/glframebuffer_mipmap.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
QGLView
|
||||
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GLFRAMEBUFFER_MIPMAP_H
|
||||
#define GLFRAMEBUFFER_MIPMAP_H
|
||||
|
||||
#include "glframebuffer.h"
|
||||
|
||||
|
||||
class FramebufferMipmap
|
||||
{
|
||||
public:
|
||||
FramebufferMipmap(const Framebuffer & fb, int index_from_, int levels = 2);
|
||||
virtual ~FramebufferMipmap();
|
||||
|
||||
int levelsCount() const {return fbo.size();}
|
||||
int lastLevel() const {return fbo.size() - 1;}
|
||||
Framebuffer & plane(int level) {return *fbo[level];}
|
||||
int width (int level) const {return fbo[level]->wid;}
|
||||
int height(int level) const {return fbo[level]->hei;}
|
||||
QSize size(int level) const {return fbo[level]->size();}
|
||||
QRect rect(int level) const {return fbo[level]->rect();}
|
||||
|
||||
void resize();
|
||||
void create();
|
||||
|
||||
private:
|
||||
int index_from;
|
||||
const Framebuffer & src_fb;
|
||||
QVector<Framebuffer*> fbo;
|
||||
|
||||
};
|
||||
|
||||
#endif // GLFRAMEBUFFER_MIPMAP_H
|
||||
@@ -174,6 +174,8 @@ class Map;
|
||||
class Material;
|
||||
class TextureManager;
|
||||
class Texture2DArray;
|
||||
class Framebuffer;
|
||||
class FramebufferMipmap;
|
||||
class Mesh;
|
||||
class Scene;
|
||||
class RendererBase;
|
||||
|
||||
@@ -48,6 +48,7 @@ class QGLView: public OpenGLWindow
|
||||
Q_PROPERTY (float lineWidth READ lineWidth WRITE setLineWidth)
|
||||
Q_PROPERTY (float FOV READ FOV WRITE setFOV)
|
||||
Q_PROPERTY (float depthStart READ depthStart WRITE setDepthStart)
|
||||
Q_PROPERTY (float exposure READ exposure WRITE setExposure)
|
||||
Q_PROPERTY (QColor ambientColor READ ambientColor WRITE setAmbientColor)
|
||||
Q_PROPERTY (QColor fogColor READ fogColor WRITE setFogColor)
|
||||
Q_PROPERTY (bool fogEnabled READ isFogEnabled WRITE setFogEnabled)
|
||||
@@ -109,6 +110,7 @@ public:
|
||||
float FOV() const {return camera()->fov_;}
|
||||
float depthStart() const {return camera()->depth_start;}
|
||||
float currentFPS() const {return fps_;}
|
||||
float exposure() const {return renderer_.exposure_;}
|
||||
int maxAnisotropicLevel() const {return max_anisotropic;}
|
||||
|
||||
QColor ambientColor() const {return ambientColor_;}
|
||||
@@ -228,6 +230,7 @@ public slots:
|
||||
void setLineWidth(const float & arg) {lineWidth_ = arg;}
|
||||
void setFOV(const float & arg) {camera()->fov_ = arg;}
|
||||
void setDepthStart(const float & arg) {camera()->depth_start = arg;}
|
||||
void setExposure(const float & arg) {renderer_.exposure_ = arg;}
|
||||
void setAmbientColor(const QColor & arg) {ambientColor_ = arg;}
|
||||
void setFogColor(const QColor & arg) {fogColor_ = arg;}
|
||||
void setFogDensity(const float & arg) {fogDensity_ = arg;}
|
||||
|
||||
@@ -30,7 +30,6 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView
|
||||
setupUi(this);
|
||||
session.setFile("session_qglview_test.conf");
|
||||
session.addEntry(this);
|
||||
spinViewLineWidth->setValue(lineThickness()*2);
|
||||
|
||||
//view->view()->camera()->setPos(QVector3D(2, 2, 2));
|
||||
//view->view()->camera()->setAim(QVector3D());
|
||||
|
||||
@@ -63,6 +63,7 @@ private:
|
||||
private slots:
|
||||
void on_spinFOV_valueChanged(double val) {view->view()->setFOV(val);}
|
||||
void on_spinDepthStart_valueChanged(double val) {view->view()->setDepthStart(val);}
|
||||
void on_spinViewExposure_valueChanged(double val) {view->view()->setExposure(val);}
|
||||
void on_comboViewRenderMode_currentIndexChanged(int val) {static int modes[] = {GL_POINT, GL_LINE, GL_FILL}; view->view()->setRenderMode((ObjectBase::RenderMode)modes[val]);}
|
||||
void on_groupHoverHalo_clicked(bool val) {view->view()->setHoverHaloEnabled(val);}
|
||||
void on_groupSelectionHalo_clicked(bool val) {view->view()->setSelectionHaloEnabled(val);}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -67,7 +67,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_2">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
@@ -107,86 +107,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinDepthStart">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> - </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinDepthEnd">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Renderer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboRenderer">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Simple</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Deferred shading</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RT</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Draw mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboViewRenderMode">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
@@ -208,14 +136,14 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Back color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="ColorButton" name="colorBack">
|
||||
<property name="color">
|
||||
<color>
|
||||
@@ -226,14 +154,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Ambient</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="ColorButton" name="colorAmbient">
|
||||
<property name="color">
|
||||
<color>
|
||||
@@ -244,21 +172,40 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkMSAA">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>MSAA</string>
|
||||
<string>Exposure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="5" column="1">
|
||||
<widget class="SpinSlider" name="spinViewExposure">
|
||||
<property name="minimum">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>99.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="squareScale">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkFXAA">
|
||||
<property name="text">
|
||||
<string>FXAA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupHoverHalo">
|
||||
<property name="title">
|
||||
<string>Hover halo</string>
|
||||
@@ -313,7 +260,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupSelectionHalo">
|
||||
<property name="title">
|
||||
<string>Selection halo</string>
|
||||
@@ -368,7 +315,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupCamera">
|
||||
<property name="title">
|
||||
<string>Camera</string>
|
||||
@@ -397,29 +344,19 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QDoubleSpinBox" name="spinViewLineWidth">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="spinDepthStart">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>99999.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Line width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
@@ -440,8 +377,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>968</width>
|
||||
<height>636</height>
|
||||
<width>960</width>
|
||||
<height>737</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@@ -1079,8 +1016,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1009</width>
|
||||
<height>877</height>
|
||||
<width>999</width>
|
||||
<height>853</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
@@ -1163,7 +1100,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1125</width>
|
||||
<height>21</height>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
||||
@@ -30,9 +30,8 @@ using namespace QGLEngineShaders;
|
||||
Renderer::Renderer(QGLView * view_): RendererBase(view_),
|
||||
fbo_ds (view_, QVector<GLenum>() << GL_RGBA16F << GL_RGBA32F << GL_RGBA16F << GL_RGBA16F << GL_RGBA16F),
|
||||
fbo_out (view_, 6, false, GL_RGBA16F),
|
||||
fbo_small_4 (view_, 1, false, GL_RGBA16F),
|
||||
fbo_small_16 (view_, 1, false, GL_RGBA16F),
|
||||
fbo_1x1 (view_, 1, false, GL_RGB32F ),
|
||||
fbomm(fbo_out, obrSum, 3),
|
||||
buffer_vbo(GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW),
|
||||
rend_mat(this), rend_service(this), rend_selection(this) {
|
||||
shader_sum = 0;
|
||||
@@ -104,8 +103,7 @@ void Renderer::resize(int width, int height) {
|
||||
rend_selection.resize(width, height);
|
||||
fbo_ds .resize(width, height);
|
||||
fbo_out .resize(width, height);
|
||||
fbo_small_4 .resize(width / 4 , height / 4 );
|
||||
fbo_small_16 .resize(width / 16, height / 16);
|
||||
fbomm.resize();
|
||||
resizeSum();
|
||||
}
|
||||
|
||||
@@ -228,12 +226,12 @@ void Renderer::prepareSum() {
|
||||
|
||||
void Renderer::resizeSum() {
|
||||
QOpenGLExtraFunctions * f = view;
|
||||
int pcnt = fbo_small_16.width() * fbo_small_16.height();
|
||||
int pcnt = fbomm.width(fbomm.lastLevel()) * fbomm.height(fbomm.lastLevel());
|
||||
QVector<Vector2i> _data;
|
||||
_data.resize(pcnt);
|
||||
pcnt = -1;
|
||||
for (int x = 0; x < fbo_small_16.width(); ++x)
|
||||
for (int y = 0; y < fbo_small_16.height(); ++y)
|
||||
for (int x = 0; x < fbomm.width(fbomm.lastLevel()); ++x)
|
||||
for (int y = 0; y < fbomm.height(fbomm.lastLevel()); ++y)
|
||||
_data[++pcnt] = Vector2i(x,y);
|
||||
buffer_vbo.bind(f);
|
||||
buffer_vbo.resize(f, _data.size() * sizeof(Vector2i));
|
||||
@@ -348,11 +346,11 @@ void Renderer::renderScene() {
|
||||
fbo_out.setWriteBuffer(obrSum);
|
||||
renderQuad(prog, quad);
|
||||
}
|
||||
fbo_out.blit(obrSum, fbo_small_4.id(), 0, fbo_out.rect(), fbo_small_4.rect(), GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
fbo_small_4.blit(0, fbo_small_16.id(), 0, fbo_small_4.rect(), fbo_small_16.rect(), GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
renderSum(fbo_small_16, 0);
|
||||
fbomm.create();
|
||||
renderSum(fbomm.plane(fbomm.lastLevel()), 0);
|
||||
fbo_out.bind();
|
||||
if (bindShader(srTonemapPass, &prog)) {
|
||||
prog->setUniformValue("exposure", exposure_);
|
||||
fbo_1x1.bindColorTexture(0, 1);
|
||||
fbo_out.bindColorTexture(obrSum, 0);
|
||||
fbo_out.setWriteBuffer(obrTonemap);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "renderer_material.h"
|
||||
#include "renderer_service.h"
|
||||
#include "renderer_selection.h"
|
||||
#include "glframebuffer_mipmap.h"
|
||||
#include <QQueue>
|
||||
|
||||
|
||||
@@ -101,7 +102,8 @@ protected:
|
||||
private:
|
||||
float exposure_;
|
||||
bool edit_mode, need_init_shaders, is_camera_light;
|
||||
Framebuffer fbo_ds, fbo_out, fbo_small_4, fbo_small_16, fbo_1x1;
|
||||
Framebuffer fbo_ds, fbo_out, fbo_1x1;
|
||||
FramebufferMipmap fbomm;
|
||||
/*QOpenGLShaderProgram * shader_fxaa, * shader_ds_0, * shader_ds_1, * shader_hdr, * shader_small;
|
||||
QOpenGLShaderProgram * shader_bloom_0, * shader_bloom_1, * shader_motion_blur, * shader_fbo_add;
|
||||
QOpenGLShaderProgram * shader_shadow, * shader_ssr, * shader_ssr_blur, * shader_ssr_merge;
|
||||
|
||||
@@ -9,11 +9,10 @@ void main(void) {
|
||||
|
||||
uniform sampler2D tex_0, tex_1, tex_2, tex_3, tex_4;
|
||||
|
||||
const vec3 luma = vec3(0.299, 0.587, 0.114);
|
||||
|
||||
void main(void) {
|
||||
ivec2 tc = ivec2(gl_FragCoord.xy);
|
||||
vec4 v0 = texelFetch(tex_0, tc, 0);
|
||||
vec4 v1 = texelFetch(tex_1, tc, 0);
|
||||
qgl_FragColor = v0 + v1;
|
||||
vec3 res = v0.rgb + v1.rgb;
|
||||
qgl_FragColor.rgb = res;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ void calcLight(in int index, in vec3 n, in vec3 v) {
|
||||
float ndlc = (1. - NdotLs) / NdotLs;
|
||||
float der = NdotLs * (shm_diff + ndlc);
|
||||
diff = 2. / (1. + sqrt(1. + (1. - shm_diff) * ndlc));
|
||||
li += spot * diff * qgl_light_parameter[index].color.rgb;// * light_diffuse(0, ldir, n);
|
||||
li += spot * diff * qgl_light_parameter[index].color.rgb;
|
||||
|
||||
ndlc = (1. - NdotHs) / NdotHs;
|
||||
der = NdotHs * (shm_spec + ndlc);
|
||||
|
||||
@@ -8,6 +8,7 @@ void main(void) {
|
||||
// frag //
|
||||
|
||||
uniform sampler2D tex_0, tex_sum;
|
||||
uniform float exposure;
|
||||
|
||||
const vec3 luma = vec3(0.299, 0.587, 0.114);
|
||||
|
||||
@@ -17,7 +18,7 @@ void main(void) {
|
||||
vec4 sum = texelFetch(tex_sum, ivec2(0,0), 0);
|
||||
vec3 res = src.rgb;
|
||||
float l = dot(res, luma);
|
||||
float g = 2.2/dot(sum.rgb, luma);
|
||||
float g = exposure / dot(sum.rgb, luma);
|
||||
res /= l;
|
||||
//res = log(res + vec3(2.)) - log(vec3(2.));
|
||||
//res = pow(res,vec3(1/2.2));
|
||||
|
||||
Reference in New Issue
Block a user