[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12415] branches/qdune/blender/extern/ qdune: Preliminary support for 'Arbitrary Output Variables'.
Alfredo de Greef
eeshlo at yahoo.com
Sun Oct 28 02:22:30 CET 2007
Revision: 12415
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12415
Author: eeshlo
Date: 2007-10-28 02:22:29 +0100 (Sun, 28 Oct 2007)
Log Message:
-----------
Preliminary support for 'Arbitrary Output Variables'.
Hopefully this will be useful to implement render passes
and maybe also renderlayers somehow.
This is very early code, and it is not quite complete yet,
but at least it won't break anything (I hope...)
For the standalone version of QD there is an example rib
file 'blsuz_AOV.rib' as a simple demonstration of AOV usage.
The shadercompiler should also now be able to handle shader outputs.
(it already did, but was not handled in the compiled code yet)
Modified Paths:
--------------
branches/qdune/blender/extern/qdune/SConstruct
branches/qdune/blender/extern/qdune/core/Attributes.h
branches/qdune/blender/extern/qdune/core/Camera.cpp
branches/qdune/blender/extern/qdune/core/Camera.h
branches/qdune/blender/extern/qdune/core/Options.cpp
branches/qdune/blender/extern/qdune/core/Options.h
branches/qdune/blender/extern/qdune/core/QDRender.h
branches/qdune/blender/extern/qdune/core/State.cpp
branches/qdune/blender/extern/qdune/core/State.h
branches/qdune/blender/extern/qdune/framebuffer/FrameBuffer.cpp
branches/qdune/blender/extern/qdune/framebuffer/FrameBuffer.h
branches/qdune/blender/extern/qdune/framework/ReyesFramework.cpp
branches/qdune/blender/extern/qdune/hider/RayTraceHider.cpp
branches/qdune/blender/extern/qdune/hider/ZbufferHider.cpp
branches/qdune/blender/extern/qdune/hider/ZbufferHider.h
branches/qdune/blender/extern/qdune/mpgrid/MicroPolygon.h
branches/qdune/blender/extern/qdune/mpgrid/MicroPolygonGrid.cpp
branches/qdune/blender/extern/qdune/mpgrid/MicroPolygonGrid.h
branches/qdune/blender/extern/qdune/ribparse/RIB_parser.cpp
branches/qdune/blender/extern/qdune/ribparse/RIB_parser.h
branches/qdune/blender/extern/qdune/ribparse/decparam.cpp
branches/qdune/blender/extern/qdune/ribparse/decparam.h
branches/qdune/blender/extern/qdune/ribparse/ri.cpp
branches/qdune/blender/extern/qdune/ribparse/ri.h
branches/qdune/blender/extern/qdune/ribs/blsuz.rib
branches/qdune/blender/extern/qdune/slcompiler/slcompile.py
branches/qdune/blender/extern/qdune/svm/slshader.cpp
branches/qdune/blender/extern/qdune/svm/slshader.h
Added Paths:
-----------
branches/qdune/blender/extern/qdune/core/AOV.h
branches/qdune/blender/extern/qdune/ribs/blsuz_AOV.rib
branches/qdune/blender/extern/qdune/shaders/matte_output.sqd
Modified: branches/qdune/blender/extern/qdune/SConstruct
===================================================================
--- branches/qdune/blender/extern/qdune/SConstruct 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/SConstruct 2007-10-28 01:22:29 UTC (rev 12415)
@@ -13,9 +13,9 @@
if debug:
# for gdb/valgrind, lflags as normal
- cppflags = Split("-Wall -g -O0 -fno-inline -I/usr/X11R6/include `pkg-config --cflags OpenEXR`")
+ cppflags = Split("-Wall -g -O0 -funsigned-char -fno-inline -I/usr/X11R6/include `pkg-config --cflags OpenEXR`")
else:
- cppflags = Split("-Wall -Wextra -Wno-unused -Wwrite-strings -O3 -march=athlon64 -ffast-math -I/usr/X11R6/include `pkg-config --cflags OpenEXR`")
+ cppflags = Split("-Wall -Wextra -Wno-unused -Wwrite-strings -O3 -march=athlon64 -funsigned-char -ffast-math -I/usr/X11R6/include `pkg-config --cflags OpenEXR`")
lflags = Split("-ljpeg `pkg-config --libs OpenEXR`")
if profile:
Added: branches/qdune/blender/extern/qdune/core/AOV.h
===================================================================
--- branches/qdune/blender/extern/qdune/core/AOV.h (rev 0)
+++ branches/qdune/blender/extern/qdune/core/AOV.h 2007-10-28 01:22:29 UTC (rev 12415)
@@ -0,0 +1,26 @@
+#ifndef _AOV_H
+#define _AOV_H
+
+#include "decparam.h"
+
+#include "QDRender.h"
+__BEGIN_QDRENDER
+
+// Arbitrary Output Variable
+// actually used for all outputs, not just aov's
+class AOV_t
+{
+private:
+ AOV_t(const AOV_t&);
+ AOV_t& operator=(const AOV_t&);
+public:
+ AOV_t() : name(NULL), framebuffer(false) {}
+ ~AOV_t() { if (name) delete[] name; name = NULL; }
+ const char* name;
+ decParam_t param;
+ bool framebuffer; // direct display
+};
+
+__END_QDRENDER
+
+#endif // _AOV_H
Modified: branches/qdune/blender/extern/qdune/core/Attributes.h
===================================================================
--- branches/qdune/blender/extern/qdune/core/Attributes.h 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/core/Attributes.h 2007-10-28 01:22:29 UTC (rev 12415)
@@ -61,6 +61,7 @@
// optional attributes
RtFloat displacementbound_sphere;
RtFloat opacity_threshold;
+
unsigned int numlights, pad0;
};
Modified: branches/qdune/blender/extern/qdune/core/Camera.cpp
===================================================================
--- branches/qdune/blender/extern/qdune/core/Camera.cpp 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/core/Camera.cpp 2007-10-28 01:22:29 UTC (rev 12415)
@@ -13,7 +13,7 @@
eye.set(0, 0, 0);
aim.set(0, 0, 1);
up.set(0, 1, 0);
-
+
fov = opt.fov;
fdist = opt.focalDistance;
inv_fdist = 1.f/fdist;
@@ -27,14 +27,14 @@
ortho = (opt.projection == Options::PROJ_ORTHOGRAPHIC);
nearclip = opt.nearClip;
farclip = opt.farClip;
-
+
if (opt.blender.enabled) {
if (ortho)
cam2scr = Ortho(opt.blender.viewPlane[0], opt.blender.viewPlane[1],
- opt.blender.viewPlane[2], opt.blender.viewPlane[3], nearclip, farclip);
+ opt.blender.viewPlane[2], opt.blender.viewPlane[3], nearclip, farclip);
else
cam2scr = Frustum(opt.blender.viewPlane[0], opt.blender.viewPlane[1],
- opt.blender.viewPlane[2], opt.blender.viewPlane[3], nearclip, farclip);
+ opt.blender.viewPlane[2], opt.blender.viewPlane[3], nearclip, farclip);
}
else {
if (ortho)
@@ -45,16 +45,15 @@
wld2scr = cam2scr * wld2cam;
aspect = opt.pixelAspectRatio;
- float scr[4] = {opt.left, opt.right, opt.bottom, opt.top};
-
+
if (opt.blender.enabled)
scr2ras = Translate(0.f, (float)height, 0.f) * Scale(1.f, -1.f, 1.f) *
- Scale((float)width/2.0f, (float)height/2.0f, 1.f) *
- Translate(1.f, 1.f, 0.f);
+ Scale((float)width/2.0f, (float)height/2.0f, 1.f) *
+ Translate(1.f, 1.f, 0.f);
else
scr2ras = Scale((float)width, (float)height, 1.f) *
- Scale(1.f/(scr[1] - scr[0]), 1.f/(scr[2] - scr[3]), 1.f) *
- Translate(-scr[0], -scr[3], 0.f);
+ Scale(1.f/(opt.right - opt.left), 1.f/(opt.bottom - opt.top), 1.f) *
+ Translate(-opt.left, -opt.top, 0.f);
ras2scr = scr2ras;
ras2scr.invert();
@@ -94,24 +93,4 @@
(cam2wld*toVector(ras2cam*Point3(x, y+1, 0))).normalize());
}
-
-ray_t Camera::eyeRay_FB(float x, float y)
-{
- /*
- const Point3 Pcam(ras2cam * point3d_t(x, y, 0));
- Vector direction(toVector(Pcam));
- if (lrad > 0.f) {
- float u, v;
- shirleyDisc(H2.getNext(), H3.getNext(), u, v);
- u *= lrad, v *= lrad;
- point3d_t Pfocus = origin + (fdist / direction.z)*direction;
- origin.x += u, origin.y += v;
- direction = Pfocus - origin;
- }
- direction.normalize();
- return ray_t(cam2wld*pcam, cam2wld*direction);
- */
- return ray_t();
-}
-
__END_QDRENDER
Modified: branches/qdune/blender/extern/qdune/core/Camera.h
===================================================================
--- branches/qdune/blender/extern/qdune/core/Camera.h 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/core/Camera.h 2007-10-28 01:22:29 UTC (rev 12415)
@@ -19,7 +19,6 @@
~Camera() {}
void init(const Options& opt);
ray_t eyeRay(float x, float y);
- ray_t eyeRay_FB(float x, float y);
Point3 project(const Point3 &w) const;
const Vector& getUp() const { return up; }
const Point3& getEye() const { return eye; }
Modified: branches/qdune/blender/extern/qdune/core/Options.cpp
===================================================================
--- branches/qdune/blender/extern/qdune/core/Options.cpp 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/core/Options.cpp 2007-10-28 01:22:29 UTC (rev 12415)
@@ -1,7 +1,7 @@
-#include <iostream>
-
#include "Options.h"
+#include <cstring>
+
__BEGIN_QDRENDER
#ifdef _MSC_VER
@@ -54,18 +54,30 @@
gain = gamma = 1;
// RiImager, undefined, and for now just an actual pointer, not used
imager = NULL;
- // RiQuantize (color)
- cqOne = cqMax = 255;
- cqMin = 0;
- cqDitherAmplitude = 0.5;
+
+ // RiQuantize (color) now in DisplayData, see above
// RiQuantize (depth), only 'one' is defined
zqOne = zqMax = zqMin = 0;
zqDitherAmplitude = 0.f;
- // RiDisplay, not defined, implementation specific
- // assume framebuffer
- displayType = DT_FRAMEBUFFER;
- strncpy(displayName, "default_rgb_framebuffer", 80);
- displayMode = DM_RGB;
+
+ // RiDisplay, implementation specific
+ // assume 1 output, framebuffer mode
+ num_out = 1;
+ // initialize all to default values
+ for (int i=0; i<MAX_AOV; ++i) {
+ DisplayData& dd = displaydata[i];
+ dd.displayType = DT_FRAMEBUFFER;
+ dd.displayMode = DM_RGB;
+ // default 8-bit output
+ dd.zeroval = dd.minval = 0;
+ dd.oneval = dd.maxval = 255;
+ dd.dither = 0.5f;
+ memset(dd.displayName, 0, 80);
+ memset(dd.AOV_name, 0, 80);
+ }
+ // default display name
+ strncpy(displaydata[0].displayName, "default_rgb_framebuffer", 80);
+
// Additional
// RiHider
hider = HD_HIDDEN;
Modified: branches/qdune/blender/extern/qdune/core/Options.h
===================================================================
--- branches/qdune/blender/extern/qdune/core/Options.h 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/core/Options.h 2007-10-28 01:22:29 UTC (rev 12415)
@@ -7,16 +7,21 @@
#include "QDRender.h"
__BEGIN_QDRENDER
-// unused
-/*
-struct ClippingPlane
+enum DisplayType_t {DT_FRAMEBUFFER, DT_FILE, DT_ZFILE, DT_BLENDER};
+enum DisplayMode_t {DM_RGB, DM_RGBA, DM_RGBZ, DM_RGBAZ, DM_A, DM_Z, DM_AZ, // standard modes
+ DM_AOV_FLOAT, DM_AOV_COLOR}; // for AOV's, float/color only
+
+struct DisplayData
{
- ClippingPlane():x(0), y(0), z(0), nx(0), ny(0), nz(0) {}
- ClippingPlane(float _x, float _y, float _z, float _nx, float _ny, float _nz)
- : x(_x), y(_y), z(_z), nx(_nx), ny(_ny), nz(_nz) {}
- float x, y, z, nx, ny, nz;
+ DisplayType_t displayType;
+ DisplayMode_t displayMode;
+ char displayName[80];
+ // quantize
+ float zeroval, oneval, minval, maxval;
+ float dither;
+ // the short name as used in display statement, must be a known declared name
+ char AOV_name[80];
};
-*/
class Options
{
@@ -38,7 +43,7 @@
// extra clipping planes // RiClippingPlane
//std::vector<ClippingPlane> clippingPlanes;
RtFloat fStop, focalLength, // RiDepthOfField
- focalDistance;
+ focalDistance;
RtFloat openShutter, closeShutter; // RiShutter
// Display
@@ -52,10 +57,11 @@
RtFloat cqDitherAmplitude;
RtInt zqOne, zqMin, zqMax; // RiQuantize (depth)
RtFloat zqDitherAmplitude;
+
// RiDisplay
- enum {DT_FRAMEBUFFER, DT_FILE, DT_ZFILE, DT_BLENDER} displayType;
- char displayName[80];
- enum {DM_RGB, DM_RGBA, DM_RGBZ, DM_RGBAZ, DM_A, DM_Z, DM_AZ} displayMode;
+ DisplayData displaydata[MAX_AOV];
+ RtInt num_out; // number of outputs
+
// Additional
enum {HD_HIDDEN, HD_RAYTRACE, HD_HYBRID} hider; // RiHider
// Color samples support for RGB only
Modified: branches/qdune/blender/extern/qdune/core/QDRender.h
===================================================================
--- branches/qdune/blender/extern/qdune/core/QDRender.h 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/core/QDRender.h 2007-10-28 01:22:29 UTC (rev 12415)
@@ -37,4 +37,7 @@
typedef unsigned long long uint64;
#endif
+// maximum number of 'arbitrary output variables'
+const int MAX_AOV = 16;
+
#endif // _QDRENDER_H
Modified: branches/qdune/blender/extern/qdune/core/State.cpp
===================================================================
--- branches/qdune/blender/extern/qdune/core/State.cpp 2007-10-28 01:01:46 UTC (rev 12414)
+++ branches/qdune/blender/extern/qdune/core/State.cpp 2007-10-28 01:22:29 UTC (rev 12415)
@@ -123,7 +123,9 @@
{ RI_TEXTUREMEMORY, {SC_CONSTANT|DT_INT, 1, 1}},
{ RI_GRIDSIZE, {SC_CONSTANT|DT_INT, 1, 1}},
{ RI_BINARY, {SC_CONSTANT|DT_INT, 1, 1}},
- { RI_EYESPLITS, {SC_CONSTANT|DT_INT, 1, 1}}
+ { RI_EYESPLITS, {SC_CONSTANT|DT_INT, 1, 1}},
+ { RI_QUANTIZE, {SC_CONSTANT|DT_FLOAT, 4, 4}},
+ { RI_DITHER, {SC_CONSTANT|DT_FLOAT, 1, 1}}
};
// state create
@@ -192,9 +194,15 @@
{
ftime(&TYD2);
cout << "rendertime: " << ((TYD2.time - TYD1.time)*1000 + (TYD2.millitm - TYD1.millitm))*0.001f << endl;
- framebuffer->finalize();
}
+void State::finalizeFramebuffers()
+{
+ const int num_out = topOptions().num_out;
+ for (int i=0; i<num_out; ++i)
+ framebuffer[i]->finalize();
+}
+
// parameter declarations
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list