Skip to content

Commit 93d657e

Browse files
committed
Demo - clarify usage of last argument of rprContextResolveFrameBuffer.
1 parent 632b272 commit 93d657e

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

tutorials/05_basic_scene/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ int main()
134134

135135
// 'frame_buffer' is not supposed to be used for rendering, we need to process it with rprContextResolveFrameBuffer.
136136
// This function transforms the raw 'frame_buffer' into a new 'frame_buffer_resolved' that can be displayed on screen as final rendering.
137-
// The 'normalizeOnly' argument means we only want to do a normalization of 'frame_buffer'.
138-
// In most of cases, this argument can be left to FALSE: this lets the Renderer choose the correct operation(s) to process.
137+
// The 'noDisplayGamma'=false argument means we want to use display gamma (defined by RPR_CONTEXT_DISPLAY_GAMMA) which makes sense in this case as 'frame_buffer' represents COLOR.
138+
// If the framebuffer doesn't represent Color ( for example: Normals, Depth, UVs ... ) then 'noDisplayGamma' should be set to true.
139139
CHECK(rprContextResolveFrameBuffer(context,frame_buffer,frame_buffer_resolved,false));
140140

141141
// save the rendering to an image file.

tutorials/12_transform_motion_blur/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ int main()
140140
CHECK( rprContextSetParameterByKey1u(context,RPR_CONTEXT_ITERATIONS,200));
141141
CHECK( rprContextRender(context) );
142142
CHECK( rprContextResolveFrameBuffer(context,fb_color,fb_color_resolved,false));
143-
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,false));
143+
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,true));
144144
CHECK( rprFrameBufferSaveToFile(fb_color_resolved, "12_0.png") );
145145
std::cout << "Rendering 12_0 finished." << std::endl;
146146

@@ -162,7 +162,7 @@ int main()
162162
CHECK( rprFrameBufferClear(fb_velocity) );
163163
CHECK( rprContextRender(context) );
164164
CHECK( rprContextResolveFrameBuffer(context,fb_color,fb_color_resolved,false));
165-
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,false));
165+
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,true));
166166
CHECK( rprFrameBufferSaveToFile(fb_color_resolved, "12_1.png") );
167167
CHECK( rprFrameBufferSaveToFile(fb_velocity_resolved, "12_1v.png") );
168168
std::cout << "Rendering 12_1 finished." << std::endl;
@@ -176,7 +176,7 @@ int main()
176176
CHECK( rprFrameBufferClear(fb_velocity) );
177177
CHECK( rprContextRender(context) );
178178
CHECK( rprContextResolveFrameBuffer(context,fb_color,fb_color_resolved,false));
179-
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,false));
179+
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,true));
180180
CHECK( rprFrameBufferSaveToFile(fb_color_resolved, "12_2.png") );
181181
CHECK( rprFrameBufferSaveToFile(fb_velocity_resolved, "12_2v.png") );
182182
std::cout << "Rendering 12_2 finished." << std::endl;
@@ -190,7 +190,7 @@ int main()
190190
CHECK( rprFrameBufferClear(fb_velocity) );
191191
CHECK( rprContextRender(context) );
192192
CHECK( rprContextResolveFrameBuffer(context,fb_color,fb_color_resolved,false));
193-
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,false));
193+
CHECK( rprContextResolveFrameBuffer(context,fb_velocity,fb_velocity_resolved,true));
194194
CHECK( rprFrameBufferSaveToFile(fb_color_resolved, "12_3.png") );
195195
CHECK( rprFrameBufferSaveToFile(fb_velocity_resolved, "12_3v.png") );
196196
std::cout << "Rendering 12_3 finished." << std::endl;

tutorials/33_aov/main.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,25 @@ int main()
6363
//
6464
struct AOV_FB
6565
{
66-
AOV_FB(const std::string& name_, rpr_aov aov_)
66+
AOV_FB(const std::string& name_, rpr_aov aov_, bool useDisplayGamma_)
6767
{
6868
framebuffer = nullptr;
6969
framebuffer_res = nullptr;
7070
name = name_;
7171
aov = aov_;
72+
useDisplayGamma = useDisplayGamma_;
7273
}
7374
rpr_framebuffer framebuffer;
7475
rpr_framebuffer framebuffer_res;
7576
std::string name;
7677
rpr_aov aov;
78+
bool useDisplayGamma; // Set this parameter to TRUE for AOV representing Colors. For other AOVs storing data ( Normals, Depth ... ) make sure to set it to FALSE.
7779
};
7880
std::vector<AOV_FB> AOVlist;
79-
AOVlist.push_back(AOV_FB("geom_normal" ,RPR_AOV_GEOMETRIC_NORMAL));
80-
AOVlist.push_back(AOV_FB("shad_normal" ,RPR_AOV_SHADING_NORMAL));
81-
AOVlist.push_back(AOV_FB("obj_id" ,RPR_AOV_OBJECT_ID));
82-
AOVlist.push_back(AOV_FB("uv" ,RPR_AOV_UV));
81+
AOVlist.push_back(AOV_FB("geom_normal" ,RPR_AOV_GEOMETRIC_NORMAL, false));
82+
AOVlist.push_back(AOV_FB("shad_normal" ,RPR_AOV_SHADING_NORMAL, false));
83+
AOVlist.push_back(AOV_FB("obj_id" ,RPR_AOV_OBJECT_ID, false));
84+
AOVlist.push_back(AOV_FB("uv" ,RPR_AOV_UV, false));
8385

8486
// Create the list of AOVs
8587
//
@@ -96,7 +98,7 @@ int main()
9698
//
9799
for(auto& i : AOVlist)
98100
{
99-
CHECK( rprContextResolveFrameBuffer(context, i.framebuffer, i.framebuffer_res, false) );
101+
CHECK( rprContextResolveFrameBuffer(context, i.framebuffer, i.framebuffer_res, !i.useDisplayGamma) );
100102
CHECK( rprFrameBufferSaveToFile(i.framebuffer_res, std::string("33_"+i.name+".png").c_str() ) );
101103
CHECK( rprObjectDelete(i.framebuffer) );
102104
CHECK( rprObjectDelete(i.framebuffer_res) );

tutorials/common/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ void MatballScene::Render(const std::string& outImgFileName, int iterationCount)
299299

300300
if ( !m_usingHybridContext ) // There is no framebuffer resolve for Hyrbid
301301
{
302-
// last argument is FALSE because we don't want a simple normalization: we also want to apply the display gamma (changed with RPR_CONTEXT_DISPLAY_GAMMA)
302+
// last argument is FALSE because we want to apply the display gamma (changed with RPR_CONTEXT_DISPLAY_GAMMA) to this COLOR AOV.
303303
CHECK( rprContextResolveFrameBuffer(m_context, m_frame_buffer, m_frame_buffer_res, false) );
304304

305305
CHECK( rprFrameBufferSaveToFile(m_frame_buffer_res, outImgFileName.c_str() ) );

0 commit comments

Comments
 (0)