NVIDIA Index example code nvidia_logo_transpbg.gif Up
ray_sampling_overlap.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright 2023 NVIDIA Corporation. All rights reserved.
3 *****************************************************************************/
4
5#ifndef EXAMPLES_RAY_SAMPLING_OVERLAPPING_H
6#define EXAMPLES_RAY_SAMPLING_OVERLAPPING_H
7
9
10#include <nv/index/iscene_group.h>
11#include <nv/index/icylinder.h>
12#include <nv/index/icone.h>
13#include <nv/index/isphere.h>
14#include <nv/index/iellipsoid.h>
15#include <nv/index/iplane.h>
16
17#include <nv/index/imaterial.h>
18#include <nv/index/ilight.h>
19
20#include <nv/index/app/application_layer_utility.h>
21
22namespace overlap {
23
24static const char* program_begin =
25";NV_IDX_XAC_VERSION_1_0 \n"
26" \n"
27"class Surface_sample_program \n"
28"{ \n"
29" NV_IDX_SURFACE_SAMPLE_PROGRAM \n"
30" \n"
31"public: \n"
32" int counter; \n"
33" \n"
34" NV_IDX_DEVICE_INLINE_MEMBER void initialize() \n"
35" { \n"
36" counter = 0; \n"
37" } \n"
38" \n"
39;
40
41static const char* program_end =
42"}; \n"
43;
44
45static const char* color_program =
46" NV_IDX_DEVICE_INLINE_MEMBER int execute( \n"
47" const Sample_info_self& sample_info, \n"
48" Sample_output& sample_output) \n"
49" { \n"
50" const uint light_id = state.self.get_light_id(); \n"
51" const uint material_id = state.self.get_material_id(); \n"
52" \n"
53" const float3 ray_direction = normalize(sample_info.ray_direction); \n"
54" float4 color = nv::index::xaclib::phong_shading( \n"
55" state.scene, material_id, light_id, \n"
56" ray_direction, \n"
57" sample_info.sample_normal, true); \n"
58" \n"
59" color.w = 1.f; \n"
60" const float screen_gamma = 0.6f; \n"
61" color = nv::index::xaclib::gamma_correct(color, screen_gamma); \n"
62" sample_output.set_color(color); \n"
63" return NV_IDX_PROG_OK; \n"
64" } \n"
65;
66
67static const char* inquire_program =
68" // The user program used for picking. \n"
69" NV_IDX_DEVICE_INLINE_MEMBER int inquire( \n"
70" const Sample_info_self& sample_info, \n"
71" Query_results& query_results) \n"
72" { \n"
73" // sample_info.ray_t is automatically written \n"
74" // color is automatically written \n"
75" \n"
76" // we could invalidate current sample to skip/ignore it \n"
77" //query_results.invalidate_sample(); \n"
78" \n"
79" // write some attribute value of current sample \n"
80" const float v = \n"
81" sample_info.scene_position.x; \n"
82" query_results.write_value<float>(0u /*user_value_idx*/, v); \n"
83" \n"
84" counter += 1; \n"
85" if (counter & 1) { \n"
86" // write every other counter as user value \n"
87" query_results.write_value<int>(1u /*user_value_idx*/, counter); \n"
88" } \n"
89" \n"
90" const float3 normal = sample_info.sample_normal; \n"
91" query_results.write_value<float3>(2u /*user_value_idx*/, normal); \n"
92" \n"
93" return NV_IDX_PROG_OK; \n"
94" \n"
95" // we can stop sampling: \n"
96" //return NV_IDX_PROG_TERMINATE_PROGRAM_INSTANCE; \n"
97" } \n"
98;
99
100
101
102
103namespace volume {
104
105static const char* program_begin =
106";NV_IDX_XAC_VERSION_1_0 \n"
107" \n"
108"class Volume_sample_program \n"
109"{ \n"
110" NV_IDX_VOLUME_SAMPLE_PROGRAM \n"
111" \n"
112"public: \n"
113" int counter; \n"
114" \n"
115" NV_IDX_DEVICE_INLINE_MEMBER void initialize() \n"
116" { \n"
117" counter = 0; \n"
118" } \n"
119" \n"
120;
121
122static const char* program_end =
123"}; \n"
124;
125
126static const char* color_program_scalar =
127" NV_IDX_DEVICE_INLINE_MEMBER int execute( \n"
128" const Sample_info_self& sample_info, \n"
129" Sample_output& sample_output) \n"
130" { \n"
131//" const float3& sample_position = sample_info.sample_position; \n"
132//" // scalar volume sample \n"
133//" const float volume_sample = state.self.sample<float>(sample_position); \n"
134//" // lookup color and opacity values from colormap \n"
135//" const float4 sample_color = state.self.get_colormap().lookup(volume_sample); \n"
136//" \n"
137//" // output swizzled color \n"
138//" sample_output.set_color( make_float4(sample_color.y, \n"
139//" sample_color.z, \n"
140//" sample_color.x, \n"
141//" sample_color.w)); \n"
142" sample_output.set_color( make_float4(0.2f, 0.2f, 0.2f, 0.3f)); \n"
143" \n"
144" return NV_IDX_PROG_OK; \n"
145" } \n"
146;
147
148static const char* color_program_rgba =
149" NV_IDX_DEVICE_INLINE_MEMBER int execute( \n"
150" const Sample_info_self& sample_info, \n"
151" Sample_output& sample_output) \n"
152" { \n"
153" const uint field_idx = 0u; \n"
154" const float3& sample_position = sample_info.sample_position_object_space; \n"
155" // lookup color/opacity values from sampler and colormap using sample alpha value \n"
156" const auto& sample_context = sample_info.sample_context; \n"
157" // get the volume sampler from the sparse volume reference \n"
158" const auto sampler = state.self.generate_sampler<float>(field_idx, sample_context);\n"
159" // scalar volume sample \n"
160" const float volume_sample = sampler.fetch_sample(sample_position); \n"
161" const float4 sample_color = state.self.get_colormap().lookup(volume_sample.w); \n"
162" \n"
163" // output swizzled volume color, but using remapped opacity value \n"
164" sample_output.set_color( make_float4(sample_color.y, \n"
165" sample_color.z, \n"
166" sample_color.x, \n"
167" sample_color.w)); \n"
168" \n"
169" return NV_IDX_PROG_OK; \n"
170" } \n"
171;
172
173static const char* inquire_program =
174" // The user program used for picking. \n"
175" NV_IDX_DEVICE_INLINE_MEMBER int inquire( \n"
176" const Sample_info_self& sample_info, \n"
177" Query_results& query_results) \n"
178" { \n"
179" // sample_info.ray_t is automatically written \n"
180" // color is automatically written \n"
181" \n"
182" // we could invalidate current sample to skip/ignore it \n"
183" //query_results.invalidate_sample(); \n"
184" const uint field_idx = 0u; \n"
185" const float3& sample_position = sample_info.sample_position_object_space; \n"
186" // lookup color and opacity values \n"
187" const auto& sample_context = sample_info.sample_context; \n"
188" // get the volume sampler from the sparse volume reference \n"
189" const auto sampler = state.self.generate_sampler<float>(field_idx, sample_context);\n"
190" // scalar volume sample \n"
191" const float v = sampler.fetch_sample(sample_position); \n"
192" \n"
193" query_results.write_value<float>(0u /*user_value_idx*/, v); \n"
194" \n"
195" counter += 1; \n"
196" if (counter & 1) { \n"
197" // write every other counter as user value \n"
198" query_results.write_value<int>(1u /*user_value_idx*/, counter); \n"
199" } \n"
200" \n"
201" const float3 normal = make_float3(1.f, 0.3f, 0.1f); \n"
202" query_results.write_value<float3>(2u /*user_value_idx*/, normal); \n"
203" \n"
204" return NV_IDX_PROG_OK; \n"
205" \n"
206" // we can stop sampling: \n"
207" //return NV_IDX_PROG_TERMINATE_PROGRAM_INSTANCE; \n"
208" } \n"
209;
210
211}//volume
212//----------------------------------------------------------------------
213
215{
216public:
217 const char* name() const { return "Overlapping Volume and Shapes"; }
218
219 void register_classes(nv::index::IIndex* index_interface) const
220 {
221 // No serializable class registration is needed for this example
222 }
223
224 const char* get_roi_string() const
225 {
226 return "0 0 0 1024 1024 1024";
227 }
228
229 const mi::math::Bbox< mi::Float32, 3> get_roi_box() const
230 {
231 return nv::index::app::get_bbox_from_string<mi::Float32,3>(get_roi_string());
232 }
233
235 nv::index::app::IApplication_layer* app_layer,
236 Scene_info& scene_info,
237 const mi::math::Bbox< mi::Float32, 3>& roi_bbox,
238 const mi::neuraylib::Tag& session_tag,
239 std::map<std::string, std::string>& opt_map,
240 mi::neuraylib::IDice_transaction* dice_transaction) const
241 {
242 // Access the session instance from the database.
243 mi::base::Handle<const nv::index::ISession> session(
244 dice_transaction->access<const nv::index::ISession>(session_tag));
245 check_success(session.is_valid_interface());
246
247 // Access (edit mode) the scene instance from the database.
248 mi::base::Handle<nv::index::IScene> scene(
249 dice_transaction->edit<nv::index::IScene>(session->get_scene()));
250 check_success(scene.is_valid_interface());
251
252
253 // Add a light and a material
254 {
255 // Set the default light source
256 mi::base::Handle<nv::index::IDirectional_light> light_global(
257 scene->create_attribute<nv::index::IDirectional_light>());
258 check_success(light_global.is_valid_interface());
259 light_global->set_direction(mi::math::Vector<mi::Float32, 3>(0.5f, 0.f, 1.f));
260 const mi::neuraylib::Tag light_global_tag = dice_transaction->store_for_reference_counting(light_global.get());
261 check_success(light_global_tag.is_valid());
262 scene->append(light_global_tag, dice_transaction);
263
264 // Set the default material
265 mi::base::Handle<nv::index::IPhong_gl> phong_global(scene->create_attribute<nv::index::IPhong_gl>());
266 check_success(phong_global.is_valid_interface());
267 phong_global->set_ambient(mi::math::Color(0.1f, 0.15f, 0.1f, 1.0f));
268 phong_global->set_diffuse(mi::math::Color(0.95f, 0.3f, 0.3f, 1.0f));
269 phong_global->set_specular(mi::math::Color(0.4f, 0.4f, 0.5f, 1.0f));
270 phong_global->set_shininess(100);
271 const mi::neuraylib::Tag phong_global_tag = dice_transaction->store_for_reference_counting(phong_global.get());
272 check_success(phong_global_tag.is_valid());
273 scene->append(phong_global_tag, dice_transaction);
274 }
275
276
277 // Shapes
278 {
279 mi::base::Handle<nv::index::IStatic_scene_group> shape_group(
280 scene->create_scene_group<nv::index::IStatic_scene_group>());
281 check_success(shape_group.is_valid_interface());
282
283
284 // Append the surface sample program
285 const int user_prg = nv::index::app::get_sint32(opt_map["user_program_mode"]);
286 if (user_prg)
287 {
288 mi::base::Handle<nv::index::ISurface_sample_program> surface_sample_program(
289 scene->create_attribute<nv::index::ISurface_sample_program>());
290 check_success(surface_sample_program.is_valid_interface());
291
292 std::string program_src = scene_info.rtc_program_source;
293 if (program_src.empty()) {
294 program_src = program_begin;
295 program_src.append(color_program);
296 if (user_prg > 1)
297 {
298 program_src.append(inquire_program);
299 }
300 program_src.append(program_end);
301 scene_info.rtc_program_source = program_src;
302 }
303 surface_sample_program->set_program_source(program_src.c_str());
304
305 const mi::neuraylib::Tag surface_program_tag =
306 dice_transaction->store_for_reference_counting(surface_sample_program.get());
307 check_success(surface_program_tag.is_valid());
308 shape_group->append(surface_program_tag, dice_transaction);
309 }
310
311
312 // Add various shapes with individual materials
313 if (true) {
314 // 340, 410 (313, 444 with cone)
315 mi::base::Handle<nv::index::IPhong_gl> phong_0(scene->create_attribute<nv::index::IPhong_gl>());
316 check_success(phong_0.is_valid_interface());
317 phong_0->set_ambient(mi::math::Color(0.f, 0.3f, 0.0f, 1.0f));
318 phong_0->set_diffuse(mi::math::Color(0.f, 0.1f, 0.0f, 1.0f));
319 phong_0->set_specular(mi::math::Color(0.2f, 0.2f, 0.2f, 1.0f));
320 phong_0->set_shininess(10);
321 const mi::neuraylib::Tag phong_0_tag = dice_transaction->store_for_reference_counting(phong_0.get());
322 check_success(phong_0_tag.is_valid());
323 shape_group->append(phong_0_tag, dice_transaction);
324
325 mi::base::Handle<nv::index::ISphere> sphere(scene->create_shape<nv::index::ISphere>());
326 check_success(sphere.is_valid_interface());
327 sphere->set_center(mi::math::Vector<mi::Float32, 3>(0.3f, 0.5f, 0.3f));
328 sphere->set_radius(0.1f);
329 {
330 const mi::neuraylib::Tag tag = dice_transaction->store_for_reference_counting(
331 sphere.get(), mi::neuraylib::NULL_TAG, "sphere");
332 check_success(tag.is_valid());
333 shape_group->append(tag, dice_transaction);
334 }
335 }
336
337 if (true) {
338 // 633, 370
339 mi::base::Handle<nv::index::IPhong_gl> phong_1(scene->create_attribute<nv::index::IPhong_gl>());
340 check_success(phong_1.is_valid_interface());
341 phong_1->set_ambient(mi::math::Color(0.f, 0.1f, 0.4f, 1.0f));
342 phong_1->set_diffuse(mi::math::Color(0.f, 0.3f, 0.6f, 1.0f));
343 phong_1->set_specular(mi::math::Color(0.4f, 0.4f, 0.5f, 1.0f));
344 phong_1->set_shininess(10);
345 const mi::neuraylib::Tag phong_1_tag = dice_transaction->store_for_reference_counting(phong_1.get());
346 check_success(phong_1_tag.is_valid());
347 shape_group->append(phong_1_tag, dice_transaction);
348
349 mi::base::Handle<nv::index::IEllipsoid> ellipsoid(scene->create_shape<nv::index::IEllipsoid>());
350 check_success(ellipsoid.is_valid_interface());
351 ellipsoid->set_center(mi::math::Vector<mi::Float32, 3>(0.750f, 0.410f, 0.100f));
352 ellipsoid->set_semi_axes(
353 mi::math::Vector<mi::Float32, 3>(0.15f, 0.f, 0.f),
354 mi::math::Vector<mi::Float32, 3>(0.f, 0.15f, 0.f),
355 0.20f);
356 {
357 const mi::neuraylib::Tag tag = dice_transaction->store_for_reference_counting(
358 ellipsoid.get(), mi::neuraylib::NULL_TAG, "ellipsoid");
359 check_success(tag.is_valid());
360 shape_group->append(tag, dice_transaction);
361 }
362 }
363
364 if (true) {
365 // 273, 468
366 mi::base::Handle<nv::index::IPhong_gl> phong_2(scene->create_attribute<nv::index::IPhong_gl>());
367 check_success(phong_2.is_valid_interface());
368 phong_2->set_ambient(mi::math::Color(0.15f, 0.1f, 0.1f, 1.0f));
369 phong_2->set_diffuse(mi::math::Color(0.75f, 0.1f, 0.1f, 1.0f));
370 phong_2->set_specular(mi::math::Color(0.5f, 0.4f, 0.4f, 1.0f));
371 phong_2->set_shininess(50);
372 const mi::neuraylib::Tag phong_2_tag = dice_transaction->store_for_reference_counting(phong_2.get());
373 check_success(phong_2_tag.is_valid());
374 shape_group->append(phong_2_tag, dice_transaction);
375
376 mi::base::Handle<nv::index::ICone> cone(scene->create_shape<nv::index::ICone>());
377 check_success(cone.is_valid_interface());
378 cone->set_center(mi::math::Vector<mi::Float32, 3>(0.250f, 0.075f, 0.100f));
379 cone->set_tip(mi::math::Vector<mi::Float32, 3>(0.350f, 0.075f, 0.050f));
380 cone->set_radius(0.10f);
381 cone->set_capped(false);
382 {
383 const mi::neuraylib::Tag tag = dice_transaction->store_for_reference_counting(
384 cone.get(), mi::neuraylib::NULL_TAG, "cone");
385 check_success(tag.is_valid());
386 shape_group->append(tag, dice_transaction);
387 }
388 }
389
390 if (true) {
391 // 596, 502
392 mi::base::Handle<nv::index::IPhong_gl> phong_3(scene->create_attribute<nv::index::IPhong_gl>());
393 check_success(phong_3.is_valid_interface());
394 phong_3->set_ambient(mi::math::Color(0.1f, 0.15f, 0.1f, 1.0f));
395 phong_3->set_diffuse(mi::math::Color(0.5f, 0.55f, 0.5f, 1.0f));
396 phong_3->set_specular(mi::math::Color(0.4f, 0.4f, 0.5f, 1.0f));
397 phong_3->set_shininess(80);
398 const mi::neuraylib::Tag phong_3_tag = dice_transaction->store_for_reference_counting(phong_3.get());
399 check_success(phong_3_tag.is_valid());
400 shape_group->append(phong_3_tag, dice_transaction);
401
402
403 mi::base::Handle<nv::index::ICylinder> cylinder(scene->create_shape<nv::index::ICylinder>());
404 check_success(cylinder.is_valid_interface());
405 cylinder->set_bottom(mi::math::Vector<mi::Float32, 3>(0.850f, 0.705f, 0.700f));
406 cylinder->set_top(mi::math::Vector<mi::Float32, 3>(0.810f, 0.745f, 0.700f));
407 cylinder->set_radius(0.10f);
408 cylinder->set_capped(true);
409 {
410 const mi::neuraylib::Tag tag = dice_transaction->store_for_reference_counting(
411 cylinder.get(), mi::neuraylib::NULL_TAG, "cylinder");
412 check_success(tag.is_valid());
413 shape_group->append(tag, dice_transaction);
414 }
415 }
416
417 {
418 mi::neuraylib::Tag tag = dice_transaction->store_for_reference_counting(
419 shape_group.get(), mi::neuraylib::NULL_TAG, "shapes");
420 check_success(tag.is_valid());
421
422 // append the static scene group to the hierarchical scene description.
423 scene->append(tag, dice_transaction);
424 }
425 }
426
427 // Volume
428 {
429 mi::base::Handle<nv::index::IStatic_scene_group> volume_group(
430 scene->create_scene_group<nv::index::IStatic_scene_group>());
431 check_success(volume_group.is_valid_interface());
432
433 const int user_prg = nv::index::app::get_sint32(opt_map["user_program_mode"]);
434 if (user_prg) {
435 mi::base::Handle<nv::index::IVolume_sample_program> volume_sample_program(
436 scene->create_attribute<nv::index::IVolume_sample_program>());
437 check_success(volume_sample_program.is_valid_interface());
438
439 std::string program_src = volume::program_begin;
440 program_src.append(opt_map["rvol.voxel_format"] == "rgba8" ? volume::color_program_rgba : volume::color_program_scalar);
441 if (user_prg > 1) {
442 program_src.append(volume::inquire_program);
443 }
444 program_src.append(volume::program_end);
445 volume_sample_program->set_program_source(program_src.c_str());
446
447 const mi::neuraylib::Tag volume_program_tag =
448 dice_transaction->store_for_reference_counting(volume_sample_program.get());
449 check_success(volume_program_tag.is_valid());
450 volume_group->append(volume_program_tag, dice_transaction);
451 }
452
453 {
454 // Add a sparse_volume_render_properties to the scene.
455 mi::base::Handle<nv::index::ISparse_volume_rendering_properties> sparse_render_prop(
456 scene->create_attribute<nv::index::ISparse_volume_rendering_properties>());
457 sparse_render_prop->set_filter_mode(nv::index::SPARSE_VOLUME_FILTER_NEAREST);
458 sparse_render_prop->set_sampling_distance( 1.0);
459 sparse_render_prop->set_reference_sampling_distance( 1.0);
460 sparse_render_prop->set_voxel_offsets( mi::math::Vector<mi::Float32, 3>(0.5f, 0.5f, 0.5f));
461 sparse_render_prop->set_preintegrated_volume_rendering(false);
462 sparse_render_prop->set_lod_rendering_enabled( false);
463 sparse_render_prop->set_lod_pixel_threshold( 2.0);
464 sparse_render_prop->set_debug_visualization_option( 0);
465 const mi::neuraylib::Tag sparse_render_prop_tag
466 = dice_transaction->store_for_reference_counting(sparse_render_prop.get());
467 check_success(sparse_render_prop_tag.is_valid());
468 volume_group->append(sparse_render_prop_tag, dice_transaction);
469 INFO_LOG << "Created a sparse_render_prop_tag: tag = " << sparse_render_prop_tag;
470 }
471 {
472 // Create a color map using an external utility function.
473 const mi::Sint32 colormap_entry_id = 40; // same as demo application's colormap file 40
474 mi::neuraylib::Tag colormap_tag =
475 create_colormap(colormap_entry_id, scene.get(), dice_transaction);
476 check_success(colormap_tag.is_valid());
477
478 // Add a clormap (40) to the scene
479 volume_group->append(colormap_tag, dice_transaction);
480 INFO_LOG << "Add a colormap to the scene: tag = " << colormap_tag;
481 }
482
483 // Parameter to feed the synthetic volume generator callback
484 const mi::math::Vector<mi::Uint32, 3> volume_size(4, 4, 2);
485 const mi::math::Bbox<mi::Uint32, 3> bbox_u32(mi::math::Vector<mi::Uint32, 3>(0), volume_size);
486 const mi::math::Bbox<mi::Float32, 3> bbox_f32(bbox_u32);
487
488 // sparse volume creation parameter
489 std::map<std::string, std::string> sparse_volume_opt;
490 sparse_volume_opt["type"] = "sparse_volume";
491 sparse_volume_opt["importer"] = "synthetic";
492 std::stringstream sstr;
493 sstr << "0 0 0 " << volume_size.x << " " << volume_size.y << " " << volume_size.z;
494 sparse_volume_opt["bbox"] = sstr.str();
495 sparse_volume_opt["voxel_format"] = "uint8"; // fixed voxel format
496 sparse_volume_opt["synthetic_type"] = "default";
497 nv::index::IDistributed_data_import_callback* importer_callback =
498 get_importer_from_application_layer(
499 app_layer,
500 "nv::index::plugin::base_importer.Sparse_volume_generator_synthetic",
501 sparse_volume_opt);
502
503 // Create the sparse volume scene element
504 mi::math::Matrix<mi::Float32, 4, 4> transform_mat(1.0f); // Identity matrix
505 const mi::math::Vector<mi::Float32, 3> scale(1.0f, 1.0f, 1.0f);
506 const mi::math::Vector<mi::Float32, 3> translate(0.0f, 0.0f, 0.0f);
507 const bool is_rendering_enabled = true;
508
509 mi::base::Handle<nv::index::ISparse_volume_scene_element> volume_scene_element(
510 scene->create_sparse_volume(bbox_f32, transform_mat, importer_callback, dice_transaction));
511 check_success(volume_scene_element.is_valid_interface());
512 volume_scene_element->set_enabled(is_rendering_enabled);
513
514 {
515 const mi::neuraylib::Tag tag = dice_transaction->store_for_reference_counting(
516 volume_scene_element.get(), mi::neuraylib::NULL_TAG, "volume");
517 check_success(tag.is_valid());
518 volume_group->append(tag, dice_transaction);
519 }
520
521 {
522 mi::neuraylib::Tag tag = dice_transaction->store_for_reference_counting(
523 volume_group.get(), mi::neuraylib::NULL_TAG, "volume_group");
524 check_success(tag.is_valid());
525
526 // append the static scene group to the hierarchical scene description.
527 scene->append(tag, dice_transaction);
528 }
529
530 }
531
532 return true;
533 }
534
536 const mi::neuraylib::Tag& camera_tag,
537 mi::neuraylib::IDice_transaction* transaction) const
538 {
539 check_success(camera_tag.is_valid());
540 check_success(transaction != 0);
541
542 mi::base::Handle<nv::index::IPerspective_camera> cam(
543 transaction->edit<nv::index::IPerspective_camera>(camera_tag));
544 check_success(cam.is_valid_interface());
545
546 // Set the camera parameters to see the whole scene
547 const mi::math::Vector<mi::Float32, 3> from(0.36143f, -0.77451f, 0.60702f);
548 const mi::math::Vector<mi::Float32, 3> up(0.093147f, 0.652653f, 0.751908f);
549 mi::math::Vector<mi::Float32, 3> viewdir(0.12330f, 0.741816f, -0.659170f);
550 viewdir.normalize();
551
552 cam->set(from, viewdir, up);
553 cam->set_aperture(0.033f);
554 cam->set_aspect(1.f);
555 cam->set_focal(0.03f);
556 cam->set_clip_min(0.001f);
557 cam->set_clip_max(10000.f);
558 }
559};
560
561} // namespace simple_shapes
562
563#endif // EXAMPLES_RAY_SAMPLING_OVERLAPPING_H
bool create_scene(nv::index::app::IApplication_layer *app_layer, Scene_info &scene_info, const mi::math::Bbox< mi::Float32, 3 > &roi_bbox, const mi::neuraylib::Tag &session_tag, std::map< std::string, std::string > &opt_map, mi::neuraylib::IDice_transaction *dice_transaction) const
void register_classes(nv::index::IIndex *index_interface) const
void setup_camera(const mi::neuraylib::Tag &camera_tag, mi::neuraylib::IDice_transaction *transaction) const
const mi::math::Bbox< mi::Float32, 3 > get_roi_box() const
static const char * program_end
static const char * color_program_scalar
static const char * color_program_rgba
static const char * inquire_program
static const char * program_begin
static const char * program_end
static const char * program_begin
static const char * inquire_program
static const char * color_program
Scene setup interface for ray sampling example.
#define check_success(expr)