Jump to content

Deform Bend Camera Ray?


Recommended Posts

Is there a way to bend the I-ray over distance when rendering?

Trying to do something similar to Interstellar space bending scenes. So far I got it partially working with multiple frustrum planes in front of the camera (at different distances). Those carry a shader which continues the I-ray in an offset direction (using raytrace). This seems pretty slow. So I was wondering if there is any other way to do something like that?

Was thinking of using a volume / volume shader for that, but that might get a bit excessive ...

Link to comment
Share on other sites

As far as I understood, the shaders only use build-in raytrace functions, so my guess is that to achieve such a results, you would have (i) to cheat (like what you did by cumulating various planes that « difract » or bend the rays), or (ii) rewrite your own renderer :-) I guess this is what they did for Interstellar.

Just curious : are you trying something « physically based », that is to say taking into account mass of surrounding objects to « bend » space (or bend rays) ?

The cheat I would use, because I don’t have the skills to write my own renderer, or my own raytrace functions, would be to use particles, placed at time = 0 on each point of a grid (each pixel of à fake focal plane of your camera), give them a mass (although photon don’t have one, but this is to cheat the curvature of space around massive object : light goes straight but into a curved space...), and throw them straight into the scene, apply force fields based on surrounding objects (forces in 1/squared distance or other potential exotic fields found in astrophysics books ), and retrieve the color of surfaces they hit... Once they all have colors, you can reconstruct the image knowing the initial position of your particle.

You could even have more samples per pixel by increasing resolution of your grid, but you would loose secondary rays, shadows etc... except if you cheat one more time, by « baking » the textures and lighting first and then just play with the particles / pseudo-primary rays of this poor renderer just to get the a « gravitational lens » FX...

Hope this helps :-)

3817D1C5-DC71-442E-8DF2-165EE6784FCF.jpeg

Edited by StepbyStepVFX
Link to comment
Share on other sites

i don't think you can bend a ray in houdini, because i remember i've read somewhere that someone was trying to bend a refracted ray inside of an object of varying density, or something like that, and was not possible. 

I was doing tests ages ago to see if it was possible to control the direction of a ray passing through a volume, so sampling the volume in steps maybe and sending new rays.. but i've never got that far and i knew from the beginning it would have been super slow. 

what you can do is maybe using a lens shader, you can explicitly set the starting point and the direction of the ray for every pixel you want to sample. they will still be straight rays, but you can focus them where you need. I think this idea is what the mantra bake is doing under the hood: for every pixel set the position and direction of the camera and run throught the object. 

so you can maybe find the pos and dir in some way, even running a particle sim like StepbyStepVFX suggested,and using the last bits of the particles position and directions before they collide maybe.

I can't remember how all of this plays with multisampling tho, i guess it just interpolate between positions in the sub pixels.

Edited by MENOZ
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...