Skip to content

Commit

Permalink
AwesomeBump official v2.0 version - prerelase
Browse files Browse the repository at this point in the history
Whats new in 2.0:
- Slightly redesigned GUI: Tiling/UV methods, General Settings and 3D
preview sliders are now separated into different tabs.
- Added short explanation about most important algorithms in AB. See
ShortAbout.pdf file.
- New random tiling algorithm was added. Which allow to generate
infinite number of seamless textures.
- New perspective mode - image can be now stretched along x and y axis,
which is useful during the perspective manipulation.
- Height calculator tool was added. Now the depth of the Normal texture
can be controlled based on physical dimensions.
- Size of the texture can be changes at run-time.
- Gray Scale manipulator - now you can choose what weights are used to
convert image to Gray scale.
- Colour levelling tool was added. This can be used e.g. to make flat
surfaces.
- Now the normal image is by default attached to height texture, which
means any change of height will affect the normals.

Minor changes:
- Unused button in AO tab was removed.
- Fixed problem with "cannot load image".
- Medium detail algorithm changed - it should give better results.
- Redefined the normal step slider, now it has more intuitive usage.
- You can choose your preferred GUI style.
- add many others small improvements.
  • Loading branch information
kmkolasinski committed Jan 25, 2015
1 parent d215013 commit b15c3e7
Show file tree
Hide file tree
Showing 18 changed files with 556 additions and 237 deletions.
13 changes: 11 additions & 2 deletions AwesomeBump.pro
@@ -1,3 +1,6 @@
CONFIG += c++11 debug debug_and_release
QT += opengl gui widgets

VPATH += ../shared
INCLUDEPATH += ../shared

Expand All @@ -7,7 +10,8 @@ HEADERS = glwidget.h \
formimageprop.h \
glimageeditor.h \
camera.h \
dialogheightcalculator.h
dialogheightcalculator.h \
qopenglerrorcheck.h
SOURCES = glwidget.cpp \
main.cpp \
mainwindow.cpp \
Expand All @@ -16,7 +20,6 @@ SOURCES = glwidget.cpp \
CommonObjects.cpp \
camera.cpp \
dialogheightcalculator.cpp
QT += opengl widgets

# install
INSTALLS += target
Expand All @@ -31,3 +34,9 @@ FORMS += \

OTHER_FILES += \
cube.frag

CONFIG(debug,debug|release) {
DEFINES += _DEBUG
}

ICON = content/icon.icns
38 changes: 24 additions & 14 deletions CommonObjects.h
Expand Up @@ -4,6 +4,7 @@
#include <QImage>
#include <cstdio>
#include <iostream>
#include "qopenglerrorcheck.h"
#define PROGRAM_VERTEX_ATTRIBUTE 0
#define PROGRAM_TEXCOORD_ATTRIBUTE 1

