Here’s the zip: [Removed, uploading new zip]
To see the second kind of portals, you have to hit Play. Hitting Z will teleport between locations.
I haven’t solved the issue of how to get the 2D portals not to see each other yet, didn’t look into it, so they’re all just offset from each other instead. They almost line up in some of the shots above but I messed it all up. If you want to fix it, the locations are exactly 25600 units apart in the X axis.
Edit: I solved the portal blocking problem by hiding the display surfaces if you’re not at that location. Flying over will break it until you teleport a couple of times though, so some sort of radius-enabler will work better if you can move between the portals via some way other than the portals themselves. I’ll upload a new file in a moment.
You can do some funky stuff with repeating render targets:
Here’s the new project with fixed portal overlaps: MEGA
So your situation has me thinking that you need the 2D portals and you never travel between them.
This would allow you to fill in broken stairs (just visually) by throwing up a sphere that projects the other scene across. You’d have to use blueprints to make the stairs traversable by removing a wall or adding in flooring, but this would work and would capture the look of the other scene in that sphere. So say you were in some future decrepit world and you could enable a specific portal at a location to show stairs that were always there.
You’d probably have to do this with a stencil of some sort and post-processing, because at some point you’re going to be inside the portal sphere and anything it was occluding will show up again. I’ll have a crack at that now too because I want to see if I can get a render target depth map and sort the results in a post-process material.
This is what I came up with. The sphere is using a custom render depth and is filled by the 2d render texture:
It looks OK, I think that it’s probably not the best solution. Custom assets that appear and disappear in a single scene would be better for this effect.
The problem with the stairs being offset slightly is more to do with the editor viewport not matching the render texture’s dimensions. If it was set up properly with the viewport values being fed into various places it’d line up fine. It still lags a frame behind though. Also it still doesn’t display right if you’re inside the sphere. This is not a good option.
Hi!
Looks really great Thanks for sharing.
I had never tried the cube capture component but I did try the 2d capture component. I was displaying it on a sphere, like you, but I wasn’t using a post process material, I was using a material, and what I was rendering on the sphere was a bit late compared to the current world.
I’m wondering if I can have a different skybox/ambient light for the different levels.
Also since I have a third person view I feel like I need to display the character twice, once in each world and have them match motion perfectly.
Last thing, I made a mistake in the drawings I did. I don’t want to see the background of the world inside the portal, I just want to see the inside world in the volume of the sphere. As if the portal/sphere we see had been cut out of the other world and put in our world, but everything around that sphere stays in our world. I thought about dropping fragments that are not in the volume of the sphere for that purpose. Before you talked about filtering by depth to keep the occlusion. I think it would be the same kind of thing to display only the bits I want.
Yes, I never travel between them! Shouldn’t call them portal maybe, it’s too confusing. The very purpose is to fill up stairs and things like that and also switch between the worlds to open new portals and move to a different spot, then switch back and thanks to the new opened portals or the fact that you are switching back from another spot you managed to go towards the goal (for now it’s a puzzle game where you have to reach the goal)
I figured out how to get a second depth pass out of another 2d capture component, but it’s slightly useless because everywhere that isn’t the render target is just the surface that I’m projecting it on. In order to participate in the custom render depth it has to be visible and not at all translucent. So filtering out the background is a dead-end.
So the simplest option by far is to just do a regular material with the render texture projected on to it and a synced capture component in a different location, which is the example in the zip file.
Oh I see, that’s true. I hadn’t thought about that. So I’m not going to be able to fight frame lag then.
Probably not. Even Heroes seems to suffer from it.
Then I think I should abort this solution. The player will often get in and out of spheres, be on the border of one, I really need the display to match in and out of the sphere. I’ll put the 2 worlds at the same place again, use opacity mask to display/hide worlds, but the light is the biggest issue. It’s going to light everything up the same way. I need to find a way to light up the 2 bits of the screen (the sphere projection on the screen, and around the sphere) with different lights.
Thanks a lot for your help and your work, it helped me progress towards understanding better the issues I’m facing.
You lose a lot performance-wise by using masked opacity on everything (which is the only transparency mode to properly support lighting). If there’s a masked object in the stencil the renderer has to draw each object from back-to-front rather than front-to-back and you end up drawing over the same regions over and over.
If you download the project I uploaded you can check out the level blueprint and see how to hide items in-game dynamically like I did with the 2d portal exits. That’ll properly remove them from the draw call rather than trying to draw a whole lot of invisible objects at immense cost.
What you can do is have two materials - one opaque, one transparent - and two material instances per object inheriting from them. You can dynamically switch the material instances using a naming scheme if you want them to unhide and fade/glow in during transitions and then when that transition is done flip them back to opaque.
Hi!
This is the level blueprint I found in your project, I can’t identify which bit is about the dynamical in-game object hiding mecanism. Also the project had a bug when I opened it, it was doing GetPlayerCharacter but there was no player character in the scene (it was logging an error when I was teleporting with Z), so I changed it to GetPlayerPawn and I cuold teleport after that. Which make me think you might have not uploaded the version of the project you wanted to upload.
You’re right, apparently I didn’t upload it yet. I’ll get right on that. Here’s the relevant blueprint:
Si I tried to implement a post process material to fight against the frame lag that using the rendertarget in the main pass was putting me through. Here is the blueprint.
Here is the result
Here is the main pass material result to compare it with
We can notice that the post process one is display over the see (because post process happens after everything) and that its color is different. I don’t understand why it is different though. I’ll have to investigate when 2dcapture actually captures the image in the deferred rendering process.
You can use one of the post-process buffers to mask out things hiding behind transparent surfaces. It’s a lot of work though just to avoid slight frame lag.
It’s a tough proposition, but I’m sure there’s a way to fix it. I’ll look into it more this weekend. I don’t understand why a rendertexture would lag behind the main frame so there’s probably a way to control it.
Also, you can do post-process BEFORE tonemapping, which may help. Lastly, I found the post-processing option to be the least useful. You can do a lot more when you use the rendertexture as a surface rather than a post-effect.
Is the version you just sent supposed to contain the set actor in game modification? Is it not in the level blueprint.
It should be there. Try dragging around. The latest version has comment boxes around the nodes and the previous version doesn’t.
I don’t see the comment boxes either. What is new compared to the previous version is the broken stairs resource for example, but the level blueprint doesn’t have anything new I’m afraid.
Maybe uploading with the same name is causing some problems. I’ll try again.