Rendering issues during movement
your work is good,thank you In the NS viewer, when the user's perspective moves from point A to point B, the rendering outcome transitions from clear (at position A) to blurry and then back to clear (at position B). As demonstrated:
The rendering resolution originates from the render_state_machine.py file,calculate_image_res function. For instance, the resolution at position A is 1000x1000 which is very clear, during the transitional process, the resolution drops to 100x100 which appears blurry, and upon reaching position B, the resolution returns to 1000x1000, thus restoring clarity.
I have 2 question:
- the image of 100x100 pixels cannot fill the entire screen, yet the rendering result does cover the entire screen. I suspect that the image of 100x100 pixels was stretched to fit. Is this correct? Could you tell me where the specific processing codelocated? If my guess is incorrect, could you please explain the correct processing code?
- During the transition from position A to position B, there is some lag, and I suspect that a delay function has been set for the movement process. Is this right? I am very grateful for your assistance.
Hello!
the image of 100x100 pixels cannot fill the entire screen, yet the rendering result does cover the entire screen. I suspect that the image of 100x100 pixels was stretched to fit. Is this correct? Could you tell me where the specific processing codelocated? If my guess is incorrect, could you please explain the correct processing code?
Yeah, we just stretch the image. The image is rendered here: https://github.com/nerfstudio-project/viser/blob/a52d9a68657acce2662b3cc4c3e1b6f29a5fffbe/src/viser/client/src/App.tsx#L516-L624
Where we create a plane whose bounds are calculated to fill the screen.
During the transition from position A to position B, there is some lag, and I suspect that a delay function has been set for the movement process. Is this right?
I'm not sure about this one, but it could just be rendering or communication latency.
thank you. for the question1, Which function determines the resolution? For example, 100 * 100. I think this is a python function in render_state_machine.py . def _calculate_image_res(self, aspect_ratio: float) -> Tuple[int, int]: """Calculate the maximum image height that can be rendered in the time budget
Args:
apect_ratio: the aspect ratio of the current view
Returns:
image_height: the maximum image height that can be rendered in the time budget
image_width: the maximum image width that can be rendered in the time budget
"""
max_res = self.viewer.control_panel.max_res
if self.state == "high":
# high res is always static
image_height = max_res
image_width = int(image_height * aspect_ratio)
if image_width > max_res:
image_width = max_res
image_height = int(image_width / aspect_ratio)
elif self.state in ("low_move", "low_static"):
if writer.is_initialized() and EventName.VIS_RAYS_PER_SEC.value in GLOBAL_BUFFER["events"]:
vis_rays_per_sec = GLOBAL_BUFFER["events"][EventName.VIS_RAYS_PER_SEC.value]["avg"]
else:
vis_rays_per_sec = 100000
target_fps = self.target_fps
num_vis_rays = vis_rays_per_sec / target_fps
image_height = (num_vis_rays / aspect_ratio) ** 0.5
image_height = int(round(image_height, -1))
image_height = max(min(max_res, image_height), 30)
image_width = int(image_height * aspect_ratio)
if image_width > max_res:
image_width = max_res
image_height = int(image_width / aspect_ratio)
else:
raise ValueError(f"Invalid state: {self.state}")
return image_height, image_width
Am I right? Is there any other function in Viser that determines resolution? thank you