Expand Down Expand Up @@ -126,20 +127,26 @@ struct GrayScalePreset{
float R;
float G;
float B;
int grayScaleMode;
void mode1(){
R = 1.0;
G = 1.0;
B = 1.0;
normalize();
grayScaleMode = 0;
}
void mode2(){
R = 0.3;
G = 0.59;
B = 0.11;
normalize();
grayScaleMode = 1;
}
QVector3D toQVector3D(){
//normalize();
void mode(){
if(grayScaleMode == 0) mode1();
if(grayScaleMode == 1) mode2();
}
QVector3D toQVector3D(){
return QVector3D(R,G,B);
}
void normalize(){
Expand Down Expand Up @@ -204,19 +211,19 @@ class FBOImages{
float aniso = 0.0;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &aniso);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);
glBindTexture(GL_TEXTURE_2D, 0);
GLCHK(glBindTexture(GL_TEXTURE_2D, 0));
qDebug() << "FBOImages::creatig new FBO(" << width << "," << height << ") with id=" << fbo->texture() ;
}
static void resize(QGLFramebufferObject *&src,QGLFramebufferObject *&ref){
if( ref->width() == src->width() &&
ref->height() == src->height() ){}else{
FBOImages::create(src ,ref->width(),ref->height());
GLCHK(FBOImages::create(src ,ref->width(),ref->height()));
}
}
static void resize(QGLFramebufferObject *&src,int width, int height){
if( width == src->width() &&
height == src->height() ){}else{
FBOImages::create(src ,width,height);
GLCHK(FBOImages::create(src ,width,height));
}
}

Expand Down Expand Up @@ -369,10 +376,11 @@ class FBOImageProporties{
scr_tex_height = image.height();
bFirstDraw = true;

FBOImages::create(ref_fbo ,image.width(),image.height());
FBOImages::create(fbo ,image.width(),image.height());
FBOImages::create(aux_fbo ,image.width(),image.height());
FBOImages::create(aux2_fbo,image.width(),image.height());
GLCHK(FBOImages::create(ref_fbo ,image.width(),image.height()));
GLCHK(FBOImages::create(fbo ,image.width(),image.height()));
GLCHK(FBOImages::create(aux_fbo ,image.width(),image.height()));
GLCHK(FBOImages::create(aux2_fbo,image.width(),image.height()));

}

void updateSrcTexId(QGLFramebufferObject* in_ref_fbo){
Expand All @@ -384,10 +392,10 @@ class FBOImageProporties{
}

void resizeFBO(int width, int height){
FBOImages::resize(ref_fbo ,width,height);
FBOImages::resize(fbo ,width,height);
FBOImages::resize(aux_fbo ,width,height);
FBOImages::resize(aux2_fbo,width,height);
GLCHK(FBOImages::resize(ref_fbo ,width,height));
GLCHK(FBOImages::resize(fbo ,width,height));
GLCHK(FBOImages::resize(aux_fbo ,width,height));
GLCHK(FBOImages::resize(aux2_fbo,width,height));
bFirstDraw = true;
}

Expand All @@ -402,12 +410,14 @@ class FBOImageProporties{

~FBOImageProporties(){
qDebug() << "<FBOImageProporties> delete.";
if(glIsTexture(scr_tex_id)) glWidget_ptr->deleteTexture(scr_tex_id);
glWidget_ptr->makeCurrent();
if(glIsTexture(scr_tex_id)) GLCHK(glWidget_ptr->deleteTexture(scr_tex_id));
glWidget_ptr = NULL;
if(ref_fbo != NULL ) delete ref_fbo;
if(fbo != NULL ) delete fbo;
if(aux_fbo != NULL ) delete aux_fbo;
if(aux2_fbo != NULL ) delete aux2_fbo;

}
};

Expand Down
Binary file added ShortAbout.pdf
Binary file not shown.
63 changes: 47 additions & 16 deletions config.ini
Expand Up @@ -8,7 +8,7 @@ t_d_bGrayScale=false
t_d_bInvertR=false
t_d_bInvertB=false
t_d_bRemoveShading=false
t_d_noRemoveShadingGaussIter=9
t_d_noRemoveShadingGaussIter=6
t_d_noBlurPasses=0
t_d_bSpeclarControl=false
t_d_specularRadius=1
Expand All @@ -18,17 +18,17 @@ t_d_specularContrast=@Variant(\0\0\0\x87\xbf\x80\0\0)
t_d_specularAmplifier=@Variant(\0\0\0\x87\xc1 \0\0)
t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_d_detailDepth=@Variant(\0\0\0\x87?\xa0\0\0)
t_d_detailDepth=@Variant(\0\0\0\x87?@\0\0)
t_d_sharpenBlurAmount=0
t_d_normalsStep=@Variant(\0\0\0\x87>\xdc(\xf6)
t_d_conversionHNDepth=@Variant(\0\0\0\x87?\x19\x99\x9a)
t_d_bConversionHN=false
t_d_bConversionNH=false
t_d_conversionNHIters=4
t_d_bConversionBaseMap=false
t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf:\xe1H)
t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\xf9\x99\x9a)
t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0)
t_d_conversionBaseMapNoIters=5
t_d_conversionBaseMapNoIters=25
t_d_conversionBaseMapFilterRadius=2
t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87>\xcf\\))
t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0)
Expand All @@ -46,7 +46,7 @@ t_n_specularContrast="@Variant(\0\0\0\x87=L\xcc\xcd)"
t_n_specularAmplifier=@Variant(\0\0\0\x87@@\0\0)
t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_n_detailDepth=@Variant(\0\0\0\x87@\0\0\0)
t_n_detailDepth=@Variant(\0\0\0\x87?@\0\0)
t_n_sharpenBlurAmount=0
t_n_normalsStep=@Variant(\0\0\0\x87?}p\xa4)
t_n_conversionHNDepth=@Variant(\0\0\0\x87>L\xcc\xcd)
Expand All @@ -70,11 +70,11 @@ t_s_bSpeclarControl=true
t_s_specularRadius=20
t_s_specularW1=@Variant(\0\0\0\x87<#\xd7\n)
t_s_specularW2=@Variant(\0\0\0\x87\x41\xa0\0\0)
t_s_specularContrast=@Variant(\0\0\0\x87\xbe\xf0\xa3\xd7)
t_s_specularContrast=@Variant(\0\0\0\x87\xbf\x33\x33\x33)
t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\xa0\0\0)
t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_s_detailDepth=@Variant(\0\0\0\x87@\0\0\0)
t_s_detailDepth=@Variant(\0\0\0\x87?Y\x99\x9a)
t_s_sharpenBlurAmount=0
t_s_normalsStep=@Variant(\0\0\0\x87\0\0\0\0)
t_s_conversionHNDepth=@Variant(\0\0\0\x87>L\xcc\xcd)
Expand Down Expand Up @@ -102,7 +102,7 @@ t_h_specularContrast="@Variant(\0\0\0\x87=L\xcc\xcd)"
t_h_specularAmplifier=@Variant(\0\0\0\x87@@\0\0)
t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_h_detailDepth=@Variant(\0\0\0\x87@\0\0\0)
t_h_detailDepth=@Variant(\0\0\0\x87?Y\x99\x9a)
t_h_sharpenBlurAmount=0
t_h_normalsStep=@Variant(\0\0\0\x87\0\0\0\0)
t_h_conversionHNDepth=@Variant(\0\0\0\x87\x41\\\xcc\xcd)
Expand All @@ -122,13 +122,13 @@ t_s_bInvertG=false
t_h_bInvertG=false
d_win_w=1600
d_win_h=838
t_d_conversionBaseMapBlending=@Variant(\0\0\0\x87>\xd1\xeb\x85)
t_d_conversionBaseMapBlending=@Variant(\0\0\0\x87>\xcc\xcc\xcd)
t_o_bGrayScale=false
t_o_bInvertR=false
t_o_bInvertG=false
t_o_bInvertB=false
t_o_bRemoveShading=false
t_o_noRemoveShadingGaussIter=0
t_o_noRemoveShadingGaussIter=1
t_o_noBlurPasses=0
t_o_bSpeclarControl=false
t_o_specularRadius=1
Expand All @@ -138,7 +138,7 @@ t_o_specularContrast=@Variant(\0\0\0\x87\0\0\0\0)
t_o_specularAmplifier=@Variant(\0\0\0\x87\0\0\0\0)
t_o_smallDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_o_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0)
t_o_detailDepth=@Variant(\0\0\0\x87\0\0\0\0)
t_o_detailDepth=@Variant(\0\0\0\x87?@\0\0)
t_o_sharpenBlurAmount=0
t_o_normalsStep=@Variant(\0\0\0\x87\0\0\0\0)
t_o_conversionHNDepth=@Variant(\0\0\0\x87\0\0\0\0)
Expand All @@ -152,10 +152,10 @@ t_o_conversionBaseMapNoIters=0
t_o_conversionBaseMapFilterRadius=1
t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87\0\0\0\0)
t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0)
t_o_ssaoNoIters=20
t_o_ssaoBias=@Variant(\0\0\0\x87\xbf\x90\xa3\xd7)
t_o_ssaoDepth=@Variant(\0\0\0\x87>\xc7\xae\x14)
t_o_ssaoIntensity=@Variant(\0\0\0\x87?\x81G\xae)
t_o_ssaoNoIters=26
t_o_ssaoBias="@Variant(\0\0\0\x87\xbf\xb7\n=)"
t_o_ssaoDepth="@Variant(\0\0\0\x87>\x8a=q)"
t_o_ssaoIntensity=@Variant(\0\0\0\x87?^\xb8R)
o_postfix=_O
t_d_conversionNHItersHuge=10
t_d_conversionNHItersVeryLarge=10
Expand Down Expand Up @@ -212,5 +212,36 @@ t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0)
t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0)
t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0)
t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0)
t_s_specularBrightness=@Variant(\0\0\0\x87<\xa3\xd7\n)
t_s_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0)
h_attachNormal=true
t_d_grayScaleR=@Variant(\0\0\0\x87>\x98\x98\x99)
t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_s_grayScaleR=@Variant(\0\0\0\x87>\x98\x98\x99)
t_d_grayScaleG=@Variant(\0\0\0\x87?\x16\x96\x97)
t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_s_grayScaleG=@Variant(\0\0\0\x87?\x16\x96\x97)
t_d_grayScaleB="@Variant(\0\0\0\x87=\xe0\xe0\xe1)"
t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9)
t_s_grayScaleB="@Variant(\0\0\0\x87=\xe0\xe0\xe1)"
t_d_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0)
t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0)
t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0)
t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0)
t_s_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0)
t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0)
t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0)
t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0)
t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0)
t_s_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0)
t_d_heightAveragingRadius=1
t_h_heightAveragingRadius=1
t_n_heightAveragingRadius=1
t_o_heightAveragingRadius=1
t_s_heightAveragingRadius=1
gui_style=Fusion
2 changes: 2 additions & 0 deletions content.qrc
Expand Up @@ -32,5 +32,7 @@
<file>content/translateUV.png</file>
<file>content/grabCorners.png</file>
<file>content/scaleXYUV.png</file>
<file>content/filters.frag</file>
<file>content/filters.vert</file>
</qresource>
</RCC>
25 changes: 25 additions & 0 deletions content/filters.frag
Expand Up @@ -683,7 +683,23 @@ vec4 height_clamp(vec4 inputc, vec4 value,float vmin,float vmax){
if(dmin_ave.b > 0) inputc.b += dmin_ave.b;
return inputc;
}

