Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed shaders and perlin noise params

  • Loading branch information...
commit a5adab1416ad7ad12e234cd0eae85b986c16b0e8 1 parent 05fd9d3
@obviousjim authored
View
16 RGBDVisualize/RGBDVisualize.xcodeproj/project.pbxproj
@@ -1428,7 +1428,7 @@
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_MODEL_TUNING = G5;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_VERSION = "";
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO;
GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO;
@@ -1440,7 +1440,7 @@
"-D__MACOSX_CORE__",
"-lpthread",
);
- SDKROOT = macosx10.6;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
};
name = Debug;
};
@@ -1461,7 +1461,7 @@
GCC_OPTIMIZATION_LEVEL = 3;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_UNROLL_LOOPS = YES;
- GCC_VERSION = "";
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO;
GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO;
@@ -1472,7 +1472,7 @@
"-D__MACOSX_CORE__",
"-lpthread",
);
- SDKROOT = macosx10.6;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
};
name = Release;
};
@@ -1491,7 +1491,7 @@
GCC_MODEL_TUNING = G4;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
- GCC_VERSION = "";
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
INFOPLIST_FILE = "openFrameworks-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
@@ -1566,7 +1566,7 @@
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3 = "\"$(SRCROOT)/../../../addons/ofxOpenCv/libs/opencv/lib/osx\"";
PREBINDING = NO;
PRODUCT_NAME = RGBDVisualizeDebug;
- SDKROOT = macosx10.6;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
VALID_ARCHS = i386;
WRAPPER_EXTENSION = app;
};
@@ -1586,7 +1586,7 @@
GCC_MODEL_TUNING = G4;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
- GCC_VERSION = "";
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
INFOPLIST_FILE = "openFrameworks-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
@@ -1661,7 +1661,7 @@
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../../../addons/ofxOpenCv/libs/opencv/lib/osx\"";
PREBINDING = NO;
PRODUCT_NAME = RGBDVisualize;
- SDKROOT = macosx10.6;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
VALID_ARCHS = i386;
WRAPPER_EXTENSION = app;
};
View
3  RGBDVisualize/bin/data/shaders/unproject.frag
@@ -5,7 +5,6 @@ uniform sampler2DRect tex0;
void main()
{
vec4 col = texture2DRect(tex0, gl_TexCoord[0].st);
- col.a = 1.;
- gl_FragColor = col;
+ gl_FragColor = col * gl_Color;
}
View
2  RGBDVisualize/bin/data/shaders/unproject.vert
@@ -4,6 +4,7 @@ uniform vec2 fudge;
void main(void)
{
gl_Position = ftransform();
+ gl_FrontColor = gl_Color;
mat4 tTex = gl_TextureMatrix[0];
vec4 texCd = tTex * gl_Vertex;
@@ -15,7 +16,6 @@ void main(void)
texCd.x = 1. - texCd.x;
texCd.xy += fudge;
- //debug = -tTex[3][2] > 20. ? 1. : 0.;
texCd.xy *= dim;
gl_TexCoord[0] = texCd;
}
View
141 RGBDVisualize/src/testApp.cpp
@@ -169,15 +169,11 @@ void testApp::setup(){
gui.loadFromXML();
gui.toggleDraw();
-// currentXScale = 1.0;
-// currentYScale = 1.0;
-// currentXAdditiveShift = 0;
-// currentYAdditiveShift = 0;
-// currentRotationCompensation = 0;
-
currentLockCamera = false;
cameraTrack.lockCameraToTrack = false;
+ accumulatedPerlinOffset = 0;
+
}
void testApp::loadShaders(){
@@ -244,11 +240,12 @@ void testApp::populateTimelineElements(){
timeline.addKeyframes("Sine Amplitude", currentCompositionDirectory + "SineAmp.xml", ofRange(0, sqrtf(100)) );
timeline.addKeyframes("Sine Frequency", currentCompositionDirectory + "SineFrequency.xml", ofRange(.00, 1) );
timeline.addKeyframes("Sine Speed", currentCompositionDirectory + "SineSpeed.xml", ofRange(-sqrtf(1.5), sqrtf(1.5)), 0 );
+ timeline.addKeyframes("Depth Blur", currentCompositionDirectory + "DepthBlur.xml", ofRange(0, 10), 0 );
timeline.addPage("Geometry Distortion", true);
timeline.addKeyframes("Perlin Amp", "PerlinAmp.xml", ofRange(0, 200.0) );
timeline.addKeyframes("Perlin Density", "PerlinDensity.xml", ofRange(0, 200.0) );
- timeline.addKeyframes("Perlin Speed", "PerlinSpeed.xml", ofRange(0, 200.0) );
+ timeline.addKeyframes("Perlin Speed", "PerlinSpeed.xml", ofRange(0, sqrtf(15.)) );
// timeline.addPage("Lumen Noise", true);
@@ -276,6 +273,8 @@ void testApp::processDepthFrame(){
float sineSpeed = timeline.getKeyframeValue("Sine Speed");
float sineAmp = timeline.getKeyframeValue("Sine Amplitude");
float sineFrequency = timeline.getKeyframeValue("Sine Frequency");
+ int blur = timeline.getKeyframeValue("Depth Blur");
+
sineFrequency *= sineFrequency;
sineSpeed = sineSpeed;
sineAmp *= sineAmp;
@@ -295,13 +294,16 @@ void testApp::processDepthFrame(){
depthSequence.currentDepthRaw.getPixels()[index] += ofRandom(noise);
}
- if(sineAmp > 0 && holeFilledPixels.getPixels()[index] > 0){
+ if(sineAmp > 0 && depthSequence.currentDepthRaw.getPixels()[index] > 0){
//holeFilledPixels.getPixels()[index] += sin( y * sineFrequency + timeline.getCurrentFrame() * sineSpeed ) * sineAmp;
depthSequence.currentDepthRaw.getPixels()[index] += sin( y * sineFrequency + timeline.getCurrentFrame() * sineSpeed ) * sineAmp;
- }
-
+ }
}
}
+
+ //Mat m_element_m = getStructuringElement(MORPH_RECT, cv::Size(kernelSize, kernelSize));
+ ofxCv::blur(depthSequence.currentDepthRaw, blur);
+
}
void testApp::processGeometry(){
@@ -317,11 +319,14 @@ void testApp::processGeometry(){
float perlinAmp = timeline.getKeyframeValue("Perlin Amp");
float perlinDensity = timeline.getKeyframeValue("Perlin Density");
float perlinSpeed = timeline.getKeyframeValue("Perlin Speed");
+ perlinSpeed *= perlinSpeed;
// float contract = timeline.getKeyframeValue("Contract");
// float explode = timeline.getKeyframeValue("Explode");
float contract = 0; //timeline.getKeyframeValue("Contract");
float explode = 0; //timeline.getKeyframeValue("Explode");
+ accumulatedPerlinOffset += perlinSpeed;
+
ofVec3f center(0,0,0);
for(int i = 0; i < renderer.getMesh().getVertices().size(); i++){
center += renderer.getMesh().getVertex(i);
@@ -331,9 +336,9 @@ void testApp::processGeometry(){
for(int i = 0; i < renderer.getMesh().getVertices().size(); i++){
ofVec3f& vert = renderer.getMesh().getVertices()[i];
if(perlinAmp > 0){
- renderer.getMesh().getVertices()[i] += ofVec3f(ofSignedNoise(vert.x/perlinDensity, vert.y/perlinDensity, vert.z/perlinDensity, ofGetElapsedTimef()/perlinDensity)*perlinAmp,
- ofSignedNoise(vert.z/perlinDensity, vert.x/perlinDensity, vert.y/perlinDensity, ofGetElapsedTimef()/perlinDensity)*perlinAmp,
- ofSignedNoise(vert.y/perlinDensity, vert.z/perlinDensity, vert.x/perlinDensity, ofGetElapsedTimef()/perlinDensity)*perlinAmp );
+ renderer.getMesh().getVertices()[i] += ofVec3f(ofSignedNoise(vert.x/perlinDensity, vert.y/perlinDensity, vert.z/perlinDensity, accumulatedPerlinOffset)*perlinAmp,
+ ofSignedNoise(vert.z/perlinDensity, vert.x/perlinDensity, vert.y/perlinDensity, accumulatedPerlinOffset)*perlinAmp,
+ ofSignedNoise(vert.y/perlinDensity, vert.z/perlinDensity, vert.x/perlinDensity, accumulatedPerlinOffset)*perlinAmp );
}
//vert.interpolate(center, contract);
@@ -382,10 +387,15 @@ void testApp::drawGeometry(){
return;
}
+// if(!rendererDirty){
+// cout << "not dirty before" << endl;
+// }
+
rendererDirty |= (renderedCameraPos.getPosition() != cam.getPosition() ||
renderedCameraPos.getOrientationQuat() != cam.getOrientationQuat() );
if(rendererDirty){
+// cout << "dirty from camera" << endl;
renderedCameraPos.setPosition(cam.getPosition());
renderedCameraPos.setOrientation(cam.getOrientationQuat());
@@ -473,7 +483,7 @@ void testApp::drawGeometry(){
//ofEnableBlendMode(blendMode);
glEnable(GL_DEPTH_TEST);
- ofSetColor(255);
+ ofSetColor(255*wireAlpha);
float thickness = timeline.getKeyframeValue("Wireframe Thickness");
thickness *= thickness;
ofSetLineWidth(thickness);
@@ -491,7 +501,7 @@ void testApp::drawGeometry(){
ofPushStyle();
//ofEnableAlphaBlending();
ofEnableBlendMode(blendMode);
- ofSetColor(255, 255, 255, wireAlpha*255);
+ ofSetColor(255);
swapFbo.getTextureReference().draw(renderFboRect);
ofPopStyle();
@@ -518,12 +528,9 @@ void testApp::drawGeometry(){
renderer.drawMesh(false);
ofPopMatrix();
}
- ofEnableBlendMode(blendMode);
- ofSetColor(255);
- //glEnable(GL_DEPTH_TEST);
- //ofEnableAlphaBlending();
+ ofEnableAlphaBlending();
+ ofSetColor(255*pointAlpha);
glEnable(GL_POINT_SMOOTH); // makes circular points
- //glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB); // allows per-point size
float pointSize = timeline.getKeyframeValue("Point Size");
glPointSize(pointSize*pointSize);
renderer.drawPointCloud();
@@ -540,7 +547,7 @@ void testApp::drawGeometry(){
ofPushStyle();
//ofEnableAlphaBlending();
ofEnableBlendMode(blendMode);
- ofSetColor(255, 255, 255, pointAlpha*255);
+ ofSetColor(255);
swapFbo.getTextureReference().draw(renderFboRect);
ofPopStyle();
@@ -770,6 +777,50 @@ void testApp::keyPressed(int key){
depthSequence.toggleThumbs();
}
+ if(key == '1'){
+ gui.setPage(1);
+ }
+ else if(key == '2'){
+ gui.setPage(2);
+ }
+ else if(key == '3'){
+ gui.setPage(3);
+ }
+ else if(key == '4'){
+ gui.setPage(4);
+ }
+ else if(key == '5'){
+ gui.setPage(5);
+ }
+
+ if(key == '!'){
+ timeline.setCurrentPage(0);
+ }
+ else if(key == '@'){
+ timeline.setCurrentPage(1);
+ }
+ else if(key == '#'){
+ timeline.setCurrentPage(2);
+ }
+ else if(key == '$'){
+ timeline.setCurrentPage(3);
+ }
+ else if(key == '%'){
+ timeline.setCurrentPage(4);
+ }
+ else if(key == '^'){
+ timeline.setCurrentPage(5);
+ }
+ else if(key == '&'){
+ timeline.setCurrentPage(6);
+ }
+ else if(key == '*'){
+ timeline.setCurrentPage(7);
+ }
+ else if(key == '('){
+ timeline.setCurrentPage(8);
+ }
+
}
//--------------------------------------------------------------
@@ -1030,16 +1081,13 @@ void testApp::update(){
if(currentXMultiplyShift != renderer.xmult ||
currentYMultiplyShift != renderer.ymult ||
- //currentSimplify != renderer.getSimplification() ||
currentMirror != renderer.mirror ||
-// currentZFuzz != renderer.ZFuzz ||
fillHoles != holeFiller.enable ||
currentHoleKernelSize != holeFiller.getKernelSize() ||
currentHoleFillIterations != holeFiller.getIterations())
{
renderer.xmult = currentXMultiplyShift;
renderer.ymult = currentYMultiplyShift;
-// renderer.ZFuzz = currentZFuzz;
renderer.mirror = currentMirror;
holeFiller.enable = fillHoles;
@@ -1048,7 +1096,6 @@ void testApp::update(){
holeFiller.setIterations(currentHoleFillIterations);
currentHoleFillIterations = holeFiller.getIterations();
- //renderer.update();
updateRenderer(*lowResPlayer);
}
@@ -1056,7 +1103,7 @@ void testApp::update(){
updateRenderer(*lowResPlayer);
}
- if(!temporalAlignmentMode && !currentlyRendering && lowResPlayer->getSpeed() == 0.0){
+ if(!temporalAlignmentMode && !currentlyRendering && lowResPlayer->getSpeed() == 0.0 && videoTimelineElement.getSelectedFrame() != timeline.getCurrentFrame()){
videoTimelineElement.selectFrame(timeline.getCurrentFrame());
}
}
@@ -1317,7 +1364,7 @@ bool testApp::loadAssetsFromCompositionDirectory(string currentMediaFolder) {
if(pairingsFile == ""){
pairingsFile = ofFilePath::removeExt(smallVideoPath) + "_pairings.xml";
}
- cout << "********** frameExtracted " << calibrationDirectory << endl;
+
if(!loadAlignmentMatrices(calibrationDirectory)){
ofSystemAlertDialog("Load Failed -- Couldn't Load Calibration Directory.");
return false;
@@ -1416,11 +1463,6 @@ bool testApp::loadVideoFile(string hiResPath, string lowResPath){
videoTimelineElement.setVideoPlayer(*lowResPlayer, videoThumbsPath);
lowResPlayer->play();
lowResPlayer->setSpeed(0);
-
- //TEMP
-// hiResPlayer->play();
-// hiResPlayer->setSpeed(0);
-// hiResPlayer->setVolume(0);
return true;
}
@@ -1538,27 +1580,20 @@ void testApp::saveComposition(){
projectsettings.setValue("drawDepthDistortion", drawDepthDistortion);
projectsettings.setValue("drawGeometryDistortion", drawGeometryDistortion);
projectsettings.setValue("selfOcclude",selfOcclude);
-// projectsettings.setValue("wireframeSelfOccludes",wireframeSelfOccludes);
projectsettings.setValue("drawDOF",drawDOF);
projectsettings.setValue("cameraSpeed", cam.speed);
projectsettings.setValue("cameraRollSpeed", cam.rollSpeed);
projectsettings.setValue("xmult", currentXMultiplyShift);
projectsettings.setValue("ymult", currentYMultiplyShift);
-// projectsettings.setValue("xshift", currentXAdditiveShift);
-// projectsettings.setValue("yshift", currentYAdditiveShift);
-// projectsettings.setValue("xscale", currentXScale);
-// projectsettings.setValue("yscale", currentYScale);
projectsettings.setValue("fillholes", fillHoles);
projectsettings.setValue("kernelSize", currentHoleKernelSize);
projectsettings.setValue("holeIterations", currentHoleFillIterations);
-// projectsettings.setValue("zfuzz", currentZFuzz);
projectsettings.setValue("pointcloud", drawPointcloud);
projectsettings.setValue("wireframe", drawWireframe);
projectsettings.setValue("mesh", drawMesh);
-// projectsettings.setValue("simplify",currentSimplify);
projectsettings.setValue("mirror", currentMirror);
projectsettings.setValue("duration", currentDuration);
@@ -1566,8 +1601,6 @@ void testApp::saveComposition(){
projectsettings.setValue("videoin", videoInPercent);
projectsettings.setValue("videoout", videoOutPercent);
-// projectsettings.setValue("xrot", renderer.rotateMeshX);
-
projectsettings.saveFile();
lastSavedDate = "Last Saved on " + ofToString(ofGetMonth() ) + "/" + ofToString( ofGetDay()) + " at " + ofToString(ofGetHours()) + ":" + ofToString( ofGetMinutes() ) + ":" + ofToString( ofGetSeconds() );
@@ -1632,41 +1665,24 @@ bool testApp::loadCompositionAtIndex(int i){
drawGeometryDistortion= projectsettings.getValue("drawGeometryDistortion", true);
drawDOF = projectsettings.getValue("drawDOF",true);
-// pointsSelfOcclude = projectsettings.getValue("pointsSelfOcclude", false);
selfOcclude = projectsettings.getValue("selfOcclude",false);
currentXMultiplyShift = projectsettings.getValue("xmult", 0.);
currentYMultiplyShift = projectsettings.getValue("ymult", 0.);
-// currentXAdditiveShift = projectsettings.getValue("xshift", 0.);
-// currentYAdditiveShift = projectsettings.getValue("yshift", 0.);
-// currentXScale = projectsettings.getValue("xscale", 1.0);
-// currentYScale = projectsettings.getValue("yscale", 1.0);
-// currentEdgeCull = projectsettings.getValue("edgeCull", 50);
-// farClip = projectsettings.getValue("farClip", 5000);
drawPointcloud = projectsettings.getValue("pointcloud", false);
drawWireframe = projectsettings.getValue("wireframe", false);
drawMesh = projectsettings.getValue("mesh", false);
-// currentSimplify = projectsettings.getValue("simplify", 1);
currentMirror = projectsettings.getValue("mirror", false);
currentDuration = projectsettings.getValue("duration", int(videoTimelineElement.videoThumbs.size()) );
enableVideoInOut = projectsettings.getValue("videoinout", false);
videoInPercent = projectsettings.getValue("videoin", 0.);
videoOutPercent = projectsettings.getValue("videoout", 1.);
- //renderer.rotateMeshX = projectsettings.getValue("xrot", 0);
fillHoles = projectsettings.getValue("fillholes", false);
currentHoleKernelSize = projectsettings.getValue("kernelSize", 1);
currentHoleFillIterations = projectsettings.getValue("holeIterations", 1);
-// currentZFuzz = projectsettings.getValue("zfuzz", 0.);
-
- //error condition for corrupted comps
- //if(currentDuration <= 0){
- currentDuration = lowResPlayer->getTotalNumFrames();
- //}
-// if(farClip <= 0){
-// farClip = 5000;
-// }
+ currentDuration = lowResPlayer->getTotalNumFrames();
shouldResetDuration = true;
//set keyframer files based on comp
@@ -1676,8 +1692,8 @@ bool testApp::loadCompositionAtIndex(int i){
cam.cameraPositionFile = currentCompositionDirectory + "camera_position.xml";
cam.loadCameraPosition();
-// timeline.setCurrentPage("Main");
+ accumulatedPerlinOffset = 0;
//turn off view comps
viewComps = false;
}
@@ -1689,7 +1705,7 @@ void testApp::objectDidMouseMove(ofxMSAInteractiveObject* object, int x, int y){
//--------------------------------------------------------------
void testApp::finishRender(){
- cout << "finishing render" << endl;
+
currentlyRendering = false;
comps[currentCompIndex]->batchExport = false;
comps[currentCompIndex]->wasRenderedInBatch = true;
@@ -1702,10 +1718,7 @@ void testApp::finishRender(){
}
//no more left, we are done
- //stopCameraPlayback();
renderer.setRGBTexture(*lowResPlayer);
-// renderer.setTextureScale(1.0*lowResPlayer->getWidth()/hiResPlayer->getWidth(),
-// 1.0*lowResPlayer->getHeight()/hiResPlayer->getHeight());
}
View
5 RGBDVisualize/src/testApp.h
@@ -100,10 +100,11 @@ class testApp : public ofBaseApp, public ofxMSAInteractiveObjectDelegate {
bool shouldExportSettings;
unsigned short* depthPixelDecodeBuffer;
- ofShortPixels holeFilledPixels;
+// ofShortPixels holeFilledPixels;
bool allLoaded;
-
+ float accumulatedPerlinOffset;
+
ofxGameCamera cam;
ofxTLCameraTrack cameraTrack;
bool sampleCamera;
Please sign in to comment.
Something went wrong with that request. Please try again.