Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PACANOWSKI Romain
MRF
Commits
22f3fda7
Commit
22f3fda7
authored
Oct 16, 2019
by
MURRAY David
Browse files
fix after rebase on master
parent
789e560e
Changes
14
Hide whitespace changes
Inline
Side-by-side
apps/malia/gui/mrf_ImGui.h
View file @
22f3fda7
...
...
@@ -44,7 +44,7 @@ protected:
enum
UI_MODE
{
INIT
,
RESET
,
LOOP
DISPLAY
};
void
controlPanel
(
UI_MODE
mode
);
virtual
void
customUI
(
UI_MODE
mode
);
...
...
apps/malia/gui/mrf_ImGui_shader.cpp
View file @
22f3fda7
...
...
@@ -15,8 +15,8 @@ using optix::float3;
#include
"externals/imgui/imgui_impl_glfw.h"
#include
"externals/imgui/imgui_impl_opengl3.h"
ImGUI_shader
::
ImGUI_shader
()
:
ImGUI
(),
_fbo_ready
(
false
),
_quad_ready
(
false
),
_ssbo_ready
(
false
)
ImGUI_shader
::
ImGUI_shader
(
mrf
::
gui
::
fb
::
Loger
::
LEVEL
const
&
logging_level
)
:
ImGUI
(
logging_level
),
_fbo_ready
(
false
),
_quad_ready
(
false
),
_ssbo_ready
(
false
)
{
_num_queries
=
1
;
_radius_query
=
0.001
f
;
...
...
@@ -35,9 +35,9 @@ ImGUI_shader::~ImGUI_shader()
}
void
ImGUI_shader
::
initializeUI
(
int
w
,
int
h
)
void
ImGUI_shader
::
initializeUI
(
mrf
::
rendering
::
OptixRenderer
*
renderer
)
{
ImGUI
::
initializeUI
(
w
,
h
);
ImGUI
::
initializeUI
(
renderer
);
std
::
string
pathToShaders
=
std
::
string
(
getenv
(
"MRF_DIR"
))
+
"/apps/malia/gui/gl_src/shaders/"
;
...
...
@@ -100,6 +100,18 @@ void ImGUI_shader::customUI(ImGUI::UI_MODE mode)
}
}
bool
ImGUI_shader
::
doRendering
()
{
bool
ret
=
GUI
::
doRendering
();
if
(
_textureList
.
size
()
<=
2
)
_textureList
.
push_back
(
Texture
(
_renderer
->
getPositionBuffer
(),
"position_buffer"
));
else
_textureList
[
POSITION
].
updateTextureFromBuffer
(
_renderer
->
getPositionBuffer
());
return
ret
;
}
void
ImGUI_shader
::
display
()
{
// Start the Dear ImGui frame
...
...
@@ -146,7 +158,7 @@ void ImGUI_shader::display()
_pathlog
->
loadKdTree
();
}
_current_mode
=
LOOP
;
_current_mode
=
DISPLAY
;
}
void
ImGUI_shader
::
offScreenRender
(
Shader
*
prg
,
bool
use_tex
)
...
...
@@ -155,7 +167,7 @@ void ImGUI_shader::offScreenRender(Shader* prg, bool use_tex)
if
(
use_tex
)
{
_textureList
[
DISPLAY
].
activate
(
prg
);
_textureList
[
COLOR
].
activate
(
prg
);
_textureList
[
POSITION
].
activate
(
prg
);
}
bindSSBO
();
...
...
@@ -167,7 +179,7 @@ void ImGUI_shader::offScreenRender(Shader* prg, bool use_tex)
unbindSSBO
();
if
(
use_tex
)
{
_textureList
[
DISPLAY
].
deactivate
();
_textureList
[
COLOR
].
deactivate
();
_textureList
[
POSITION
].
deactivate
();
}
...
...
@@ -296,27 +308,16 @@ void ImGUI_shader::setParameters(Shader* prg)
void
ImGUI_shader
::
mousePress
(
int
button
,
int
action
,
int
mods
)
{
ImGuiIO
&
io
=
ImGui
::
GetIO
();
double
x
,
y
;
if
(
action
==
GLFW_PRESS
)
{
glfwGetCursorPos
(
_window
,
&
x
,
&
y
);
io
.
MousePos
=
ImVec2
((
float
)
x
,
(
float
)
y
);
io
.
MouseDown
[
button
]
=
true
;
}
else
if
(
action
==
GLFW_RELEASE
)
{
io
.
MouseDown
[
button
]
=
false
;
}
if
(
!
io
.
WantCaptureMouse
)
// Avoid passing event to the application when a GUI widget is active
{
GUI
_BASE
::
mousePress
(
button
,
action
,
mods
);
GUI
::
mousePress
(
button
,
action
,
mods
);
if
(
action
==
GLFW_PRESS
)
{
if
(
_is_picking
)
{
double
x
,
y
;
glfwGetCursorPos
(
_window
,
&
x
,
&
y
);
_pathlog
->
clearVectors
();
_pathlog
->
setPickCoord
(
optix
::
make_int2
(
x
,
y
));
if
(
_pick_by_radius
)
...
...
@@ -338,12 +339,10 @@ void ImGUI_shader::mousePress(int button, int action, int mods)
void
ImGUI_shader
::
charPress
(
unsigned
int
codepoint
)
{
ImGuiIO
&
io
=
ImGui
::
GetIO
();
if
(
codepoint
>
0
&&
codepoint
<
0x10000
)
io
.
AddInputCharacter
((
unsigned
short
)
codepoint
);
if
(
!
io
.
WantCaptureKeyboard
&&
!
io
.
WantTextInput
)
// Avoid passing event to the application when a GUI widget is active
if
(
!
io
.
WantTextInput
)
// Avoid passing event to the application when a GUI widget is active
{
GUI
_BASE
::
charPress
(
codepoint
);
GUI
::
charPress
(
codepoint
);
if
(
codepoint
==
'a'
)
{
std
::
string
pathToShaders
=
std
::
string
(
getenv
(
"MRF_DIR"
))
+
"/apps/malia/gui/gl_src/shaders/"
;
...
...
apps/malia/gui/mrf_ImGui_shader.h
View file @
22f3fda7
...
...
@@ -16,16 +16,17 @@ class MRF_EXPORT ImGUI_shader : public ImGUI
{
public:
ImGUI_shader
();
ImGUI_shader
(
mrf
::
gui
::
fb
::
Loger
::
LEVEL
const
&
logging_level
);
virtual
~
ImGUI_shader
();
virtual
void
initializeUI
(
int
w
,
int
h
);
virtual
void
initializeUI
(
mrf
::
rendering
::
OptixRenderer
*
renderer
=
nullptr
);
virtual
void
display
();
virtual
bool
doRendering
();
virtual
void
mousePress
(
int
button
,
int
action
,
int
mods
);
virtual
void
charPress
(
unsigned
int
codepoint
);
protected:
virtual
void
customUI
(
UI_MODE
mode
);
...
...
apps/malia/gui/mrf_gui.cpp
View file @
22f3fda7
...
...
@@ -18,7 +18,7 @@ _arcball(optix::make_float2(0.5f), 1.0f),
_camera_changed
(
true
),
_render_on_pause
(
false
),
_mouse_pressed
(
false
),
_mouse_prev_pos
(
optix
::
make_double2
(
0.
,
0.
)),
_pathlog
(
NULL
),
_is_picking
(
false
),
_pick_by_radius
(
false
),
_displayTexture
(
DISPLAY
)
_displayTexture
(
COLOR
)
{
_clearColor
=
optix
::
make_float4
(
1.
f
);
}
...
...
@@ -34,12 +34,13 @@ void GUI::setRenderer(mrf::rendering::OptixRenderer* renderer)
_camera_changed
=
true
;
}
void
GUI
::
initializeUI
(
mrf
::
rendering
::
OptixRenderer
*
renderer
)
void
GUI_BASE
::
setPathLog
(
PathLog
*
log
)
void
GUI
::
setPathLog
(
PathLog
*
log
)
{
_pathlog
=
log
;
}
void
GUI
::
initializeUI
(
mrf
::
rendering
::
OptixRenderer
*
renderer
)
{
//TODO later: if nullptr, create a full initialized renderer ? Or add a check to disable most events as long as no scene has been imported.
if
(
renderer
==
nullptr
)
_renderer
=
new
mrf
::
rendering
::
OptixRenderer
(
mrf
::
gui
::
fb
::
Loger
::
LEVEL
::
Info
);
...
...
@@ -254,19 +255,28 @@ bool GUI::doRendering()
#endif//endif SPECTRAL mode
}
if
(
_textureList
.
size
()
==
0
)
{
_textureList
.
push_back
(
Texture
(
_renderer
->
getDisplayBuffer
(),
"display_buffer"
));
_textureList
.
push_back
(
Texture
(
_renderer
->
getOutputBuffer
(),
"display_buffer"
));
//No need to use another name as only one of the two will be used at once.
}
else
{
_textureList
[
COLOR
].
updateTextureFromBuffer
(
_renderer
->
getDisplayBuffer
());
_textureList
[
OUTPUT
].
updateTextureFromBuffer
(
_renderer
->
getOutputBuffer
());
}
return
display_output_buffer_directly
;
}
void
GUI
::
display
()
{
if
(
_display_output_buffer_directly
)
mrf
::
optix_backend
::
displayBufferGL
(
_renderer
->
getOutputBuffer
(),
mrf
::
optix_backend
::
BUFFER_PIXEL_FORMAT_DEFAULT
,
true
);
else
mrf
::
optix_backend
::
displayBufferGL
(
_renderer
->
getDisplayBuffer
(),
mrf
::
optix_backend
::
BUFFER_PIXEL_FORMAT_DEFAULT
,
true
);
if
(
_renderer
->
hasScene
())
{
static
unsigned
frame_count
=
0
;
mrf
::
optix_backend
::
displayFps
(
frame_count
++
,
_render_on_pause
);
if
(
_display_output_buffer_directly
)
mrf
::
optix_backend
::
displayBufferGL
(
_renderer
->
getOutputBuffer
(),
mrf
::
optix_backend
::
BUFFER_PIXEL_FORMAT_DEFAULT
,
true
);
else
mrf
::
optix_backend
::
displayBufferGL
(
_renderer
->
getDisplayBuffer
(),
mrf
::
optix_backend
::
BUFFER_PIXEL_FORMAT_DEFAULT
,
true
);
}
}
...
...
apps/malia/gui/mrf_gui.h
View file @
22f3fda7
...
...
@@ -21,9 +21,8 @@
#endif
#include
"gl_src/texture.h"
class
GUI
class
MRF_EXPORT
GUI
_BASE
class
MRF_EXPORT
GUI
{
public:
GUI
(
mrf
::
gui
::
fb
::
Loger
::
LEVEL
const
&
logging_level
);
...
...
@@ -101,16 +100,16 @@ protected:
std
::
string
_camera_output_file
;
std
::
string
_scene_file
;
bool
_display_output_buffer_directly
;
bool
_is_picking
;
bool
_is_picking
;
optix
::
float4
_clearColor
;
std
::
vector
<
Texture
>
_textureList
;
unsigned
int
_displayTexture
;
bool
_pick_by_radius
;
bool
_pick_by_radius
;
enum
TextureName
{
DISPLAY
,
COLOR
,
OUTPUT
,
POSITION
,
FBO
,
...
...
apps/malia/main.cpp
View file @
22f3fda7
...
...
@@ -133,7 +133,6 @@ void dropWrapper(GLFWwindow* window, int count, const char** paths)
_gui
->
dropEvent
(
window
,
count
,
paths
);
}
void
installRenderingFunc
(
GLFWwindow
*
win
)
{
glfwSetFramebufferSizeCallback
(
win
,
resizeWrapper
);
...
...
@@ -144,19 +143,7 @@ void installRenderingFunc(GLFWwindow* win)
glfwSetScrollCallback
(
win
,
mouseScrollWrapper
);
glfwSetDropCallback
(
win
,
dropWrapper
);
}
#endif//RENDERER_INTERACTIVE==1
{
mrf
::
util
::
PrecisionTimer
timer
;
timer
.
start
();
_renderer
->
importMrfScene
();
return
timer
.
elapsed
();
}
#endif
void
printUsage
()
...
...
@@ -230,10 +217,6 @@ int main(int argc, char** argv)
mrf
::
util
::
ArgsParsing
parser
(
argc
,
argv
);
if
(
parser
.
hasArgument
(
ARG_LIST
::
HELP
))
bool
load_path_analysis
=
false
;
bool
save_path_analysis
=
false
;
bool
full_path_analysis
=
false
;
std
::
string
pathLog_file
;
printUsage
();
if
(
parser
.
hasArgument
(
ARG_LIST
::
LOGGING
))
...
...
@@ -296,39 +279,24 @@ int main(int argc, char** argv)
else
if
(
rng
==
"sobol"
)
rng_type
=
SOBOL
;
if
(
command_line
.
hasOption
(
"path_analysis"
))
bool
load_path_analysis
=
false
;
bool
save_path_analysis
=
false
;
bool
full_path_analysis
=
false
;
if
(
parser
.
hasArgument
(
ARG_LIST
::
PATH_LOG
))
{
if
(
command_line
.
option
(
"path_analysis"
).
nbParameter
()
>
0
)
{
std
::
string
path_option
=
command_line
.
option
(
"path_analysis"
).
parameter
(
0
);
std
::
string
path_option
=
parser
.
getSingleValue
(
ARG_LIST
::
PATH_LOG
);
if
(
path_option
==
"load"
)
load_path_analysis
=
true
;
else
if
(
path_option
==
"save"
)
save_path_analysis
=
true
;
else
if
(
path_option
==
"full"
)
{
if
(
renderer_interactive
)
if
(
parser
.
hasArgument
(
ARG_LIST
::
INTERACTIVE
)
)
full_path_analysis
=
true
;
}
if
(
command_line
.
hasOption
(
"sts"
))
{
if
(
command_line
.
option
(
"sts"
).
nbParameter
()
>
0
)
{
samples_to_save
=
stoi
(
command_line
.
option
(
"sts"
).
parameter
(
0
));
}
}
if
(
command_line
.
hasOption
(
"samples_to_save"
))
{
if
(
command_line
.
option
(
"samples_to_save"
).
nbParameter
()
>
0
)
{
samples_to_save
=
stoi
(
command_line
.
option
(
"samples_to_save"
).
parameter
(
0
));
}
}
}
}
_renderer
->
setRngType
(
rng_type
);
_renderer
->
setMaxPathLength
(
stoi
(
parser
.
getSingleValue
(
ARG_LIST
::
MPL
)));
...
...
@@ -337,9 +305,7 @@ int main(int argc, char** argv)
if
(
parser
.
hasArgument
(
ARG_LIST
::
RNG_SEED
))
_renderer
->
setRNGSeed
(
stoi
(
parser
.
getSingleValue
(
ARG_LIST
::
MPL
)));
_renderer
->
setMaxSamples
(
max_samples
);
_renderer
->
setSamplesToSave
(
samples_to_save
);
_renderer
->
setMaxPathLength
(
max_path_length
);
#ifdef MRF_RENDERING_MODE_SPECTRAL
...
...
@@ -355,11 +321,11 @@ int main(int argc, char** argv)
_renderer
->
createRenderContext
(
parser
.
hasArgument
(
ARG_LIST
::
INTERACTIVE
));
#endif
loger
.
info
(
"Time to import scene in OptiX Backend: "
,
initRendererScene
());
if
(
parser
.
hasArgument
(
ARG_LIST
::
SCENE
)
&&
parser
.
hasArgument
(
ARG_LIST
::
CAMERA
))
_renderer
->
importMrfScene
(
parser
.
getSingleValue
(
ARG_LIST
::
SCENE
),
parser
.
getSingleValue
(
ARG_LIST
::
CAMERA
),
stoi
(
parser
.
getSingleValue
(
ARG_LIST
::
START_CAMERA
)));
_renderer
->
setNumSamplesPerFrame
(
stoi
(
parser
.
getSingleValue
(
ARG_LIST
::
SPF
)));
_renderer
->
setMaxSamples
(
stoi
(
parser
.
getSingleValue
(
ARG_LIST
::
SAMPLES
)));
/*
//TODO
_renderer.setInstancing(true);
...
...
@@ -371,16 +337,11 @@ int main(int argc, char** argv)
#if RENDERER_INTERACTIVE
if
(
parser
.
hasArgument
(
ARG_LIST
::
NO_GUI
))
{
_gui
=
new
GUI
(
loger
.
level
());
if
(
command_line
.
hasOption
(
"use_shader"
)
||
load_path_analysis
||
full_path_analysis
)
_gui
=
new
ImGUI_shader
;
else
}
else
if
(
load_path_analysis
||
full_path_analysis
)
_gui
=
new
ImGUI_shader
(
loger
.
level
());
else
{
_gui
=
new
ImGUI
(
loger
.
level
());
}
if
(
parser
.
hasArgument
(
ARG_LIST
::
INTERACTIVE
))
{
...
...
@@ -407,32 +368,18 @@ int main(int argc, char** argv)
if
(
load_path_analysis
)
{
if
(
pathLog_file
.
size
()
==
0
)
{
string
dir
;
mrf
::
util
::
StringParsing
::
getDirectory
(
output_files
[
0
].
c_str
(),
dir
);
pathLog_file
=
dir
+
"pathLog"
;
}
_pathLog
=
new
PathLog
;
_pathLog
->
setRenderer
(
_renderer
);
_pathLog
->
setCamera
();
_pathLog
->
loadKdTree
(
pa
thLog_file
);
_pathLog
->
loadKdTree
(
pa
rser
.
getSingleValue
(
ARG_LIST
::
PATH_LOG_FILE
)
);
_gui
->
setPathLog
(
_pathLog
);
}
else
if
(
full_path_analysis
)
{
if
(
pathLog_file
.
size
()
==
0
)
{
string
dir
;
mrf
::
util
::
StringParsing
::
getDirectory
(
output_files
[
0
].
c_str
(),
dir
);
pathLog_file
=
dir
+
"pathLog"
;
}
_pathLog
=
new
PathLog
;
_pathLog
->
setRenderer
(
_renderer
);
_pathLog
->
setCamera
();
_pathLog
->
setLogFile
(
pa
thLog_file
);
_pathLog
->
setLogFile
(
pa
rser
.
getSingleValue
(
ARG_LIST
::
PATH_LOG_FILE
)
);
_gui
->
setPathLog
(
_pathLog
);
}
...
...
@@ -478,7 +425,7 @@ int main(int argc, char** argv)
std
::
cout
<<
"The total number of spectral pass is equal to 1 disabling assets update"
<<
std
::
endl
;
}
_renderer
->
setMaxSamples
(
stoi
(
parser
.
getSingleValue
(
ARG_LIST
::
SAMPLES
)));
//_renderer->setDebugPixels(debug_pixels);
loger
.
info
(
_renderer
->
getInfos
());
...
...
@@ -503,21 +450,9 @@ int main(int argc, char** argv)
if
(
save_path_analysis
)
{
if
(
pathLog_file
.
size
()
==
0
)
{
string
dir
;
mrf
::
util
::
StringParsing
::
getDirectory
(
output_files
[
i
].
c_str
(),
dir
);
if
(
cameras
.
size
()
>
1
)
{
pathLog_file
=
dir
+
camera_name
+
"_"
+
"pathLog"
;
}
else
{
pathLog_file
=
dir
+
"pathLog"
;
}
}
_renderer
->
savePathInfo
(
pathLog_file
);
_pathLog
=
new
PathLog
;
_pathLog
->
setRenderer
(
_renderer
);
_pathLog
->
savePathInfo
(
parser
.
getSingleValue
(
ARG_LIST
::
PATH_LOG_FILE
));
}
#else//spectral rendering mode
...
...
@@ -565,11 +500,6 @@ int main(int argc, char** argv)
delete
_gui
;
}
#endif
#if(WIN32)
//system("pause");
#else
#endif
}
...
...
apps/malia/optixPathTracer.cu
View file @
22f3fda7
...
...
@@ -162,8 +162,6 @@ RT_PROGRAM void pathtrace_camera()
if
(
prd
.
done
)
{
// if(prd.countEmitted == false)
// impactPos += prd.origin / samples_per_pixel;
break
;
}
...
...
@@ -210,27 +208,27 @@ RT_PROGRAM void pathtrace_camera()
seed
=
prd
.
seed
;
if
(
log_path
==
1
&&
frame_number
-
1
<
samples_to_save
)
if
(
log_path
==
1
&&
spp_buffer
[
launch_index
]
<
samples_to_save
)
{
uint3
index
;
index
.
x
=
launch_index
.
x
;
index
.
y
=
launch_index
.
y
;
//
index.z = spp_buffer[launch_index] + prd.depth * samples_to_save;
index
.
z
=
frame_number
-
1
+
prd
.
depth
*
samples_to_save
;
index
.
z
=
spp_buffer
[
launch_index
]
+
prd
.
depth
*
samples_to_save
;
//
index.z = frame_number-1 + prd.depth * samples_to_save;
float3
brdf
=
pathInfo_buffer
[
index
].
lo
;
// float3 rad_i = pathInfo_buffer[index].li / float(max_samples) / float(num_samples_per_frame);
float3
rad_i
=
pathInfo_buffer
[
index
].
li
/
float
(
samples_to_save
)
/
float
(
num_samples_per_frame
);
bool
light_reached
=
(
length
(
pathInfo_buffer
[
index
].
li
)
>
0.
f
)
?
true
:
false
;
//
if(light_reached)
if
(
light_reached
)
{
if
(
prd
.
depth
>
0
&&
prd
.
depth
<=
max_path_length
)
{
for
(
int
i
=
prd
.
depth
-
1
;
i
>=
0
;
--
i
)
{
//
index.z = spp_buffer[launch_index] + i * samples_to_save;
index
.
z
=
frame_number
-
1
+
i
*
samples_to_save
;
index
.
z
=
spp_buffer
[
launch_index
]
+
i
*
samples_to_save
;
//
index.z = frame_number-1 + i * samples_to_save;
pathInfo_buffer
[
index
].
li
=
rad_i
;
brdf
=
pathInfo_buffer
[
index
].
lo
;
...
...
@@ -240,19 +238,19 @@ RT_PROGRAM void pathtrace_camera()
}
spp_buffer
[
launch_index
]
+=
1
;
}
//
else
//
{
//
for(int i = max_path_length - 1; i >= 0; --i)
//
{
// //
index.z = spp_buffer[launch_index] + i * samples_to_save;
else
{
for
(
int
i
=
max_path_length
-
1
;
i
>=
0
;
--
i
)
{
index
.
z
=
spp_buffer
[
launch_index
]
+
i
*
samples_to_save
;
// index.z = frame_number-1 + i * samples_to_save;
//
pathInfo_buffer[index].position = make_float3(0.f);
//
pathInfo_buffer[index].wi = make_float3(0.f);
//
pathInfo_buffer[index].wo = make_float3(0.f);
//
pathInfo_buffer[index].li = make_float3(0.f);
//
pathInfo_buffer[index].lo = make_float3(0.f);
//
}
//
}
pathInfo_buffer
[
index
].
position
=
make_float3
(
0.
f
);
pathInfo_buffer
[
index
].
wi
=
make_float3
(
0.
f
);
pathInfo_buffer
[
index
].
wo
=
make_float3
(
0.
f
);
pathInfo_buffer
[
index
].
li
=
make_float3
(
0.
f
);
pathInfo_buffer
[
index
].
lo
=
make_float3
(
0.
f
);
}
}
}
}
...
...
cuda/materials/diffuse_emitter.cu
View file @
22f3fda7
...
...
@@ -64,13 +64,13 @@ RT_PROGRAM void diffuseEmitter()
current_prd
.
result
+=
emission_color
*
current_prd
.
attenuation
;
#endif
if
(
log_path
==
1
&&
frame_number
-
1
<
samples_to_save
)
if
(
log_path
==
1
&&
spp_buffer
[
launch_index
]
<
samples_to_save
)
{
uint3
index
;
index
.
x
=
launch_index
.
x
;
index
.
y
=
launch_index
.
y
;
//
index.z = spp_buffer[launch_index] + current_prd.depth * samples_to_save;
index
.
z
=
frame_number
-
1
+
current_prd
.
depth
*
samples_to_save
;
index
.
z
=
spp_buffer
[
launch_index
]
+
current_prd
.
depth
*
samples_to_save
;
//
index.z = frame_number-1 + current_prd.depth * samples_to_save;
if
(
current_prd
.
depth
<=
max_path_length
)
{
...
...
cuda/materials/material_eval.cu
View file @
22f3fda7
...
...
@@ -444,12 +444,12 @@ RT_PROGRAM void material_eval()
mult_color
(
result
,
current_prd
.
attenuation
);
mult_color
(
result
,
mis_weight
);
add_color
(
current_prd
.
result
,
result
);
//
add_color(current_prd.result, result);
}
else
{
mult_color
(
result
,
current_prd
.
attenuation
);
add_color
(
current_prd
.
result
,
result
);
//
add_color(current_prd.result, result);
}
}
}
...
...
@@ -483,7 +483,7 @@ RT_PROGRAM void material_eval()
mult_color
(
light_emission
,
num_lights
*
mis_weight
);
mult_color
(
result
,
light_emission
);
mult_color
(
result
,
current_prd
.
attenuation
);
add_color
(
current_prd
.
result
,
result
);
//
add_color(current_prd.result, result);
}
}
}
//endif use_mis
...
...
@@ -558,13 +558,13 @@ RT_PROGRAM void material_eval()
//update energy along the ray relative to brdf importance sampling
mult_color
(
current_prd
.
attenuation
,
brdf_dot_nl_div_by_pdf
);
if
(
log_path
==
1
&&
frame_number
-
1
<
samples_to_save
)
if
(
log_path
==
1
&&
spp_buffer
[
launch_index
]
<
samples_to_save
)
{
uint3
index
;
index
.
x
=
launch_index
.
x
;
index
.
y
=
launch_index
.
y
;
//
index.z = spp_buffer[launch_index] + current_prd.depth * samples_to_save;
index
.
z
=
frame_number
-
1
+
current_prd
.
depth
*
samples_to_save
;
index
.
z
=
spp_buffer
[
launch_index
]
+
current_prd
.
depth
*
samples_to_save
;
//
index.z = frame_number-1 + current_prd.depth * samples_to_save;
if
(
current_prd
.
depth
<=
max_path_length
)
{
...
...
externals/path_info/PathLog.cpp
View file @
22f3fda7
...
...
@@ -75,14 +75,14 @@ void PathLog::savePathInfo(std::string const & filename)
std
::
string
bounceFilename
;
file
.
open
(
filename
+
"_header.txt"
,
std
::
ios
::
out
);
file
<<
height
<<
" "
<<
width
<<
" "
<<
_renderer
->
get
Max
Samples
()
<<
" "
<<
_renderer
->
getMaxPathLength
()
<<
std
::
endl
;
file
<<
height
<<
" "
<<
width
<<
" "
<<
_renderer
->
getSamples
ToSave
()
<<
" "
<<
_renderer
->
getMaxPathLength
()
<<
std
::
endl
;
file
.
close
();
PathInfo
*
pathInfo
=
static_cast
<
PathInfo
*>
(
pathData
);
bounceFilename
=
filename
+
"_samples.txt"
;
file
.
open
(
bounceFilename
,
std
::
ios
::
out
|
std
::
ios
::
binary
);
file
.
write
((
char
*
)
pathData
,
height
*
width
*
_renderer
->
get
Max
Samples
()
*
_renderer
->
getMaxPathLength
()
*
sizeof
(
PathInfo
));
file
.
write
((
char
*
)
pathData
,
height
*
width
*
_renderer
->
getSamples
ToSave
()
*
_renderer
->
getMaxPathLength
()
*
sizeof
(
PathInfo
));
file
.
close
();
_loger
.
info
(
"Saved all path info"
);
...
...
mrf/rendering/optix_renderer.cpp
View file @
22f3fda7
...
...
@@ -432,37 +432,6 @@ void OptixRenderer::debugSpectralOptixBuffer(std::string const &prepend_to_filen
#endif
void
OptixRenderer
::
savePathInfo
(
std
::
string
const
&
filename
,
std
::
string
additional_comments
)
{
auto
buffer
=
_context
[
"pathInfo_buffer"
]
->
getBuffer
()
->
get
();
int
width
,
height
;
RTsize
buffer_width
,
buffer_height
;
void
*
pathData
;
RT_CHECK_ERROR
(
rtBufferMap
(
buffer
,
&
pathData
));
RT_CHECK_ERROR
(
rtBufferGetSize2D
(
buffer
,
&
buffer_width
,
&
buffer_height
));
width
=
static_cast
<
int
>
(
buffer_width
);
height
=
static_cast
<
int
>
(
buffer_height
);
std
::
ofstream
file
;