-
Hello! So, my goal is to create a material that can do the following. Render a camera view and specify the collection of objects into an image in real time and display it on a plane object. The idea is to mimic 2D animation parallax effects by creating different layers such as a mountain and forest. The Portal BSDF node sounds perfect on paper, but the problem is the node is limited to Cycles, doesn't have a way to isolate objects (unless we use geo nodes), and doesn't seem to have transparency allowing the portals to overlap each other properly. So, I ended up making a python script that does the following. Sets the view layer of the isolated collection, draws the camera view into an offscreen, read the offscreen texture color, then set the pixels of an image. This is the result of the python script. Each collection is rendered into its own image and displayed on a plane object. This is the result I'm aiming for. Animation playback is around 4 FPS for 7 images each at 1024 pixels which is very problematic. Technically the final render will be around 512 pixels because we are dividing the camera FOV in half to add overscan for parallax effects. So those were my failed attempts, but I'm curious if this can be done in Malt with better performance. I found this website mentioning FBO and was wondering if this is possible to implement on a mesh material? Or perhaps there is another method and I'm just overthinking it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
You can certainly do this by rendering each layer to its own texture. However if instead of that you scale down the mesh in the axis you want to flatten the object, and scale back the position used for shading, you get the same result with much less trouble (and much faster). Here I'm skipping the scaling in the shadow pass, so shadows still work normally. Note that there was a bug in the Transform node (actually I think is a driver bug) that I just fixed. So download the latest Malt release before opening the file. |
Beta Was this translation helpful? Give feedback.
On top of not flattening the mesh in shadow maps, you would have to displace it to its "original" position.
Speculars are view depended so you would have to compute them manually too.
If you want to take that route, you can use this as a reference since it's somewhat similar:
#559 (comment)