Skip to content

parse_camera rendering bug #1547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
21220d1
add data field conversion for uint32 and commented back in ints 32 &64
nicolemarsaglia Mar 27, 2025
a87e34e
start of debugging. need to go into vtkm
nicolemarsaglia Mar 28, 2025
31095c9
merge with develop?
nicolemarsaglia Apr 3, 2025
ed01caf
add frustum debug
nicolemarsaglia Apr 8, 2025
8a56ba6
Merge branch 'develop' into task/2025_03_field_rendering_bug
nicolemarsaglia Apr 8, 2025
80666f8
update
nicolemarsaglia Apr 8, 2025
c4e1a6d
merge with dev
nicolemarsaglia Jun 4, 2025
b19fa78
change parse_camera order
nicolemarsaglia Jun 4, 2025
a5b69e2
Update Renderer.cpp
nicolemarsaglia Jun 4, 2025
0adb6c5
Update replay.cpp
nicolemarsaglia Jun 4, 2025
757f3e4
add some debugs and remove files that weren't supposed to be changed
nicolemarsaglia Jun 4, 2025
8df6fe0
Update Render.hpp
nicolemarsaglia Jun 4, 2025
a328f19
Merge branch 'develop' into task/2025_03_field_rendering_bug
nicolemarsaglia Jun 4, 2025
d29ed18
fix debug
nicolemarsaglia Jun 10, 2025
cd020d0
Merge branch 'develop' into task/2025_03_field_rendering_bug
nicolemarsaglia Jun 10, 2025
48294a6
idk why this got touched
nicolemarsaglia Jun 10, 2025
9ef241f
you shouldn't be here
nicolemarsaglia Jun 10, 2025
e6f5c1c
Update replay.cpp
nicolemarsaglia Jun 10, 2025
e8ea006
make the replay frustum its own thing
nicolemarsaglia Jun 10, 2025
ce2bd5f
check
nicolemarsaglia Jun 10, 2025
968d274
udpate baseline
nicolemarsaglia Jun 11, 2025
ab48dbc
Merge branch 'develop' into task/2025_03_field_rendering_bug
nicolemarsaglia Jun 18, 2025
9d291c3
update
nicolemarsaglia Jul 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
- Updated several preferred tpl versions

### Fixed
- Fix parse_camera where order you apply camera operations matters.
- Fixed WarpX filter that was not allowing for rendering of the output streamlines
- Fixed Uniform Grid bug only accepting 2D slices along the Z-axis.
- Resolved a few cases where MPI_COMM_WORLD was used instead instead of the selected MPI communicator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,41 @@ parse_camera(const conduit::Node camera_node, vtkm::rendering::Camera &camera)
view_vals[3]);
}

if(camera_node.has_child("look_at"))
if(camera_node.has_child("position"))
{
conduit::Node n;
camera_node["look_at"].to_float64_array(n);
camera_node["position"].to_float64_array(n);
const float64 *coords = n.as_float64_ptr();
vtkmVec3f look_at(coords[0], coords[1], coords[2]);
camera.SetLookAt(look_at);
vtkmVec3f position(coords[0], coords[1], coords[2]);
camera.SetPosition(position);
}

if(camera_node.has_child("position"))
// this is an offset from the current azimuth
if(camera_node.has_child("azimuth"))
{
vtkm::Float64 azimuth = camera_node["azimuth"].to_float64();
camera.Azimuth(azimuth);
}

if(camera_node.has_child("elevation"))
{
vtkm::Float64 elevation = camera_node["elevation"].to_float64();
camera.Elevation(elevation);
}

if(camera_node.has_child("zoom"))
{
double zoom = camera_node["zoom"].to_float64();
camera.Zoom(zoom_to_vtkm_zoom(zoom));
}

if(camera_node.has_child("look_at"))
{
conduit::Node n;
camera_node["position"].to_float64_array(n);
camera_node["look_at"].to_float64_array(n);
const float64 *coords = n.as_float64_ptr();
vtkmVec3f position(coords[0], coords[1], coords[2]);
camera.SetPosition(position);
vtkmVec3f look_at(coords[0], coords[1], coords[2]);
camera.SetLookAt(look_at);
}

if(camera_node.has_child("up"))
Expand All @@ -155,12 +174,6 @@ parse_camera(const conduit::Node camera_node, vtkm::rendering::Camera &camera)
if(camera_node.has_child("ypan")) xpan = camera_node["ypan"].to_float64();
camera.Pan(xpan, ypan);
}

if(camera_node.has_child("zoom"))
{
double zoom = camera_node["zoom"].to_float64();
camera.Zoom(zoom_to_vtkm_zoom(zoom));
}
//
// With a new potential camera position. We need to reset the
// clipping plane as not to cut out part of the data set
Expand All @@ -179,18 +192,6 @@ parse_camera(const conduit::Node camera_node, vtkm::rendering::Camera &camera)
clipping_range.Max = camera_node["far_plane"].to_float64();
camera.SetClippingRange(clipping_range);
}

// this is an offset from the current azimuth
if(camera_node.has_child("azimuth"))
{
vtkm::Float64 azimuth = camera_node["azimuth"].to_float64();
camera.Azimuth(azimuth);
}
if(camera_node.has_child("elevation"))
{
vtkm::Float64 elevation = camera_node["elevation"].to_float64();
camera.Elevation(elevation);
}
}

bool is_valid_name(const std::string &name)
Expand Down
18 changes: 17 additions & 1 deletion src/libs/vtkh/rendering/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <vtkh/utils/vtkm_dataset_info.hpp>
#include <vtkm/rendering/raytracing/Logger.h>

#define _DEBUG 0

namespace vtkh {

Renderer::Renderer()
Expand Down Expand Up @@ -212,7 +214,16 @@ Renderer::DoExecute()
}

int total_renders = static_cast<int>(m_renders.size());


#if _DEBUG
std::cerr << "total renders: " << total_renders << std::endl;
vtkm::Bounds g_bounds = m_input->GetGlobalBounds();
std::cerr << "Global Bounds: " << std::endl;
std::cerr << "X: " << g_bounds.X.Min << " " << g_bounds.X.Max << std::endl;
std::cerr << "Y: " << g_bounds.Y.Min << " " << g_bounds.Y.Max << std::endl;
std::cerr << "Z: " << g_bounds.Z.Min << " " << g_bounds.Z.Max << std::endl;
#endif

int num_domains = static_cast<int>(m_input->GetNumberOfDomains());
for(int dom = 0; dom < num_domains; ++dom)
{
Expand All @@ -228,6 +239,7 @@ Renderer::DoExecute()
const vtkm::cont::Field &field = data_set.GetField(m_field_name);
const vtkm::cont::CoordinateSystem &coords = data_set.GetCoordinateSystem();


if(cellset.GetNumberOfCells() == 0)
{
continue;
Expand All @@ -248,6 +260,10 @@ Renderer::DoExecute()

Render::vtkmCanvas &canvas = m_renders[i].GetCanvas();
const vtkmCamera &camera = m_renders[i].GetCamera();
#if _DEBUG
std::cerr << "CAMERA BEFORE VTKM RENDERCELLS: " << std::endl;
camera.Print();
#endif
m_mapper->SetCanvas(&canvas);
m_mapper->RenderCells(cellset,
coords,
Expand Down
Binary file modified src/tests/_baseline_images/render_1_000100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.