vec4 height_clamp2(vec4 inputc, float weight,float vmin,float vmax){
vec4 dmax_ave = weight*(inputc - vec4(vmax));
vec4 output = inputc;
if(inputc.r > vmax) output.r = vmax + dmax_ave.r;
if(inputc.g > vmax) output.g = vmax + dmax_ave.g;
if(inputc.b > vmax) output.b = vmax + dmax_ave.b;

vec4 dmin_ave = weight*(inputc - vec4(vmin));
if(inputc.r < vmin) output.r = vmin + dmin_ave.r;
if(inputc.g < vmin) output.g = vmin + dmin_ave.g;
if(inputc.b < vmin) output.b = vmin + dmin_ave.b;
return output;
}

subroutine(filterModeType) vec4 mode_height_processing_filter(){

int radius = gui_height_proc_ave_radius/5+1;
float w = gui_height_proc_ave_radius/50.0; // "details" slider in gui
vec4 height = texture( layerA, v2QuadCoords.xy);
Expand All @@ -702,6 +718,15 @@ subroutine(filterModeType) vec4 mode_height_processing_filter(){
vec4 hmin = height_clamp(vec4(0.0),vec4(0.0),gui_height_proc_min_value,gui_height_proc_max_value);
vec4 hmax = height_clamp(vec4(1.0),vec4(1.0),gui_height_proc_min_value,gui_height_proc_max_value);
return vec4(height-hmin)/(hmax-hmin);

/*
vec4 height = texture( layerA, v2QuadCoords.xy);
float w = gui_height_proc_ave_radius/100.0;
height = height_clamp2(height,w,gui_height_proc_min_value,gui_height_proc_max_value);
vec4 hmin = height_clamp2(vec4(0.0),w,gui_height_proc_min_value,gui_height_proc_max_value);
vec4 hmax = height_clamp2(vec4(1.0),w,gui_height_proc_min_value,gui_height_proc_max_value);
return vec4(height-hmin)/(hmax-hmin);
*/
}


Expand Down
Binary file added content/icon.icns
Binary file not shown.
Binary file added content/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions content/plane.vert
Expand Up @@ -21,8 +21,8 @@ out vec4 staticLightPosition;

void main(void)
{
texc = (texCoord)*gui_uvScale + vec4(gui_uvScaleOffset,0,1);
float hPos = texture(texHeight , texc.st ).x;
texc = (texCoord)*gui_uvScale + vec4(gui_uvScaleOffset,0,1);
float hPos = texture(texHeight , texc.st ).x;

vertexPosition = ModelViewMatrix * ( vertex + vec4(0,0,(hPos)*gui_depthScale*0.1/gui_uvScale,0));
lightPosition = lightPos;// ModelViewMatrix * lightPos;
Expand Down

0 comments on commit b15c3e7

Please sign in to comment.