Rendering images with Linescan camera-style distortion

   1267   6   0
User Avatar
Member
21 posts
Joined: Feb. 2020
Offline
I'm pretty stuck wrapping my head around how I could reproduce the distortion seen on Linescan camera images.

My particular case is with Linescan cameras scanning a vertical strip of pixels as traffic moves by at a slightly forward angle, which results in long-width images that feature "bowing" distortion effects at the front of vehicles as they pass by camera, however the detail remains sharp (i.e. not blurred or smeared from motion-blur/open shutter)

Vehicles in line behind the lead truck/car show similar bowing distortion so this is not typical camera distortion bulging out at all edges from center, instead it is based on subjects fast as vertical strips of pixels are captured.

I am unable to share client data, however here is a simple example of what I mean using a line art drawing warped in a similar fashion as the photo reference exhibits. How would I go about re-creating this effect in-camera as a single frame at rendertime in Houdini (I'm using H19.0.694)?



Aside from rendering a large number of similar vertical strips and stitching them together, I don't know how you reproduce this effect cleanly in Houdini - thanks for any insight you might be able to provide on how this could be tackled.
Edited by Arvan - Sept. 22, 2022 18:35:39

Attachments:
linescan-style_camera_distortion.jpg (156.0 KB)

User Avatar
Member
1746 posts
Joined: May 2006
Offline
The Right Way would be to write a lens shader that uses a time lookup that changes across the sensor. It's possible, I remember doing it a while ago, but that knowledge has left my brain, and it'd only allow you to do it within the current frame+shutter length timeframe.

A dumb but fun way is just do it in sops. You can get where points are relative to the camera plane with toNDC(). Use that to define a mask that runs up/down or left/right across the camera plane, chain a few timeshifts so that they're all x frames behind the current, then use the new ability to drive blendshapes with masks, you'll get a warpy gloopy thing.

In this example I'm not properly normalising the time offsets feeding into the blendshape, so fast moving things start to distort too much, but you can just fudge it back by scaling down the mask value.

Attachments:
slitscan_lazy.hip (569.6 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
7815 posts
Joined: Sept. 2011
Online
mestela
The Right Way would be to write a lens shader that uses a time lookup that changes across the sensor. It's possible, I remember doing it a while ago, but that knowledge has left my brain, and it'd only allow you to do it within the current frame+shutter length timeframe.

Isn't it built in to the Karma Lens shader?
User Avatar
Member
1746 posts
Joined: May 2006
Offline
ah yes, there's a rolling shutter mode in there, forgot about that!
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
1746 posts
Joined: May 2006
Offline
Little example, tried to play with the ramp on the rolling shutter section to curve the distortion, but I couldn't get it to do much.

Attachments:
karma_rolling_shutter.hip (707.6 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
21 posts
Joined: Feb. 2020
Offline
Thank you very much, @mestela and @jsmack - I really appreciate the insight. That sounds promising and your description and files help shine some light on where I need to dig deeper in Houdini.

Re: distorting the physical geometry itself - this is definitely a technique I'll keep in mind for organic objects, however because I am dealing with hard-surface vehicles with rigid/hard-line components in this case, the amount of additional subdivision the geometry would require on every component to smoothly distort it in this way is unfortunately prohibitive.

The lensing approach is looking most viable, possibly with additional post-processing in COPs or an image editor.
Edited by Arvan - Sept. 23, 2022 12:03:40
User Avatar
Member
21 posts
Joined: Feb. 2020
Offline
Following up: unfortunately the rolling shutter functionality of the Physical Lens shader does not appear to be implemented. Texture maps are not linked to the shader parameters, and linking them simply generates errors about "P" and "I" variables not being exported even though they do appear to be and the other distortion components of the shader work fine.

I checked in Houdini 19.5 and it is still in the same state there, so the rollign shutter aspect of the PhysicalLens does not appear to be something ready for actual use, which begs the question of why expose it to users in the first place.

After burning a few hours trying to find workarounds with it, I've come up empty-handed so I'll unfortunately have to see if there are older VOP or even SHOP solutions that would work.
  • Quick Links