1
$\begingroup$

I'm trying to recreate a "Portal" effect which is similar to a Depth Shader used inside of Unity. I've seen many tutorials for doing something similar on Blender, although it seems most of these tutorials involve cutting out a hole in a plane and just using some camera tricks to achieve this illusion. Are there any other, more flexible solutions out there?

enter image description here

$\endgroup$
4
  • $\begingroup$ blender.stackexchange.com/a/214311/2214 $\endgroup$
    – vklidu
    Commented Jan 19, 2022 at 7:01
  • $\begingroup$ What tutorial you used and what kind of more flexibility do you expect? From your image I'm not sure what I'm looking at ... What 0/1 means? $\endgroup$
    – vklidu
    Commented Jan 19, 2022 at 7:05
  • $\begingroup$ I just want to achieve this result without using a hole in the wall Approach . I want to achieve it using one object that could for example be moved around, seen from different angles, etc $\endgroup$
    – Matthew
    Commented Jan 19, 2022 at 12:41
  • $\begingroup$ I think the effect you're going for is related to Interior Mapping which, although is technically possible in blender, it can be a real pain to pull off. $\endgroup$ Commented Jan 19, 2022 at 16:55

2 Answers 2

3
$\begingroup$

By Camera trick you probably mean ...

version Parallax Cube Mapping

it works like a magic for interior faked on plane with cube texture mapping

enter image description here

Easily faked with Mask texture, but illusion becomes broken when observed in animation, because space behind the rift is cubish and doesn't follow rift edges.

enter image description here

Here you can find a node group nicely organised.

version Parallax Occlusion Mapping

In your case you should use a POM (parallax Occlusion Mapping) nodetree using a depth texture to layerevector into depth steps ... simle example of technique ...

Here used only depth pass for the rift ... 32 layers

enter image description here

If I checked right reference ... Unity does the same ... with some specific amount of "layers" you affect just distance between them.

For the sword part technically hiden behind the plane is used Parallax CubeMap technique with shifted left right sides to center and textured by baked material.

enter image description here

64 layers ... enter image description here

Texture on upper part of sword is not seamless, because baked in separately (at home machine) ... sorry. And since sword texture in shader is just a plane it has not a thickness.


Anyway as conclusion - it seems to me much easier and precise just grab rift texture and use it as a transparency mask for a wall shader with Texture coordinates set to sword.

version Transparent Mask

First drag&drop rift image into 3D view (as Empty Image), search for Trace GP to generate PG object from texture, W > Convert to Curve (than extrude curve or convert to mesh and extrude in edit mode).

enter image description here

Wall (Plane material)
Than use the same texture as Factor for Mix Shader of Transparent and Diffuse node with Texture Coordinates > Object > Empty ...

enter image description here

Parent all needed objects (rift object, sword, green light) to Empty.

enter image description here

enter image description here

Final result ...

enter image description here

Blend file on Dropbox (skip Sign-in).

$\endgroup$
5
  • $\begingroup$ Thanks! Yeah, parallax mapping is definitely the first part of the equation here. But iit's the sword object that I could find no tutorial on. It is placed outside of the plane. I would be interested in seeing your example $\endgroup$
    – Matthew
    Commented Jan 19, 2022 at 23:51
  • $\begingroup$ Appreciate you taking the time to put this together. So, do you think it would be possible to combine your approach with interior mapping? I'd like to avoid the extruded geometry and keep the floor plane flat $\endgroup$
    – Matthew
    Commented Jan 21, 2022 at 3:32
  • $\begingroup$ I did not succeed ... and even I would it would be too visible that hole doesn't match the edges of the rift. Answer extended parallax version with an example of a way it is used usually (sure smaller distance between layers smoother result). $\endgroup$
    – vklidu
    Commented Jan 21, 2022 at 20:13
  • $\begingroup$ after some more searching I think this may be the answer: youtube.com/watch?v=txUCkthVriw $\endgroup$
    – Matthew
    Commented Jan 22, 2022 at 20:46
  • $\begingroup$ Hm ... if that would be solution for you great ... it seams we targeted to different thing :) Please post it as answer to help others :) It is quite interesting topic ... BTW I got working sword layer for parallax thing and for hole extended to 64 layers could be working with some limits I will update A when I merge those together. $\endgroup$
    – vklidu
    Commented Jan 22, 2022 at 21:55
0
$\begingroup$

After researching the topic a bit more, my preferred solution was to use:

  1. a holdout shader which renders everything behind it to be completely transparent

  2. a multi-layer compositing process, where the objects to hide are separated from other objects in the background.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .